From 448fc2c7c35c6aa0dd7c3e2fcce8e50bc8bc8abb Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 24 Oct 2024 09:49:58 +0200 Subject: [PATCH 01/32] drop cash assist --- .github/workflows/ci.yml | 3 +- src/frontend/data/schema.graphql | 451 +- .../grievances/fakeGrievanceTicket.ts | 185 - .../paymentmodule/fakeApolloPaymentPlan.ts | 3 +- .../payments/fakeApolloAllCashPlans.ts | 78 - .../payments/fakeApolloAllPaymentRecords.ts | 73 - .../fixtures/payments/fakeCashPlan.ts | 214 - .../fixtures/population/fakeHousehold.ts | 51 - src/frontend/src/__generated__/graphql.tsx | 1766 +------ .../src/__generated__/introspection-result.ts | 3 - .../apollo/fragments/HouseholdFragments.ts | 18 - .../fragments/PaymentRecordFragments.ts | 71 - .../payments/MarkPaymentRecordAsFailed.ts | 11 - .../RevertMarkPaymentRecordAsFailed.ts | 19 - .../reporting/CreateDashboardReport.ts | 9 - .../apollo/queries/payments/AllCashPlans.ts | 77 - .../queries/payments/AllPaymentRecords.ts | 68 - .../src/apollo/queries/payments/CashPlan.ts | 92 - .../queries/payments/LookUpPaymentRecords.ts | 46 - .../apollo/queries/payments/PaymentRecord.ts | 78 - .../CashPlanDetails/CashPlanDetails.test.tsx | 13 - .../core/CashPlanDetails/CashPlanDetails.tsx | 152 - .../CashPlanDetails.test.tsx.snap | 342 -- .../components/core/CashPlanDetails/index.ts | 1 - .../src/components/dashboard/ExportModal.tsx | 203 - .../LookUpPaymentRecordTable.tsx | 11 +- .../src/components/grievances/PaymentIds.tsx | 4 +- .../payments/CashPlanDetailsSection.tsx | 4 +- .../components/payments/ForceFailedButton.tsx | 89 - .../payments/PaymentRecordDetails.tsx | 223 - .../payments/RevertForceFailedButton.tsx | 133 - .../VerificationPaymentRecordDetails.tsx | 179 - .../payments/VerificationPlanActions.tsx | 3 +- .../payments/VerificationPlanDetails.tsx | 3 +- .../payments/VerificationPlansSummary.tsx | 4 +- .../pages/dashboard/DashboardPage.tsx | 8 - .../pages/payments/CashPlanDetailsPage.tsx | 115 - .../CashPlanVerificationDetailsPage.tsx | 252 - .../CashplanVerificationRedirectPage.tsx | 27 - .../payments/PaymentRecordDetailsPage.tsx | 142 - .../VerificationPaymentRecordDetailsPage.tsx | 105 - .../routers/PaymentVerificationRoutes.tsx | 20 - .../routers/SelectedProgramRoutesSwitch.tsx | 5 - .../CashPlanTable/CashPlanTable.test.tsx | 37 - .../payments/CashPlanTable/CashPlanTable.tsx | 45 - .../CashPlanTable/CashPlanTableHeadCells.tsx | 53 - .../CashPlanTable/CashPlanTableRow.tsx | 88 - .../__snapshots__/CashPlanTable.test.tsx.snap | 1068 ---- .../tables/payments/CashPlanTable/index.ts | 3 - .../PaymentRecordTable.test.tsx | 31 - .../PaymentRecordTable/PaymentRecordTable.tsx | 41 - .../PaymentRecordTableHeadCells.tsx | 59 - .../PaymentRecordTableRow.tsx | 80 - .../PaymentRecordTable.test.tsx.snap | 923 ---- .../payments/PaymentRecordTable/index.ts | 3 - .../PeopleVerificationRecordsTableRow.tsx | 2 +- .../VerificationRecordsTableRow.tsx | 2 +- .../src/hooks/usePaymentRefetchQueries.ts | 5 +- src/frontend/src/utils/utils.ts | 14 +- .../apps/core/exchange_rates/utils.py | 17 - src/hct_mis_api/apps/core/hope_redirect.py | 171 - .../management/commands/fixexchangerates.py | 27 - .../management/commands/generatefixtures.py | 28 +- .../apps/core/management/commands/initdemo.py | 2 - src/hct_mis_api/apps/core/querysets.py | 70 - src/hct_mis_api/apps/core/utils.py | 4 +- src/hct_mis_api/apps/core/views.py | 11 - src/hct_mis_api/apps/dashboard/services.py | 4 +- src/hct_mis_api/apps/grievance/filters.py | 8 +- src/hct_mis_api/apps/grievance/fixtures.py | 10 +- src/hct_mis_api/apps/grievance/inputs.py | 4 +- .../grievance/migrations/0004_migration.py | 62 + src/hct_mis_api/apps/grievance/models.py | 22 +- src/hct_mis_api/apps/grievance/schema.py | 8 +- .../services/payment_verification_services.py | 4 +- ...ticket_based_on_payment_record_services.py | 16 +- .../apps/household/admin/household.py | 2 +- .../apps/household/fixtures/data-cypress.json | 16 +- .../apps/household/fixtures/data.json | 9 - .../commands/detect_paid_households.py | 6 +- .../household/migrations/0003_migration.py | 23 + src/hct_mis_api/apps/household/models.py | 29 +- src/hct_mis_api/apps/household/serializers.py | 8 +- ...sehold_programs_with_delivered_quantity.py | 14 +- src/hct_mis_api/apps/payment/admin.py | 63 +- .../apps/payment/api/serializers.py | 4 +- src/hct_mis_api/apps/payment/api/views.py | 8 +- src/hct_mis_api/apps/payment/celery_tasks.py | 66 +- src/hct_mis_api/apps/payment/filters.py | 147 +- src/hct_mis_api/apps/payment/fixtures.py | 420 +- src/hct_mis_api/apps/payment/forms.py | 38 +- .../commands/fix_payment_records.py | 18 - .../apps/payment/migrations/0002_migration.py | 36 + .../apps/payment/migrations/0003_migration.py | 118 + src/hct_mis_api/apps/payment/models.py | 378 +- src/hct_mis_api/apps/payment/mutations.py | 98 +- src/hct_mis_api/apps/payment/schema.py | 211 +- .../create_cash_plan_from_reconciliation.py | 212 - .../services/create_payment_verifications.py | 2 +- .../payment/services/dashboard_service.py | 19 +- .../handle_total_cash_in_households.py | 21 +- .../apps/payment/services/mark_as_failed.py | 4 +- .../payment/services/payment_plan_services.py | 8 +- .../apps/payment/services/sampling.py | 16 +- .../verification_plan_crud_services.py | 18 +- ...erification_plan_status_change_services.py | 12 +- .../tasks/CheckRapidProVerificationTask.py | 10 +- src/hct_mis_api/apps/payment/utils.py | 34 +- ...lsx_payment_plan_export_per_fsp_service.py | 4 +- ...lsx_payment_plan_per_fsp_import_service.py | 4 +- .../xlsx/xlsx_verification_export_service.py | 24 +- .../xlsx/xlsx_verification_import_service.py | 8 +- src/hct_mis_api/apps/program/fixtures.py | 2 +- src/hct_mis_api/apps/program/models.py | 6 +- src/hct_mis_api/apps/program/schema.py | 101 +- .../apps/registration_data/admin.py | 6 +- .../apps/reporting/celery_tasks.py | 19 - src/hct_mis_api/apps/reporting/mutations.py | 46 +- src/hct_mis_api/apps/reporting/schema.py | 3 +- .../generate_dashboard_report_service.py | 1071 ---- .../services/generate_report_service.py | 18 +- src/hct_mis_api/apps/targeting/models.py | 2 +- src/hct_mis_api/apps/utils/models.py | 7 + src/hct_mis_api/migrations_script/main.py | 8 +- .../add_tickets_to_missing_rdis.py | 479 -- .../create_payment_snapshot.py | 2 +- .../migrate_cash_assist_models.py | 287 ++ .../one_time_scripts/migrate_data_for_sync.py | 912 ---- .../migrate_everything_to_representations.py | 34 - .../migrate_files_to_representations.py | 118 - .../migrate_grievance_for_sync.py | 2070 -------- .../migrate_grievance_to_representations.py | 2129 -------- ...g_representations_with_migrated_at_data.py | 46 - .../one_time_scripts/sync_representations.py | 1185 ----- src/hct_mis_api/urls.py | 2 - tests/selenium/filters/test_filters.py | 72 +- .../test_grievance_tickets.py | 32 +- .../test_managerial_console.py | 17 +- .../payment_module/test_payment_plans.py | 6 +- .../test_payment_verification.py | 58 +- tests/selenium/people/test_people.py | 32 +- .../test_people_periodic_data_update.py | 31 +- .../program_details/test_program_details.py | 4 +- tests/unit/apps/core/test_exchange_rates.py | 74 - tests/unit/apps/core/test_hope_redirect.py | 197 - tests/unit/apps/dashboard/test_services.py | 2 +- ..._test_grievance_create_sensitive_ticket.py | 4 +- .../test_filter_already_existing_tickets.py | 20 +- .../test_grievance_create_complaint_ticket.py | 38 +- .../test_grievance_create_sensitive_ticket.py | 56 +- ...ance_update_payment_verification_ticket.py | 38 +- .../apps/household/test_dashboard_queries.py | 29 +- .../test_detecting_paid_hhs_loaded_via_sf.py | 10 +- .../test_filter_individuals_by_program.py | 6 +- .../apps/household/test_household_admin.py | 4 +- ...st_household_delivered_quantities_query.py | 17 +- .../test_household_status_endpoint.py | 8 +- .../services/test_dashboard_service.py | 24 +- ...st_create_payment_verification_mutation.py | 2 +- .../snap_test_delete_verification_mutation.py | 2 +- ...snap_test_discard_verification_mutation.py | 2 +- .../test_action_payment_plan_mutation.py | 6 +- .../payment/test_all_payment_plan_queries.py | 15 +- .../apps/payment/test_all_payment_records.py | 102 - .../unit/apps/payment/test_build_snapshot.py | 4 - tests/unit/apps/payment/test_build_summary.py | 30 +- ...chart_total_transferred_cash_by_country.py | 18 +- ...st_create_cash_plan_from_reconciliation.py | 67 - ...st_create_payment_verification_mutation.py | 31 +- .../apps/payment/test_dashboard_queries.py | 45 +- .../test_delete_verification_mutation.py | 14 +- .../test_discard_verification_mutation.py | 33 +- .../apps/payment/test_exclude_households.py | 5 +- .../test_export_xlsx_verification_mutation.py | 9 +- .../payment/test_finish_verification_plan.py | 37 +- tests/unit/apps/payment/test_fixtures.py | 2 - .../apps/payment/test_fsp_in_payment_plan.py | 12 +- ...test_fsp_xlsx_template_get_column_value.py | 8 +- ...import_export_payment_plan_payment_list.py | 10 +- .../apps/payment/test_import_verifications.py | 74 +- ...test_invalid_xlsx_verification_mutation.py | 9 +- tests/unit/apps/payment/test_models.py | 8 +- .../payment/test_payment_gateway_service.py | 5 - .../apps/payment/test_payment_notification.py | 4 +- .../test_payment_plan_pdf_export_service.py | 3 +- .../test_payment_plan_reconciliation.py | 12 +- .../payment/test_payment_plan_services.py | 31 +- .../apps/payment/test_payment_plan_views.py | 8 +- .../test_payment_token_and_order_numbers.py | 2 +- .../test_payment_verification_mutations.py | 35 +- .../test_rapid_pro_verification_task.py | 68 +- tests/unit/apps/payment/test_sample_size.py | 29 +- ...erification_plan_status_change_services.py | 61 +- .../apps/program/test_all_programs_query.py | 2 +- .../apps/program/test_cash_plan_queries.py | 132 - .../apps/program/test_dashboard_queries.py | 51 +- tests/unit/apps/program/test_program_cycle.py | 8 +- .../program/test_program_cycle_rest_api.py | 2 +- .../unit/apps/program/test_update_program.py | 1 + tests/unit/apps/program/test_validators.py | 2 +- .../test_generate_dashboard_report_service.py | 116 - .../apps/reporting/test_report_service.py | 64 +- .../apps/reporting/test_reporting_choices.py | 11 +- tests/unit/fixtures/dashboard.py | 16 +- .../one_time_scripts/test_add_pdu_fields.py | 2 +- .../test_add_tickets_to_missing_rdis.py | 315 -- .../test_create_payment_snapshot.py | 5 - .../test_mass_withdraw_sudan_hhs.py | 2 +- .../test_migrate_data_to_representations.py | 81 +- ...ate_data_to_representations_performance.py | 44 +- ...st_migrate_data_to_representations_unit.py | 60 +- ...st_migrate_grievance_to_representations.py | 4438 ----------------- .../test_sync_representations.py | 739 --- 213 files changed, 1893 insertions(+), 24717 deletions(-) delete mode 100644 src/frontend/fixtures/payments/fakeApolloAllCashPlans.ts delete mode 100644 src/frontend/fixtures/payments/fakeApolloAllPaymentRecords.ts delete mode 100644 src/frontend/fixtures/payments/fakeCashPlan.ts delete mode 100644 src/frontend/src/apollo/fragments/PaymentRecordFragments.ts delete mode 100644 src/frontend/src/apollo/mutations/payments/MarkPaymentRecordAsFailed.ts delete mode 100644 src/frontend/src/apollo/mutations/payments/RevertMarkPaymentRecordAsFailed.ts delete mode 100644 src/frontend/src/apollo/mutations/reporting/CreateDashboardReport.ts delete mode 100644 src/frontend/src/apollo/queries/payments/AllCashPlans.ts delete mode 100644 src/frontend/src/apollo/queries/payments/AllPaymentRecords.ts delete mode 100644 src/frontend/src/apollo/queries/payments/CashPlan.ts delete mode 100644 src/frontend/src/apollo/queries/payments/LookUpPaymentRecords.ts delete mode 100644 src/frontend/src/apollo/queries/payments/PaymentRecord.ts delete mode 100644 src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.test.tsx delete mode 100644 src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.tsx delete mode 100644 src/frontend/src/components/core/CashPlanDetails/__snapshots__/CashPlanDetails.test.tsx.snap delete mode 100644 src/frontend/src/components/core/CashPlanDetails/index.ts delete mode 100644 src/frontend/src/components/dashboard/ExportModal.tsx delete mode 100644 src/frontend/src/components/payments/ForceFailedButton.tsx delete mode 100644 src/frontend/src/components/payments/PaymentRecordDetails.tsx delete mode 100644 src/frontend/src/components/payments/RevertForceFailedButton.tsx delete mode 100644 src/frontend/src/components/payments/VerificationPaymentRecordDetails.tsx delete mode 100644 src/frontend/src/containers/pages/payments/CashPlanDetailsPage.tsx delete mode 100644 src/frontend/src/containers/pages/payments/CashPlanVerificationDetailsPage.tsx delete mode 100644 src/frontend/src/containers/pages/payments/CashplanVerificationRedirectPage.tsx delete mode 100644 src/frontend/src/containers/pages/payments/PaymentRecordDetailsPage.tsx delete mode 100644 src/frontend/src/containers/pages/payments/VerificationPaymentRecordDetailsPage.tsx delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.test.tsx delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.tsx delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableHeadCells.tsx delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableRow.tsx delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/__snapshots__/CashPlanTable.test.tsx.snap delete mode 100644 src/frontend/src/containers/tables/payments/CashPlanTable/index.ts delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.test.tsx delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.tsx delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableHeadCells.tsx delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableRow.tsx delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/__snapshots__/PaymentRecordTable.test.tsx.snap delete mode 100644 src/frontend/src/containers/tables/payments/PaymentRecordTable/index.ts delete mode 100644 src/hct_mis_api/apps/core/hope_redirect.py delete mode 100644 src/hct_mis_api/apps/core/management/commands/fixexchangerates.py delete mode 100644 src/hct_mis_api/apps/core/querysets.py create mode 100644 src/hct_mis_api/apps/grievance/migrations/0004_migration.py create mode 100644 src/hct_mis_api/apps/household/migrations/0003_migration.py delete mode 100644 src/hct_mis_api/apps/payment/management/commands/fix_payment_records.py create mode 100644 src/hct_mis_api/apps/payment/migrations/0002_migration.py create mode 100644 src/hct_mis_api/apps/payment/migrations/0003_migration.py delete mode 100644 src/hct_mis_api/apps/payment/services/create_cash_plan_from_reconciliation.py delete mode 100644 src/hct_mis_api/apps/reporting/services/generate_dashboard_report_service.py delete mode 100644 src/hct_mis_api/one_time_scripts/add_tickets_to_missing_rdis.py create mode 100644 src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py delete mode 100644 src/hct_mis_api/one_time_scripts/migrate_data_for_sync.py delete mode 100644 src/hct_mis_api/one_time_scripts/migrate_everything_to_representations.py delete mode 100644 src/hct_mis_api/one_time_scripts/migrate_files_to_representations.py delete mode 100644 src/hct_mis_api/one_time_scripts/migrate_grievance_for_sync.py delete mode 100644 src/hct_mis_api/one_time_scripts/migrate_grievance_to_representations.py delete mode 100644 src/hct_mis_api/one_time_scripts/populate_existing_representations_with_migrated_at_data.py delete mode 100644 src/hct_mis_api/one_time_scripts/sync_representations.py delete mode 100644 tests/unit/apps/core/test_hope_redirect.py delete mode 100644 tests/unit/apps/payment/test_all_payment_records.py delete mode 100644 tests/unit/apps/payment/test_create_cash_plan_from_reconciliation.py delete mode 100644 tests/unit/apps/program/test_cash_plan_queries.py delete mode 100644 tests/unit/one_time_scripts/test_add_tickets_to_missing_rdis.py delete mode 100644 tests/unit/one_time_scripts/test_migrate_grievance_to_representations.py delete mode 100644 tests/unit/one_time_scripts/test_sync_representations.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9bae728b6..8f46939943 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,8 +264,7 @@ jobs: -f ./.github/helpers/docker-compose.selenium.yml \ run backend bash -c " waitforit -host=db -port=5432 -timeout=30 - pytest -svvv -n 2 ./tests/selenium --cov-report xml:test-coverage/coverage.xml --html-report=./tests/selenium/output_data/report/report.html --randomly-seed=42 - " + pytest -svvv -x -n 2 ./tests/selenium --cov-report xml:test-coverage/coverage.xml --html-report=./tests/selenium/output_data/report/report.html --randomly-seed=42 " - name: Upload Artifact uses: actions/upload-artifact@v4 if: always() diff --git a/src/frontend/data/schema.graphql b/src/frontend/data/schema.graphql index d671af694b..1bbee4a653 100644 --- a/src/frontend/data/schema.graphql +++ b/src/frontend/data/schema.graphql @@ -353,10 +353,7 @@ type BusinessAreaNode implements Node { ruleSet(offset: Int, before: String, after: String, first: Int, last: Int): SteficonRuleNodeConnection! paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! - serviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): ServiceProviderNodeConnection! tickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! programSet(offset: Int, before: String, after: String, first: Int, last: Int, name: String): ProgramNodeConnection! @@ -406,75 +403,6 @@ type CashPlanAndPaymentPlanNode { serviceProviderFullName: String } -type CashPlanNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - version: BigInt! - businessArea: UserBusinessAreaNode! - statusDate: DateTime! - startDate: DateTime - endDate: DateTime - program: ProgramNode! - exchangeRate: Float - totalEntitledQuantity: Float - totalEntitledQuantityUsd: Float - totalEntitledQuantityRevised: Float - totalEntitledQuantityRevisedUsd: Float - totalDeliveredQuantity: Float - totalDeliveredQuantityUsd: Float - totalUndeliveredQuantity: Float - totalUndeliveredQuantityUsd: Float - name: String! - caId: String - caHashId: UUID - status: CashPlanStatus! - distributionLevel: String! - dispersionDate: DateTime! - coverageDuration: Int! - coverageUnit: String! - comments: String - deliveryType: String - assistanceMeasurement: String! - assistanceThrough: String! - serviceProvider: ServiceProviderNode - visionId: String - fundsCommitment: String - downPayment: String - validationAlertsCount: Int! - totalPersonsCovered: Int! - totalPersonsCoveredRevised: Int! - paymentItems(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! - bankReconciliationSuccess: Int - bankReconciliationError: Int - totalNumberOfHouseholds: Int - currency: String - canCreatePaymentVerificationPlan: Boolean - availablePaymentRecordsCount: Int - verificationPlans(offset: Int, before: String, after: String, first: Int, last: Int, programId: String): PaymentVerificationPlanNodeConnection - paymentVerificationSummary: PaymentVerificationSummaryNode - unicefId: String -} - -type CashPlanNodeConnection { - pageInfo: PageInfo! - edges: [CashPlanNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type CashPlanNodeEdge { - node: CashPlanNode - cursor: String! -} - -enum CashPlanStatus { - DISTRIBUTION_COMPLETED - DISTRIBUTION_COMPLETED_WITH_ERRORS - TRANSACTION_COMPLETED - TRANSACTION_COMPLETED_WITH_ERRORS -} - input CategoryExtrasInput { sensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras grievanceComplaintTicketExtras: GrievanceComplaintTicketExtras @@ -671,18 +599,6 @@ type CreateCommunicationMessageMutation { message: CommunicationMessageNode } -type CreateDashboardReport { - success: Boolean -} - -input CreateDashboardReportInput { - reportTypes: [String]! - businessAreaSlug: String! - year: Int! - adminArea: ID - program: ID -} - input CreateFeedbackInput { issueType: String! householdLookup: ID @@ -1009,7 +925,6 @@ type DeliveryMechanismNode implements Node { transferType: DeliveryMechanismTransferType! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! deliverymechanismperpaymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismPerPaymentPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! deliverymechanismdataSet(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismDataNodeConnection! } @@ -1319,11 +1234,11 @@ type FinancialServiceProviderNode implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! + internalData: JSONString! allowedBusinessAreas(offset: Int, before: String, after: String, first: Int, last: Int, id: UUID): UserBusinessAreaNodeConnection! createdBy: UserNode name: String! visionVendorNumber: String! - deliveryMechanismsChoices: [String!] deliveryMechanisms(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismNodeConnection! distributionLimit: Float communicationChannel: FinancialServiceProviderCommunicationChannel! @@ -1805,6 +1720,7 @@ type HouseholdNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! withdrawn: Boolean! withdrawnDate: DateTime consentSign: String! @@ -1868,7 +1784,6 @@ type HouseholdNode implements Node { collectIndividualData: HouseholdCollectIndividualData! currency: String unhcrId: String! - userFields: JSONString! detailId: String registrationId: String programRegistrationId: String @@ -1890,7 +1805,6 @@ type HouseholdNode implements Node { copiedTo(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection! individualsAndRoles: [IndividualRoleInHouseholdNode!]! individuals(offset: Int, before: String, after: String, first: Int, last: Int, household_Id: UUID, businessArea: String, fullName: String, fullName_Startswith: String, fullName_Endswith: String, sex: [String], household_AdminArea: ID, withdrawn: Boolean, program: ID, age: String, programs: [ID], search: String, documentType: String, documentNumber: String, lastRegistrationDate: String, admin1: [ID], admin2: [ID], status: [String], excludedId: String, flags: [String], isActiveProgram: Boolean, orderBy: String): IndividualNodeConnection - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! complaintTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection! sensitiveTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection! @@ -2126,6 +2040,7 @@ type ImportedHouseholdNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! withdrawn: Boolean! withdrawnDate: DateTime consentSign: String! @@ -2187,7 +2102,6 @@ type ImportedHouseholdNode implements Node { collectIndividualData: HouseholdCollectIndividualData! currency: HouseholdCurrency! unhcrId: String! - userFields: JSONString! detailId: String registrationId: String programRegistrationId: String @@ -2261,6 +2175,7 @@ type ImportedIndividualNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! duplicate: Boolean! duplicateDate: DateTime withdrawn: Boolean! @@ -2288,7 +2203,6 @@ type ImportedIndividualNode implements Node { firstRegistrationDate: Date! lastRegistrationDate: Date! flexFields: FlexFieldsScalar - userFields: JSONString! enrolledInNutritionProgramme: Boolean administrationOfRutf: Boolean deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus! @@ -2448,6 +2362,7 @@ type IndividualNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! duplicate: Boolean! duplicateDate: DateTime withdrawn: Boolean! @@ -2475,7 +2390,6 @@ type IndividualNode implements Node { firstRegistrationDate: Date! lastRegistrationDate: Date! flexFields: FlexFieldsScalar - userFields: JSONString! enrolledInNutritionProgramme: Boolean administrationOfRutf: Boolean deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus! @@ -2522,9 +2436,8 @@ type IndividualNode implements Node { householdsAndRoles: [IndividualRoleInHouseholdNode!]! copiedTo(offset: Int, before: String, after: String, first: Int, last: Int): IndividualNodeConnection! bankAccountInfo: BankAccountInfoNode - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! - collectorPayments(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + collectorPayments(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! deliveryMechanismsData: [DeliveryMechanismDataNode] complaintTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection! sensitiveTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection! @@ -2798,10 +2711,6 @@ type MarkPaymentAsFailedMutation { payment: PaymentNode } -type MarkPaymentRecordAsFailedMutation { - paymentRecord: PaymentRecordNode -} - type MergeRegistrationDataImportMutation { registrationDataImport: RegistrationDataImportNode } @@ -2820,7 +2729,6 @@ type Mutations { exportSurveySample(surveyId: ID!): ExportSurveySampleMutationMutation createReport(reportData: CreateReportInput!): CreateReport restartCreateReport(reportData: RestartCreateReportInput!): RestartCreateReport - createDashboardReport(reportData: CreateDashboardReportInput!): CreateDashboardReport createGrievanceTicket(input: CreateGrievanceTicketInput!): CreateGrievanceTicketMutation updateGrievanceTicket(input: UpdateGrievanceTicketInput!, version: BigInt): UpdateGrievanceTicketMutation grievanceStatusChange(grievanceTicketId: ID, status: Int, version: BigInt): GrievanceStatusChangeMutation @@ -2848,8 +2756,6 @@ type Mutations { invalidPaymentVerificationPlan(paymentVerificationPlanId: ID!, version: BigInt): InvalidPaymentVerificationPlan deletePaymentVerificationPlan(paymentVerificationPlanId: ID!, version: BigInt): DeletePaymentVerificationPlan updatePaymentVerificationStatusAndReceivedAmount(paymentVerificationId: ID!, receivedAmount: Decimal!, status: PaymentVerificationStatusForUpdate, version: BigInt): UpdatePaymentVerificationStatusAndReceivedAmount - markPaymentRecordAsFailed(paymentRecordId: ID!): MarkPaymentRecordAsFailedMutation - revertMarkPaymentRecordAsFailed(deliveredQuantity: Decimal!, deliveryDate: Date!, paymentRecordId: ID!): RevertMarkPaymentRecordAsFailedMutation markPaymentAsFailed(paymentId: ID!): MarkPaymentAsFailedMutation revertMarkPaymentAsFailed(deliveredQuantity: Decimal!, deliveryDate: Date!, paymentId: ID!): RevertMarkPaymentAsFailedMutation updatePaymentVerificationReceivedAndReceivedAmount(paymentVerificationId: ID!, received: Boolean!, receivedAmount: Decimal!, version: BigInt): UpdatePaymentVerificationReceivedAndReceivedAmount @@ -3003,23 +2909,6 @@ type PaymentConflictDataNode { paymentUnicefId: String } -enum PaymentDeliveryTypeChoice { - CARDLESS_CASH_WITHDRAWAL - CASH - CASH_BY_FSP - CHEQUE - DEPOSIT_TO_CARD - MOBILE_MONEY - PRE_PAID_CARD - REFERRAL - TRANSFER - TRANSFER_TO_ACCOUNT - VOUCHER - ATM_CARD - CASH_OVER_THE_COUNTER - TRANSFER_TO_DIGITAL_WALLET -} - type PaymentDetailsApproveMutation { grievanceTicket: GrievanceTicketNode } @@ -3040,12 +2929,12 @@ type PaymentNode implements Node { updatedAt: DateTime! unicefId: String signatureHash: String! + internalData: JSONString! businessArea: UserBusinessAreaNode! status: PaymentStatus! statusDate: DateTime! household: HouseholdNode! headOfHousehold: IndividualNode - deliveryTypeChoice: PaymentDeliveryTypeChoice deliveryType: DeliveryMechanismNode currency: String! entitlementQuantity: Float @@ -3071,8 +2960,12 @@ type PaymentNode implements Node { additionalDocumentType: String additionalDocumentNumber: String fspAuthCode: String + isCashAssist: Boolean! followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + paymentVerification: PaymentVerificationNode householdSnapshot: PaymentHouseholdSnapshotNode + ticketComplaintDetails: TicketComplaintDetailsNode + ticketSensitiveDetails: TicketSensitiveDetailsNode adminUrl: String paymentPlanHardConflicted: Boolean paymentPlanHardConflictedData: [PaymentConflictDataNode] @@ -3119,172 +3012,6 @@ enum PaymentPlanBackgroundActionStatus { SEND_TO_PAYMENT_GATEWAY_ERROR } -enum PaymentPlanCurrency { - A_ - AED - AFN - ALL - AMD - ANG - AOA - ARS - AUD - AWG - AZN - BAM - BBD - BDT - BGN - BHD - BIF - BMD - BND - BOB - BOV - BRL - BSD - BTN - BWP - BYN - BZD - CAD - CDF - CHF - CLP - CNY - COP - CRC - CUC - CUP - CVE - CZK - DJF - DKK - DOP - DZD - EGP - ERN - ETB - EUR - FJD - FKP - GBP - GEL - GHS - GIP - GMD - GNF - GTQ - GYD - HKD - HNL - HRK - HTG - HUF - IDR - ILS - INR - IQD - IRR - ISK - JMD - JOD - JPY - KES - KGS - KHR - KMF - KPW - KRW - KWD - KYD - KZT - LAK - LBP - LKR - LRD - LSL - LYD - MAD - MDL - MGA - MKD - MMK - MNT - MOP - MRU - MUR - MVR - MWK - MXN - MYR - MZN - NAD - NGN - NIO - NOK - NPR - NZD - OMR - PAB - PEN - PGK - PHP - PKR - PLN - PYG - QAR - RON - RSD - RUB - RWF - SAR - SBD - SCR - SDG - SEK - SGD - SHP - SLL - SOS - SRD - SSP - STN - SVC - SYP - SZL - THB - TJS - TMT - TND - TOP - TRY - TTD - TWD - TZS - UAH - UGX - USD - UYU - UYW - UZS - VES - VND - VUV - WST - XAF - XAG - XAU - XCD - XOF - XPF - YER - ZAR - ZMW - ZWL - USDC -} - type PaymentPlanNode implements Node { isRemoved: Boolean! id: ID! @@ -3292,11 +3019,11 @@ type PaymentPlanNode implements Node { updatedAt: DateTime! version: BigInt! unicefId: String + internalData: JSONString! businessArea: UserBusinessAreaNode! statusDate: DateTime! startDate: Date endDate: Date - program: ProgramNode! exchangeRate: Float totalEntitledQuantity: Float totalEntitledQuantityUsd: Float @@ -3306,12 +3033,12 @@ type PaymentPlanNode implements Node { totalDeliveredQuantityUsd: Float totalUndeliveredQuantity: Float totalUndeliveredQuantityUsd: Float - programCycle: ProgramCycleNode + programCycle: ProgramCycleNode! createdBy: UserNode! status: PaymentPlanStatus! backgroundActionStatus: PaymentPlanBackgroundActionStatus targetPopulation: TargetPopulationNode! - currency: PaymentPlanCurrency! + currency: String dispersionStartDate: Date dispersionEndDate: Date femaleChildrenCount: Int! @@ -3328,9 +3055,12 @@ type PaymentPlanNode implements Node { exclusionReason: String! excludeHouseholdError: String! name: String + isCashAssist: Boolean! followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! deliveryMechanisms: [DeliveryMechanismPerPaymentPlanNode] paymentItems(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + paymentVerificationPlans(offset: Int, before: String, after: String, first: Int, last: Int): PaymentVerificationPlanNodeConnection! + paymentVerificationSummary: PaymentVerificationSummaryNode approvalProcess(offset: Int, before: String, after: String, first: Int, last: Int): ApprovalProcessNodeConnection! documents(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanSupportingDocumentNodeConnection! adminUrl: String @@ -3342,7 +3072,6 @@ type PaymentPlanNode implements Node { volumeByDeliveryMechanism: [VolumeByDeliveryMechanismNode] splitChoices: [ChoiceObject] verificationPlans(offset: Int, before: String, after: String, first: Int, last: Int, programId: String): PaymentVerificationPlanNodeConnection - paymentVerificationSummary: PaymentVerificationSummaryNode bankReconciliationSuccess: Int bankReconciliationError: Int canCreatePaymentVerificationPlan: Boolean @@ -3356,6 +3085,7 @@ type PaymentPlanNode implements Node { canSendToPaymentGateway: Boolean canSplit: Boolean supportingDocuments: [PaymentPlanSupportingDocumentNode] + program: ProgramNode } type PaymentPlanNodeConnection { @@ -3416,92 +3146,6 @@ type PaymentRecordAndPaymentNode { verification: PaymentVerificationNode } -enum PaymentRecordDeliveryTypeChoice { - CARDLESS_CASH_WITHDRAWAL - CASH - CASH_BY_FSP - CHEQUE - DEPOSIT_TO_CARD - MOBILE_MONEY - PRE_PAID_CARD - REFERRAL - TRANSFER - TRANSFER_TO_ACCOUNT - VOUCHER - ATM_CARD - CASH_OVER_THE_COUNTER - TRANSFER_TO_DIGITAL_WALLET -} - -enum PaymentRecordEntitlementCardStatus { - ACTIVE - INACTIVE -} - -type PaymentRecordNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - version: BigInt! - businessArea: UserBusinessAreaNode! - status: PaymentRecordStatus! - statusDate: DateTime! - household: HouseholdNode! - headOfHousehold: IndividualNode - deliveryTypeChoice: PaymentRecordDeliveryTypeChoice - deliveryType: DeliveryMechanismNode - currency: String! - entitlementQuantity: Float - entitlementQuantityUsd: Float - deliveredQuantity: Float - deliveredQuantityUsd: Float - deliveryDate: DateTime - transactionReferenceId: String - transactionStatusBlockchainLink: String - caId: String - caHashId: UUID - parent: CashPlanNode - fullName: String! - totalPersonsCovered: Int! - distributionModality: String! - targetPopulation: TargetPopulationNode! - targetPopulationCashAssistId: String! - entitlementCardNumber: String - entitlementCardStatus: PaymentRecordEntitlementCardStatus - entitlementCardIssueDate: Date - visionId: String - registrationCaId: String - serviceProvider: ServiceProviderNode! - adminUrl: String - verification: PaymentVerificationNode - unicefId: String -} - -type PaymentRecordNodeConnection { - pageInfo: PageInfo! - edges: [PaymentRecordNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type PaymentRecordNodeEdge { - node: PaymentRecordNode - cursor: String! -} - -enum PaymentRecordStatus { - DISTRIBUTION_SUCCESSFUL - NOT_DISTRIBUTED - TRANSACTION_SUCCESSFUL - TRANSACTION_ERRONEOUS - FORCE_FAILED - PARTIALLY_DISTRIBUTED - PENDING - SENT_TO_PAYMENT_GATEWAY - SENT_TO_FSP - MANUALLY_CANCELLED -} - type PaymentRecordsAndPaymentsEdges { cursor: String node: PaymentRecordAndPaymentNode @@ -3553,8 +3197,9 @@ type PaymentVerificationNode implements Node { updatedAt: DateTime! version: BigInt! paymentVerificationPlan: PaymentVerificationPlanNode! - paymentContentType: ContentTypeObjectType! - paymentObjectId: UUID! + paymentContentType: ContentTypeObjectType + paymentObjectId: UUID + payment: GenericPaymentNode status: PaymentVerificationStatus! statusDate: DateTime receivedAmount: Float @@ -3563,7 +3208,6 @@ type PaymentVerificationNode implements Node { ticketDetail(offset: Int, before: String, after: String, first: Int, last: Int): TicketPaymentVerificationDetailsNodeConnection! adminUrl: String isManuallyEditable: Boolean - payment: GenericPaymentNode } type PaymentVerificationNodeConnection { @@ -3585,8 +3229,9 @@ type PaymentVerificationPlanNode implements Node { version: BigInt! unicefId: String status: PaymentVerificationPlanStatus! - paymentPlanContentType: ContentTypeObjectType! - paymentPlanObjectId: UUID! + paymentPlanContentType: ContentTypeObjectType + paymentPlanObjectId: UUID + paymentPlan: PaymentPlanNode sampling: PaymentVerificationPlanSampling! verificationChannel: PaymentVerificationPlanVerificationChannel! sampleSize: Int @@ -3610,7 +3255,6 @@ type PaymentVerificationPlanNode implements Node { adminUrl: String xlsxFileWasDownloaded: Boolean hasXlsxFile: Boolean - paymentPlan: PaymentPlanNode } type PaymentVerificationPlanNodeConnection { @@ -3665,8 +3309,9 @@ type PaymentVerificationSummaryNode implements Node { status: PaymentVerificationSummaryStatus! activationDate: DateTime completionDate: DateTime - paymentPlanContentType: ContentTypeObjectType! - paymentPlanObjectId: UUID! + paymentPlan: PaymentPlanNode + paymentPlanContentType: ContentTypeObjectType + paymentPlanObjectId: UUID } type PaymentVerificationSummaryNodeConnection { @@ -3797,8 +3442,6 @@ type ProgramNode implements Node { householdSet(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection! individuals(offset: Int, before: String, after: String, first: Int, last: Int): IndividualNodeConnection! registrationImports(offset: Int, before: String, after: String, first: Int, last: Int): RegistrationDataImportNodeConnection! - paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! grievanceTickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! @@ -3914,8 +3557,6 @@ type Query { allSteficonRules(offset: Int, before: String, after: String, first: Int, last: Int, enabled: Boolean, deprecated: Boolean, type: String!): SteficonRuleNodeConnection payment(id: ID!): PaymentNode allPayments(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, paymentPlanId: String!, programId: String, orderBy: String): PaymentNodeConnection - paymentRecord(id: ID!): PaymentRecordNode - allPaymentRecords(offset: Int, before: String, after: String, first: Int, last: Int, parent: ID, household: ID, individual: String, businessArea: String, programId: String, orderBy: String): PaymentRecordNodeConnection allPaymentRecordsAndPayments(businessArea: String!, program: String, household: ID, orderBy: String, first: Int, last: Int, before: String, after: String): PaginatedPaymentRecordsAndPaymentsNode financialServiceProviderXlsxTemplate(id: ID!): FinancialServiceProviderXlsxTemplateNode allFinancialServiceProviderXlsxTemplates(offset: Int, before: String, after: String, first: Int, last: Int, name: String, createdBy: ID, orderBy: String): FinancialServiceProviderXlsxTemplateNodeConnection @@ -3968,8 +3609,6 @@ type Query { allPrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, name: String, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, compatibleDct: Boolean, orderBy: String): ProgramNodeConnection chartProgrammesBySector(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode chartTotalTransferredByMonth(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode - cashPlan(id: ID!): CashPlanNode - allCashPlans(offset: Int, before: String, after: String, first: Int, last: Int, program: ID, assistanceThrough: String, assistanceThrough_Startswith: String, serviceProvider_FullName: String, serviceProvider_FullName_Startswith: String, startDate: DateTime, startDate_Lte: DateTime, startDate_Gte: DateTime, endDate: DateTime, endDate_Lte: DateTime, endDate_Gte: DateTime, businessArea: String, search: String, deliveryType: [String], verificationStatus: [String], orderBy: String): CashPlanNodeConnection programStatusChoices: [ChoiceObject] programCycleStatusChoices: [ChoiceObject] programFrequencyOfPaymentsChoices: [ChoiceObject] @@ -4329,10 +3968,6 @@ type RevertMarkPaymentAsFailedMutation { payment: PaymentNode } -type RevertMarkPaymentRecordAsFailedMutation { - paymentRecord: PaymentRecordNode -} - type RoleChoiceObject { name: String value: String @@ -4565,32 +4200,6 @@ input SensitiveGrievanceTicketExtras { paymentRecord: [ID] } -type ServiceProviderNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - businessArea: UserBusinessAreaNode! - caId: String! - fullName: String - shortName: String - country: String! - visionId: String - cashPlans(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! -} - -type ServiceProviderNodeConnection { - pageInfo: PageInfo! - edges: [ServiceProviderNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type ServiceProviderNodeEdge { - node: ServiceProviderNode - cursor: String! -} - type SetSteficonRuleOnPaymentPlanPaymentListMutation { paymentPlan: PaymentPlanNode } @@ -4748,7 +4357,6 @@ type TargetPopulationNode implements Node { adultMaleCount: Int adultFemaleCount: Int paymentPlans(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! - paymentRecords(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! selections: [HouseholdSelectionNode!]! messages(offset: Int, before: String, after: String, first: Int, last: Int): CommunicationMessageNodeConnection! surveys(offset: Int, before: String, after: String, first: Int, last: Int): SurveyNodeConnection! @@ -4975,6 +4583,7 @@ type TicketComplaintDetailsNode implements Node { paymentObjectId: UUID household: HouseholdNode individual: IndividualNode + payment: PaymentNode paymentRecord: PaymentRecordAndPaymentNode } @@ -5247,6 +4856,7 @@ type TicketSensitiveDetailsNode implements Node { paymentObjectId: UUID household: HouseholdNode individual: IndividualNode + payment: PaymentNode paymentRecord: PaymentRecordAndPaymentNode } @@ -5478,10 +5088,7 @@ type UserBusinessAreaNode implements Node { ruleSet(offset: Int, before: String, after: String, first: Int, last: Int): SteficonRuleNodeConnection! paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! - serviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): ServiceProviderNodeConnection! tickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! programSet(offset: Int, before: String, after: String, first: Int, last: Int, name: String): ProgramNodeConnection! diff --git a/src/frontend/fixtures/grievances/fakeGrievanceTicket.ts b/src/frontend/fixtures/grievances/fakeGrievanceTicket.ts index 42ccf81977..ff598955bb 100644 --- a/src/frontend/fixtures/grievances/fakeGrievanceTicket.ts +++ b/src/frontend/fixtures/grievances/fakeGrievanceTicket.ts @@ -502,191 +502,6 @@ export const fakeGrievanceTicket = { }, __typename: 'RegistrationDataImportNode', }, - paymentrecordSet: { - edges: [ - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6ZGViY2E5YWQtNzBhNS00MDk2LTkxYjctMmU3MGRkZjRhYmMy', - fullName: 'Brian Morgan', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjI1ZTNkODA0LTAzMzEtNDhkOC1iYTk2LWVmZjEzYmU3ZDdiYQ==', - totalPersonsCovered: 2, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 88608141.04, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6ODZhZmQ4NjQtYmNlNS00N2Q0LWE5YmEtYzlkZTVjZGYwMDJm', - fullName: 'Jennifer Weber MD', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjI1ZTNkODA0LTAzMzEtNDhkOC1iYTk2LWVmZjEzYmU3ZDdiYQ==', - totalPersonsCovered: 2, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 88608141.04, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6ZDJiMTAzNjUtMDBlMy00ZjMyLTg2MTUtN2UyMDUxM2YyZmQ1', - fullName: 'Jason Jacobs', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOmUwZGUxMGMyLTMxNWUtNDhjYS1hNDU5LWM2NTQyZDc1MmJlNw==', - totalPersonsCovered: 3, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 2058088.16, - assistanceMeasurement: 'Nigerian naira', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6NGM4ZGYyYjQtNTI5Ni00YmJhLTgzOTQtNGNkMGI0M2MyZjEy', - fullName: 'Micheal Massey', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOmUwZGUxMGMyLTMxNWUtNDhjYS1hNDU5LWM2NTQyZDc1MmJlNw==', - totalPersonsCovered: 3, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 2058088.16, - assistanceMeasurement: 'Nigerian naira', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6YzZlYzMwMDUtZWUzZC00MjI3LWI2YzctM2MxZDcxNzQwYTA4', - fullName: 'Stephen Smith', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjkyZDc0NTRiLWVlNWEtNDM3Yy1hNTJiLWVmZjI0NGQyZjYyZA==', - totalPersonsCovered: 4, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 17600499.7, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6OThjMzVmNzEtOWY1Ni00NjMwLWJjNWItOWFlODkxNmU0OThh', - fullName: 'Jessica Thornton', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjkyZDc0NTRiLWVlNWEtNDM3Yy1hNTJiLWVmZjI0NGQyZjYyZA==', - totalPersonsCovered: 4, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 17600499.7, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6MDVkNDkyNjctMjhhNy00ZDU5LTllOTgtYmRjMjJjNGRlNzg3', - fullName: 'Bethany Rodriguez', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjkyZDc0NTRiLWVlNWEtNDM3Yy1hNTJiLWVmZjI0NGQyZjYyZA==', - totalPersonsCovered: 4, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 17600499.7, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6MjEwMWVmNmUtODZjYi00MDI2LWI1MmUtMzdjMmQyNWQzZmE0', - fullName: 'Melanie Haley MD', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjkyZDc0NTRiLWVlNWEtNDM3Yy1hNTJiLWVmZjI0NGQyZjYyZA==', - totalPersonsCovered: 4, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 17600499.7, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: 'UGF5bWVudFJlY29yZE5vZGU6NWRhNGFjZjYtYjc5My00ZThkLWJlYzktMDRiMTI4ZTJkOGNi', - fullName: 'Greg Cohen', - parent: { - id: 'Q2FzaFBsYW5Ob2RlOjkyZDc0NTRiLWVlNWEtNDM3Yy1hNTJiLWVmZjI0NGQyZjYyZA==', - totalPersonsCovered: 4, - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 17600499.7, - assistanceMeasurement: 'Vietnamese đồng', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - ], - __typename: 'PaymentRecordNodeConnection', - }, }, paymentRecord: null, relatedTickets: [], diff --git a/src/frontend/fixtures/paymentmodule/fakeApolloPaymentPlan.ts b/src/frontend/fixtures/paymentmodule/fakeApolloPaymentPlan.ts index 7ccade4d73..603ef009c9 100644 --- a/src/frontend/fixtures/paymentmodule/fakeApolloPaymentPlan.ts +++ b/src/frontend/fixtures/paymentmodule/fakeApolloPaymentPlan.ts @@ -1,7 +1,6 @@ import { FinancialServiceProviderCommunicationChannel, PaymentPlanBackgroundActionStatus, - PaymentPlanCurrency, PaymentPlanQuery, PaymentPlanStatus, PaymentStatus, @@ -44,7 +43,7 @@ export const fakeApolloPaymentPlan: PaymentPlanQuery['paymentPlan'] = { name: 'Report should property early adult.', __typename: 'TargetPopulationNode', }, - currency: PaymentPlanCurrency.Pln, + currency: "PLN", currencyName: 'Polish złoty', startDate: '2020-10-27', endDate: '2021-09-08', diff --git a/src/frontend/fixtures/payments/fakeApolloAllCashPlans.ts b/src/frontend/fixtures/payments/fakeApolloAllCashPlans.ts deleted file mode 100644 index 515da13c52..0000000000 --- a/src/frontend/fixtures/payments/fakeApolloAllCashPlans.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { AllCashPlansDocument } from '../../src/__generated__/graphql'; - -export const fakeApolloAllCashPlans = [ - { - request: { - query: AllCashPlansDocument, - variables: { - program: - 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - businessArea: 'afghanistan', - first: 5, - orderBy: null, - }, - }, - result: { - data: { - allCashPlans: { - pageInfo: { - hasNextPage: true, - hasPreviousPage: false, - startCursor: 'YXJyYXljb25uZWN0aW9uOjA=', - endCursor: 'YXJyYXljb25uZWN0aW9uOjQ=', - __typename: 'PageInfo', - }, - totalCount: 1, - edges: [ - { - cursor: 'YXJyYXljb25uZWN0aW9uOjA=', - node: { - id: - 'Q2FzaFBsYW5Ob2RlOmNiNzBjYjdmLWY0N2EtNDI5Yy04Y2FjLTk0YzU0MDRiOTFkZA==', - caId: '123-21-CSH-00003', - assistanceThrough: '123-21-SRV-00002', - totalNumberOfHouseholds: 5, - serviceProvider: null, - deliveryType: 'Referral', - startDate: '2020-01-21T01:16:12', - endDate: '2020-03-22T01:16:12', - program: { - id: - 'UHJvZ3JhbU5vZGU6N2RiNzkwMDctMzA3My00ZDU5LWIxYzktNGY2MDQ2ZjM3MmIw', - name: 'Picture manage product score five agree.', - __typename: 'ProgramNode', - }, - totalPersonsCovered: 4, - dispersionDate: '2021-11-03T01:16:12', - assistanceMeasurement: 'Aruban florin', - status: 'TRANSACTION_COMPLETED', - currency: 'AED', - totalEntitledQuantity: 81968631.29, - totalDeliveredQuantity: 24029588.26, - totalUndeliveredQuantity: 53795776.44, - updatedAt: '2022-02-24T09:56:48.875230', - paymentVerificationSummary: { - edges: [ - { - cursor: 'YXJyYXljb25uZWN0aW9uOjA=', - node: { - id: - 'Q2FzaFBsYW5QYXltZW50VmVyaWZpY2F0aW9uU3VtbWFyeU5vZGU6NGNhNTdkZDUtYmY4ZC00MGIxLWE3NWEtOTM0Yzg4OTc3ZTM4', - status: 'PENDING', - __typename: 'PaymentVerificationPlanSummaryNode', - }, - __typename: 'PaymentVerificationPlanSummaryEdge', - }, - ], - }, - __typename: 'CashPlanNode', - }, - __typename: 'CashPlanNodeEdge', - }, - ], - __typename: 'CashPlanNodeConnection', - }, - }, - }, - }, -]; diff --git a/src/frontend/fixtures/payments/fakeApolloAllPaymentRecords.ts b/src/frontend/fixtures/payments/fakeApolloAllPaymentRecords.ts deleted file mode 100644 index e2c4ac5551..0000000000 --- a/src/frontend/fixtures/payments/fakeApolloAllPaymentRecords.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { AllPaymentRecordsDocument } from '../../src/__generated__/graphql'; - -export const fakeApolloAllPaymentRecords = [ - { - request: { - query: AllPaymentRecordsDocument, - variables: { - parent: - 'Q2FzaFBsYW5Ob2RlOjI1ZTNkODA0LTAzMzEtNDhkOC1iYTk2LWVmZjEzYmU3ZDdiYQ==', - first: 5, - orderBy: null, - }, - }, - result: { - data: { - allPaymentRecords: { - pageInfo: { - hasNextPage: false, - hasPreviousPage: false, - startCursor: 'YXJyYXljb25uZWN0aW9uOjA=', - endCursor: 'YXJyYXljb25uZWN0aW9uOjQ=', - __typename: 'PageInfo', - }, - edges: [ - { - cursor: 'YXJyYXljb25uZWN0aW9uOjA=', - node: { - id: - 'UGF5bWVudFJlY29yZE5vZGU6NWEyZmE4NWYtNTM4YS00M2VjLWEwZTItMzM4ZTBmZDNlODQ1', - createdAt: '2021-07-22T11:52:58.791297', - updatedAt: '2021-07-22T11:52:58.791308', - fullName: 'Mr. Miguel Conner', - statusDate: '2020-07-25T11:37:23', - status: 'DISTRIBUTION_SUCCESSFUL', - caId: '123-21-PR-00006', - totalPersonsCovered: 2, - household: { - id: - 'SG91c2Vob2xkTm9kZTo1YmQ0ODJjMS0zMmYzLTRjZDEtODZlNi0xNTdhMzdmYjBkZWQ=', - unicefId: 'HH-21-0000.0025', - size: 7, - __typename: 'HouseholdNode', - }, - headOfHousehold: null, - currency: 'TMT', - entitlementQuantity: 3683.4, - deliveredQuantity: 3326.0, - deliveredQuantityUsd: 1694.0, - deliveryDate: '2021-01-11T17:05:53', - parent: { - id: - 'Q2FzaFBsYW5Ob2RlOjViZWQ0OTUyLTMyNmItNDgxNS04MjA5LTBmOGNmYjIyMTc2NA==', - program: { - id: - 'UHJvZ3JhbU5vZGU6ZDM4YWI4MTQtOTQyNy00ZmJkLTg4ODctOGUyYzlkMzcxYjg2', - name: 'Notice hair fall college enough perhaps.', - __typename: 'ProgramNode', - }, - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - ], - totalCount: 5, - edgeCount: 5, - __typename: 'PaymentRecordNodeConnection', - }, - }, - }, - }, -]; diff --git a/src/frontend/fixtures/payments/fakeCashPlan.ts b/src/frontend/fixtures/payments/fakeCashPlan.ts deleted file mode 100644 index 719dbc8a86..0000000000 --- a/src/frontend/fixtures/payments/fakeCashPlan.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { CashPlanNode } from '../../src/__generated__/graphql'; - -export const fakeCashPlan = { - id: 'Q2FzaFBsYW5Ob2RlOjI1ZTNkODA0LTAzMzEtNDhkOC1iYTk2LWVmZjEzYmU3ZDdiYQ==', - updatedAt: '2022-02-16T10:53:05.636703', - businessArea: { - id: - 'QnVzaW5lc3NBcmVOb2RlOjI1ZTNkODA0LTAzMzEtNDhkOC1iYTk2LWVmZjEzYmU3ZDdiYQ==', - name: 'Afghanistan', - slug: 'afghanistan', - }, - statusDate: '2022-02-16T10:53:05.636703', - startDate: '2020-07-14T05:04:13', - endDate: '2023-03-17T05:04:13', - program: { - id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm', - name: 'Surface campaign practice actually about about will what.', - caId: '123-21-PRG-00001', - __typename: 'ProgramNode', - }, - exchangeRate: 1.0, - totalEntitledQuantity: 0, - totalEntitledQuantityUsd: 0, - totalEntitledQuantityRevised: 0, - totalEntitledQuantityRevisedUsd: 0, - totalDeliveredQuantity: 0, - totalDeliveredQuantityUsd: 0, - totalUndeliveredQuantity: 0, - totalUndeliveredQuantityUsd: 0, - name: 'Military citizen until amount.', - caId: '123-21-CSH-00003', - caHashId: 'bf0e9242-5748-4557-8bc1-3d1f8c9eacfa', - status: 'DISTRIBUTION_COMPLETED', - distributionLevel: 'COUNTRY', - dispersionDate: '2021-12-14T05:04:13', - coverageDuration: 0, - coverageUnit: 'DAY', - comments: '', - deliveryType: 'Voucher', - assistanceMeasurement: 'PER_PERSON', - assistanceThrough: '123-21-SRV-00002', - serviceProvider: null, - visionId: null, - fundsCommitment: '62947144', - downPayment: '27371694', - validationAlertsCount: 0, - totalPersonsCovered: 0, - totalPersonsCoveredRevised: 0, - bankReconciliationSuccess: 1, - bankReconciliationError: 3, - totalNumberOfHouseholds: 5, - currency: 'USD', - canCreatePaymentVerificationPlan: false, - availablePaymentRecordsCount: 0, - verificationPlans: { - totalCount: 3, - edges: [ - { - node: { - id: - 'Q2FzaFBsYW5QYXltZW50VmVyaWZpY2F0aW9uTm9kZTpkYTAwZGJiMy0xMTMzLTQxNzctYTVhNC0xOTUxOGIyNjBmNjU=', - unicefId: 'PVP-1', - status: 'ACTIVE', - sampleSize: 1, - receivedCount: null, - notReceivedCount: null, - respondedCount: null, - verificationChannel: 'MANUAL', - sampling: 'FULL_LIST', - receivedWithProblemsCount: null, - rapidProFlowId: '', - confidenceInterval: null, - marginOfError: null, - activationDate: '2022-02-07T16:02:51.287552', - completionDate: null, - ageFilter: null, - excludedAdminAreasFilter: [], - sexFilter: null, - __typename: 'PaymentVerificationPlanNode', - }, - __typename: 'PaymentVerificationPlanNodeEdge', - }, - { - node: { - id: - 'Q2FzaFBsYW5QYXltZW50VmVyaWZpY2F0aW9uTm9kZTpkODA1NTgzYy0xMWMxLTQxNGYtYTdmZC1hYmU1YjBhNTY4NTQ=', - unicefId: 'PVP-2', - status: 'ACTIVE', - sampleSize: 1, - receivedCount: null, - notReceivedCount: null, - respondedCount: null, - verificationChannel: 'XLSX', - sampling: 'FULL_LIST', - receivedWithProblemsCount: null, - rapidProFlowId: '', - confidenceInterval: null, - marginOfError: null, - activationDate: '2022-02-08T10:03:34.755575', - completionDate: null, - ageFilter: null, - excludedAdminAreasFilter: [], - sexFilter: null, - __typename: 'PaymentVerificationPlanNode', - }, - __typename: 'PaymentVerificationPlanNodeEdge', - }, - { - node: { - id: - 'Q2FzaFBsYW5QYXltZW50VmVyaWZpY2F0aW9uTm9kZTozNTg0MTk4Ni00ZTNjLTQyNjAtODIzYi1mYmUwZTg3ZGUyMDU=', - unicefId: 'PVP-3', - status: 'PENDING', - sampleSize: 1, - receivedCount: null, - notReceivedCount: null, - respondedCount: null, - verificationChannel: 'MANUAL', - sampling: 'FULL_LIST', - receivedWithProblemsCount: null, - rapidProFlowId: '', - confidenceInterval: null, - marginOfError: null, - activationDate: null, - completionDate: null, - ageFilter: null, - excludedAdminAreasFilter: [], - sexFilter: null, - __typename: 'PaymentVerificationPlanNode', - }, - __typename: 'PaymentVerificationPlanNodeEdge', - }, - ], - __typename: 'PaymentVerificationPlanNodeConnection', - }, - paymentVerificationSummary: { - id: - 'Q2FzaFBsYW5QYXltZW50VmVyaWZpY2F0aW9uU3VtbWFyeU5vZGU6MTNjY2MxNzMtNzEwZS00N2NkLTg1ZmQtODM4YTFlMjZiNDUy', - createdAt: '2022-02-17T14:23:02.018701', - updatedAt: '2022-02-17T14:23:02.018730', - status: 'PENDING', - activationDate: null, - completionDate: null, - __typename: 'PaymentVerificationSummaryNode', - }, - paymentItems: { - totalCount: 5, - edgeCount: 5, - edges: [ - { - node: { - targetPopulation: { - id: - 'VGFyZ2V0UG9wdWxhdGlvbk5vZGU6ZGRlODE4MDUtMWQ0Ny00YzY0LTgzYTMtMzQ3NWEzMGVmZTJk', - name: 'Floor anyone remain play most.', - __typename: 'TargetPopulationNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - targetPopulation: { - id: - 'VGFyZ2V0UG9wdWxhdGlvbk5vZGU6MTdlM2VmMjAtNjczMy00ZDNhLWFiMDUtZjVkOTgzZjViMjI1', - name: 'Former center score fire role.', - __typename: 'TargetPopulationNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - targetPopulation: { - id: - 'VGFyZ2V0UG9wdWxhdGlvbk5vZGU6MjRkMTdhODktMjg4OC00NDI0LTgxMDAtYmU3MTZjOWFkNDk3', - name: 'Stock before maybe campaign blue history recently.', - __typename: 'TargetPopulationNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - targetPopulation: { - id: - 'VGFyZ2V0UG9wdWxhdGlvbk5vZGU6NzNiNTFhNjctZmRmNy00ODkwLWIyOWItMjhhYzk4NTc4OGRk', - name: 'Eight affect late place.', - __typename: 'TargetPopulationNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - targetPopulation: { - id: - 'VGFyZ2V0UG9wdWxhdGlvbk5vZGU6ZjZkZjc2MDctMzMyZi00NDYwLWJiMzgtMTZiZGM4MGVkNTkz', - name: 'Seek development woman once worker.', - __typename: 'TargetPopulationNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - ], - __typename: 'PaymentRecordNodeConnection', - }, - __typename: 'CashPlanNode', -} as CashPlanNode; diff --git a/src/frontend/fixtures/population/fakeHousehold.ts b/src/frontend/fixtures/population/fakeHousehold.ts index 9aada5ff60..10f5a8fd1d 100644 --- a/src/frontend/fixtures/population/fakeHousehold.ts +++ b/src/frontend/fixtures/population/fakeHousehold.ts @@ -165,57 +165,6 @@ export const fakeHousehold = { }, __typename: 'RegistrationDataImportNode', }, - paymentrecordSet: { - edges: [ - { - node: { - id: - 'UGF5bWVudFJlY29yZE5vZGU6YThhNzdkZTEtNWYxZi00MzBjLWJlOGMtODVhNzkzNjJiMzZm', - fullName: 'Arthur Fletcher', - parent: { - id: - 'Q2FzaFBsYW5Ob2RlOmQzMDI1MDRhLWQzZjMtNGE2MC05Nzg5LTBhNGVjMGI0N2M4Mw==', - totalPersonsCovered: 3, - program: { - id: - 'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw', - name: 'Test Program', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 49412110.25, - assistanceMeasurement: 'Falkland Islands pound', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - { - node: { - id: - 'UGF5bWVudFJlY29yZE5vZGU6Y2JkMjU1MjctNTIwNS00Mjk5LWFiYmYtYTZjYTgzNzEyYjk1', - fullName: 'Ashley Reid', - parent: { - id: - 'Q2FzaFBsYW5Ob2RlOjMwMTY0M2ZjLTQwMGItNGY5MS1iZDg1LTFiNTAyZTMxZmMzMg==', - totalPersonsCovered: 2, - program: { - id: - 'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw', - name: 'Test Program', - __typename: 'ProgramNode', - }, - totalDeliveredQuantity: 75446491.46, - assistanceMeasurement: 'Norwegian krone', - __typename: 'CashPlanNode', - }, - __typename: 'PaymentRecordNode', - }, - __typename: 'PaymentRecordNodeEdge', - }, - ], - __typename: 'PaymentRecordNodeConnection', - }, deliveredQuantities: [ { totalDeliveredQuantity: '5755.00', diff --git a/src/frontend/src/__generated__/graphql.tsx b/src/frontend/src/__generated__/graphql.tsx index 6188101018..4c6e37323a 100644 --- a/src/frontend/src/__generated__/graphql.tsx +++ b/src/frontend/src/__generated__/graphql.tsx @@ -440,7 +440,6 @@ export type BusinessAreaNode = Node & { active: Scalars['Boolean']['output']; biometricDeduplicationThreshold: Scalars['Float']['output']; businessAreaPartnerThrough: Array; - cashplanSet: CashPlanNodeConnection; children: UserBusinessAreaNodeConnection; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; @@ -475,7 +474,6 @@ export type BusinessAreaNode = Node & { partners: Array; paymentSet: PaymentNodeConnection; paymentplanSet: PaymentPlanNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; postponeDeduplication: Scalars['Boolean']['output']; programSet: ProgramNodeConnection; rapidProHost?: Maybe; @@ -488,7 +486,6 @@ export type BusinessAreaNode = Node & { reports: ReportNodeConnection; ruleSet: SteficonRuleNodeConnection; screenBeneficiary: Scalars['Boolean']['output']; - serviceproviderSet: ServiceProviderNodeConnection; slug: Scalars['String']['output']; surveySet: SurveyNodeConnection; targetpopulationSet: TargetPopulationNodeConnection; @@ -498,15 +495,6 @@ export type BusinessAreaNode = Node & { }; -export type BusinessAreaNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeChildrenArgs = { after?: InputMaybe; before?: InputMaybe; @@ -598,15 +586,6 @@ export type BusinessAreaNodePaymentplanSetArgs = { }; -export type BusinessAreaNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeProgramSetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -644,15 +623,6 @@ export type BusinessAreaNodeRuleSetArgs = { }; -export type BusinessAreaNodeServiceproviderSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeSurveySetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -745,97 +715,6 @@ export type CashPlanAndPaymentPlanNode = { verificationStatus?: Maybe; }; -export type CashPlanNode = Node & { - __typename?: 'CashPlanNode'; - assistanceMeasurement: Scalars['String']['output']; - assistanceThrough: Scalars['String']['output']; - availablePaymentRecordsCount?: Maybe; - bankReconciliationError?: Maybe; - bankReconciliationSuccess?: Maybe; - businessArea: UserBusinessAreaNode; - caHashId?: Maybe; - caId?: Maybe; - canCreatePaymentVerificationPlan?: Maybe; - comments?: Maybe; - coverageDuration: Scalars['Int']['output']; - coverageUnit: Scalars['String']['output']; - createdAt: Scalars['DateTime']['output']; - currency?: Maybe; - deliveryType?: Maybe; - dispersionDate: Scalars['DateTime']['output']; - distributionLevel: Scalars['String']['output']; - downPayment?: Maybe; - endDate?: Maybe; - exchangeRate?: Maybe; - fundsCommitment?: Maybe; - id: Scalars['ID']['output']; - name: Scalars['String']['output']; - paymentItems: PaymentRecordNodeConnection; - paymentVerificationSummary?: Maybe; - program: ProgramNode; - serviceProvider?: Maybe; - startDate?: Maybe; - status: CashPlanStatus; - statusDate: Scalars['DateTime']['output']; - totalDeliveredQuantity?: Maybe; - totalDeliveredQuantityUsd?: Maybe; - totalEntitledQuantity?: Maybe; - totalEntitledQuantityRevised?: Maybe; - totalEntitledQuantityRevisedUsd?: Maybe; - totalEntitledQuantityUsd?: Maybe; - totalNumberOfHouseholds?: Maybe; - totalPersonsCovered: Scalars['Int']['output']; - totalPersonsCoveredRevised: Scalars['Int']['output']; - totalUndeliveredQuantity?: Maybe; - totalUndeliveredQuantityUsd?: Maybe; - unicefId?: Maybe; - updatedAt: Scalars['DateTime']['output']; - validationAlertsCount: Scalars['Int']['output']; - verificationPlans?: Maybe; - version: Scalars['BigInt']['output']; - visionId?: Maybe; -}; - - -export type CashPlanNodePaymentItemsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - -export type CashPlanNodeVerificationPlansArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - programId?: InputMaybe; -}; - -export type CashPlanNodeConnection = { - __typename?: 'CashPlanNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type CashPlanNodeEdge = { - __typename?: 'CashPlanNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - -export enum CashPlanStatus { - DistributionCompleted = 'DISTRIBUTION_COMPLETED', - DistributionCompletedWithErrors = 'DISTRIBUTION_COMPLETED_WITH_ERRORS', - TransactionCompleted = 'TRANSACTION_COMPLETED', - TransactionCompletedWithErrors = 'TRANSACTION_COMPLETED_WITH_ERRORS' -} - export type CategoryExtrasInput = { grievanceComplaintTicketExtras?: InputMaybe; negativeFeedbackTicketExtras?: InputMaybe; @@ -1124,19 +1003,6 @@ export type CreateCommunicationMessageMutation = { message?: Maybe; }; -export type CreateDashboardReport = { - __typename?: 'CreateDashboardReport'; - success?: Maybe; -}; - -export type CreateDashboardReportInput = { - adminArea?: InputMaybe; - businessAreaSlug: Scalars['String']['input']; - program?: InputMaybe; - reportTypes: Array>; - year: Scalars['Int']['input']; -}; - export type CreateFeedbackInput = { admin2?: InputMaybe; area?: InputMaybe; @@ -1512,7 +1378,6 @@ export type DeliveryMechanismNode = Node & { optionalFields: Array; paymentGatewayId?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; requiredFields: Array; transferType: DeliveryMechanismTransferType; uniqueFields: Array; @@ -1555,15 +1420,6 @@ export type DeliveryMechanismNodePaymentSetArgs = { offset?: InputMaybe; }; - -export type DeliveryMechanismNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - export type DeliveryMechanismNodeConnection = { __typename?: 'DeliveryMechanismNodeConnection'; edgeCount?: Maybe; @@ -1928,11 +1784,11 @@ export type FinancialServiceProviderNode = Node & { createdBy?: Maybe; dataTransferConfiguration?: Maybe; deliveryMechanisms: DeliveryMechanismNodeConnection; - deliveryMechanismsChoices?: Maybe>; deliveryMechanismsPerPaymentPlan: DeliveryMechanismPerPaymentPlanNodeConnection; distributionLimit?: Maybe; fullName?: Maybe; id: Scalars['ID']['output']; + internalData: Scalars['JSONString']['output']; isPaymentGateway?: Maybe; name: Scalars['String']['output']; paymentGatewayId?: Maybe; @@ -2572,6 +2428,7 @@ export type HouseholdNode = Node & { importId?: Maybe; individuals?: Maybe; individualsAndRoles: Array; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRecalculatedGroupAges: Scalars['Boolean']['output']; @@ -2601,7 +2458,6 @@ export type HouseholdNode = Node & { orgNameEnumerator: Scalars['String']['output']; originUnicefId?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; positiveFeedbackTicketDetails: TicketPositiveFeedbackDetailsNodeConnection; pregnantCount?: Maybe; program?: Maybe; @@ -2631,7 +2487,6 @@ export type HouseholdNode = Node & { unhcrId: Scalars['String']['output']; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; village: Scalars['String']['output']; withdrawn: Scalars['Boolean']['output']; @@ -2752,15 +2607,6 @@ export type HouseholdNodePaymentSetArgs = { }; -export type HouseholdNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type HouseholdNodePositiveFeedbackTicketDetailsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -3111,6 +2957,7 @@ export type ImportedHouseholdNode = Node & { id: Scalars['ID']['output']; importId?: Maybe; individuals?: Maybe; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRecalculatedGroupAges: Scalars['Boolean']['output']; @@ -3154,7 +3001,6 @@ export type ImportedHouseholdNode = Node & { unhcrId: Scalars['String']['output']; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; village: Scalars['String']['output']; withdrawn: Scalars['Boolean']['output']; @@ -3253,6 +3099,7 @@ export type ImportedIndividualNode = Node & { importId?: Maybe; importedIndividualId?: Maybe; individualId: Scalars['String']['output']; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; @@ -3290,7 +3137,6 @@ export type ImportedIndividualNode = Node & { sex: IndividualSex; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; walletAddress: Scalars['String']['output']; walletName: Scalars['String']['output']; @@ -3484,6 +3330,7 @@ export type IndividualNode = Node & { importedIndividualId?: Maybe; individualDataUpdateTicketDetails: TicketIndividualDataUpdateDetailsNodeConnection; individualId: Scalars['String']['output']; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; @@ -3500,7 +3347,6 @@ export type IndividualNode = Node & { paymentChannels?: Maybe>>; paymentDeliveryPhoneNo?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; phoneNo: Scalars['String']['output']; phoneNoAlternative: Scalars['String']['output']; phoneNoAlternativeValid?: Maybe; @@ -3536,7 +3382,6 @@ export type IndividualNode = Node & { ticketsystemflaggingdetailsSet: TicketSystemFlaggingDetailsNodeConnection; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; walletAddress: Scalars['String']['output']; walletName: Scalars['String']['output']; @@ -3638,15 +3483,6 @@ export type IndividualNodePaymentSetArgs = { }; -export type IndividualNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type IndividualNodePositiveFeedbackTicketDetailsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -4005,11 +3841,6 @@ export type MarkPaymentAsFailedMutation = { payment?: Maybe; }; -export type MarkPaymentRecordAsFailedMutation = { - __typename?: 'MarkPaymentRecordAsFailedMutation'; - paymentRecord?: Maybe; -}; - export type MergeRegistrationDataImportMutation = { __typename?: 'MergeRegistrationDataImportMutation'; registrationDataImport?: Maybe; @@ -4042,7 +3873,6 @@ export type Mutations = { copyProgram?: Maybe; copyTargetPopulation?: Maybe; createAccountabilityCommunicationMessage?: Maybe; - createDashboardReport?: Maybe; createFeedback?: Maybe; createFeedbackMessage?: Maybe; createFollowUpPaymentPlan?: Maybe; @@ -4077,7 +3907,6 @@ export type Mutations = { invalidPaymentVerificationPlan?: Maybe; lockTargetPopulation?: Maybe; markPaymentAsFailed?: Maybe; - markPaymentRecordAsFailed?: Maybe; mergeRegistrationDataImport?: Maybe; reassignRole?: Maybe; refuseRegistrationDataImport?: Maybe; @@ -4087,7 +3916,6 @@ export type Mutations = { rerunDedupe?: Maybe; restartCreateReport?: Maybe; revertMarkPaymentAsFailed?: Maybe; - revertMarkPaymentRecordAsFailed?: Maybe; saveKoboImportDataAsync?: Maybe; setSteficonRuleOnPaymentPlanPaymentList?: Maybe; setSteficonRuleOnTargetPopulation?: Maybe; @@ -4249,11 +4077,6 @@ export type MutationsCreateAccountabilityCommunicationMessageArgs = { }; -export type MutationsCreateDashboardReportArgs = { - reportData: CreateDashboardReportInput; -}; - - export type MutationsCreateFeedbackArgs = { input: CreateFeedbackInput; }; @@ -4443,11 +4266,6 @@ export type MutationsMarkPaymentAsFailedArgs = { }; -export type MutationsMarkPaymentRecordAsFailedArgs = { - paymentRecordId: Scalars['ID']['input']; -}; - - export type MutationsMergeRegistrationDataImportArgs = { id: Scalars['ID']['input']; version?: InputMaybe; @@ -4506,13 +4324,6 @@ export type MutationsRevertMarkPaymentAsFailedArgs = { }; -export type MutationsRevertMarkPaymentRecordAsFailedArgs = { - deliveredQuantity: Scalars['Decimal']['input']; - deliveryDate: Scalars['Date']['input']; - paymentRecordId: Scalars['ID']['input']; -}; - - export type MutationsSaveKoboImportDataAsyncArgs = { businessAreaSlug: Scalars['String']['input']; onlyActiveSubmissions: Scalars['Boolean']['input']; @@ -4837,23 +4648,6 @@ export type PaymentConflictDataNode = { paymentUnicefId?: Maybe; }; -export enum PaymentDeliveryTypeChoice { - AtmCard = 'ATM_CARD', - CardlessCashWithdrawal = 'CARDLESS_CASH_WITHDRAWAL', - Cash = 'CASH', - CashByFsp = 'CASH_BY_FSP', - CashOverTheCounter = 'CASH_OVER_THE_COUNTER', - Cheque = 'CHEQUE', - DepositToCard = 'DEPOSIT_TO_CARD', - MobileMoney = 'MOBILE_MONEY', - PrePaidCard = 'PRE_PAID_CARD', - Referral = 'REFERRAL', - Transfer = 'TRANSFER', - TransferToAccount = 'TRANSFER_TO_ACCOUNT', - TransferToDigitalWallet = 'TRANSFER_TO_DIGITAL_WALLET', - Voucher = 'VOUCHER' -} - export type PaymentDetailsApproveMutation = { __typename?: 'PaymentDetailsApproveMutation'; grievanceTicket?: Maybe; @@ -4886,7 +4680,6 @@ export type PaymentNode = Node & { deliveredQuantityUsd?: Maybe; deliveryDate?: Maybe; deliveryType?: Maybe; - deliveryTypeChoice?: Maybe; distributionModality?: Maybe; entitlementDate?: Maybe; entitlementQuantity?: Maybe; @@ -4900,6 +4693,8 @@ export type PaymentNode = Node & { household: HouseholdNode; householdSnapshot?: Maybe; id: Scalars['ID']['output']; + internalData: Scalars['JSONString']['output']; + isCashAssist: Scalars['Boolean']['output']; isFollowUp: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; orderNumber?: Maybe; @@ -4908,6 +4703,7 @@ export type PaymentNode = Node & { paymentPlanHardConflictedData?: Maybe>>; paymentPlanSoftConflicted?: Maybe; paymentPlanSoftConflictedData?: Maybe>>; + paymentVerification?: Maybe; program?: Maybe; reasonForUnsuccessfulPayment?: Maybe; serviceProvider?: Maybe; @@ -4921,6 +4717,8 @@ export type PaymentNode = Node & { status: PaymentStatus; statusDate: Scalars['DateTime']['output']; targetPopulation?: Maybe; + ticketComplaintDetails?: Maybe; + ticketSensitiveDetails?: Maybe; tokenNumber?: Maybe; totalPersonsCovered?: Maybe; transactionReferenceId?: Maybe; @@ -4967,172 +4765,6 @@ export enum PaymentPlanBackgroundActionStatus { XlsxImportError = 'XLSX_IMPORT_ERROR' } -export enum PaymentPlanCurrency { - Aed = 'AED', - Afn = 'AFN', - All = 'ALL', - Amd = 'AMD', - Ang = 'ANG', - Aoa = 'AOA', - Ars = 'ARS', - Aud = 'AUD', - Awg = 'AWG', - Azn = 'AZN', - A = 'A_', - Bam = 'BAM', - Bbd = 'BBD', - Bdt = 'BDT', - Bgn = 'BGN', - Bhd = 'BHD', - Bif = 'BIF', - Bmd = 'BMD', - Bnd = 'BND', - Bob = 'BOB', - Bov = 'BOV', - Brl = 'BRL', - Bsd = 'BSD', - Btn = 'BTN', - Bwp = 'BWP', - Byn = 'BYN', - Bzd = 'BZD', - Cad = 'CAD', - Cdf = 'CDF', - Chf = 'CHF', - Clp = 'CLP', - Cny = 'CNY', - Cop = 'COP', - Crc = 'CRC', - Cuc = 'CUC', - Cup = 'CUP', - Cve = 'CVE', - Czk = 'CZK', - Djf = 'DJF', - Dkk = 'DKK', - Dop = 'DOP', - Dzd = 'DZD', - Egp = 'EGP', - Ern = 'ERN', - Etb = 'ETB', - Eur = 'EUR', - Fjd = 'FJD', - Fkp = 'FKP', - Gbp = 'GBP', - Gel = 'GEL', - Ghs = 'GHS', - Gip = 'GIP', - Gmd = 'GMD', - Gnf = 'GNF', - Gtq = 'GTQ', - Gyd = 'GYD', - Hkd = 'HKD', - Hnl = 'HNL', - Hrk = 'HRK', - Htg = 'HTG', - Huf = 'HUF', - Idr = 'IDR', - Ils = 'ILS', - Inr = 'INR', - Iqd = 'IQD', - Irr = 'IRR', - Isk = 'ISK', - Jmd = 'JMD', - Jod = 'JOD', - Jpy = 'JPY', - Kes = 'KES', - Kgs = 'KGS', - Khr = 'KHR', - Kmf = 'KMF', - Kpw = 'KPW', - Krw = 'KRW', - Kwd = 'KWD', - Kyd = 'KYD', - Kzt = 'KZT', - Lak = 'LAK', - Lbp = 'LBP', - Lkr = 'LKR', - Lrd = 'LRD', - Lsl = 'LSL', - Lyd = 'LYD', - Mad = 'MAD', - Mdl = 'MDL', - Mga = 'MGA', - Mkd = 'MKD', - Mmk = 'MMK', - Mnt = 'MNT', - Mop = 'MOP', - Mru = 'MRU', - Mur = 'MUR', - Mvr = 'MVR', - Mwk = 'MWK', - Mxn = 'MXN', - Myr = 'MYR', - Mzn = 'MZN', - Nad = 'NAD', - Ngn = 'NGN', - Nio = 'NIO', - Nok = 'NOK', - Npr = 'NPR', - Nzd = 'NZD', - Omr = 'OMR', - Pab = 'PAB', - Pen = 'PEN', - Pgk = 'PGK', - Php = 'PHP', - Pkr = 'PKR', - Pln = 'PLN', - Pyg = 'PYG', - Qar = 'QAR', - Ron = 'RON', - Rsd = 'RSD', - Rub = 'RUB', - Rwf = 'RWF', - Sar = 'SAR', - Sbd = 'SBD', - Scr = 'SCR', - Sdg = 'SDG', - Sek = 'SEK', - Sgd = 'SGD', - Shp = 'SHP', - Sll = 'SLL', - Sos = 'SOS', - Srd = 'SRD', - Ssp = 'SSP', - Stn = 'STN', - Svc = 'SVC', - Syp = 'SYP', - Szl = 'SZL', - Thb = 'THB', - Tjs = 'TJS', - Tmt = 'TMT', - Tnd = 'TND', - Top = 'TOP', - Try = 'TRY', - Ttd = 'TTD', - Twd = 'TWD', - Tzs = 'TZS', - Uah = 'UAH', - Ugx = 'UGX', - Usd = 'USD', - Usdc = 'USDC', - Uyu = 'UYU', - Uyw = 'UYW', - Uzs = 'UZS', - Ves = 'VES', - Vnd = 'VND', - Vuv = 'VUV', - Wst = 'WST', - Xaf = 'XAF', - Xag = 'XAG', - Xau = 'XAU', - Xcd = 'XCD', - Xof = 'XOF', - Xpf = 'XPF', - Yer = 'YER', - Zar = 'ZAR', - Zmw = 'ZMW', - Zwl = 'ZWL' -} - export type PaymentPlanNode = Node & { __typename?: 'PaymentPlanNode'; adminUrl?: Maybe; @@ -5148,7 +4780,7 @@ export type PaymentPlanNode = Node & { canSplit?: Maybe; createdAt: Scalars['DateTime']['output']; createdBy: UserNode; - currency: PaymentPlanCurrency; + currency?: Maybe; currencyName?: Maybe; deliveryMechanisms?: Maybe>>; dispersionEndDate?: Maybe; @@ -5168,16 +4800,19 @@ export type PaymentPlanNode = Node & { id: Scalars['ID']['output']; importedFileDate?: Maybe; importedFileName?: Maybe; + internalData: Scalars['JSONString']['output']; + isCashAssist: Scalars['Boolean']['output']; isFollowUp: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; maleAdultsCount: Scalars['Int']['output']; maleChildrenCount: Scalars['Int']['output']; name?: Maybe; paymentItems: PaymentNodeConnection; + paymentVerificationPlans: PaymentVerificationPlanNodeConnection; paymentVerificationSummary?: Maybe; paymentsConflictsCount?: Maybe; - program: ProgramNode; - programCycle?: Maybe; + program?: Maybe; + programCycle: ProgramCycleNode; reconciliationSummary?: Maybe; sourcePaymentPlan?: Maybe; splitChoices?: Maybe>>; @@ -5244,6 +4879,15 @@ export type PaymentPlanNodePaymentItemsArgs = { }; +export type PaymentPlanNodePaymentVerificationPlansArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + offset?: InputMaybe; +}; + + export type PaymentPlanNodeVerificationPlansArgs = { after?: InputMaybe; before?: InputMaybe; @@ -5317,95 +4961,6 @@ export type PaymentRecordAndPaymentNode = { verification?: Maybe; }; -export enum PaymentRecordDeliveryTypeChoice { - AtmCard = 'ATM_CARD', - CardlessCashWithdrawal = 'CARDLESS_CASH_WITHDRAWAL', - Cash = 'CASH', - CashByFsp = 'CASH_BY_FSP', - CashOverTheCounter = 'CASH_OVER_THE_COUNTER', - Cheque = 'CHEQUE', - DepositToCard = 'DEPOSIT_TO_CARD', - MobileMoney = 'MOBILE_MONEY', - PrePaidCard = 'PRE_PAID_CARD', - Referral = 'REFERRAL', - Transfer = 'TRANSFER', - TransferToAccount = 'TRANSFER_TO_ACCOUNT', - TransferToDigitalWallet = 'TRANSFER_TO_DIGITAL_WALLET', - Voucher = 'VOUCHER' -} - -export enum PaymentRecordEntitlementCardStatus { - Active = 'ACTIVE', - Inactive = 'INACTIVE' -} - -export type PaymentRecordNode = Node & { - __typename?: 'PaymentRecordNode'; - adminUrl?: Maybe; - businessArea: UserBusinessAreaNode; - caHashId?: Maybe; - caId?: Maybe; - createdAt: Scalars['DateTime']['output']; - currency: Scalars['String']['output']; - deliveredQuantity?: Maybe; - deliveredQuantityUsd?: Maybe; - deliveryDate?: Maybe; - deliveryType?: Maybe; - deliveryTypeChoice?: Maybe; - distributionModality: Scalars['String']['output']; - entitlementCardIssueDate?: Maybe; - entitlementCardNumber?: Maybe; - entitlementCardStatus?: Maybe; - entitlementQuantity?: Maybe; - entitlementQuantityUsd?: Maybe; - fullName: Scalars['String']['output']; - headOfHousehold?: Maybe; - household: HouseholdNode; - id: Scalars['ID']['output']; - parent?: Maybe; - registrationCaId?: Maybe; - serviceProvider: ServiceProviderNode; - status: PaymentRecordStatus; - statusDate: Scalars['DateTime']['output']; - targetPopulation: TargetPopulationNode; - targetPopulationCashAssistId: Scalars['String']['output']; - totalPersonsCovered: Scalars['Int']['output']; - transactionReferenceId?: Maybe; - transactionStatusBlockchainLink?: Maybe; - unicefId?: Maybe; - updatedAt: Scalars['DateTime']['output']; - verification?: Maybe; - version: Scalars['BigInt']['output']; - visionId?: Maybe; -}; - -export type PaymentRecordNodeConnection = { - __typename?: 'PaymentRecordNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type PaymentRecordNodeEdge = { - __typename?: 'PaymentRecordNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - -export enum PaymentRecordStatus { - DistributionSuccessful = 'DISTRIBUTION_SUCCESSFUL', - ForceFailed = 'FORCE_FAILED', - ManuallyCancelled = 'MANUALLY_CANCELLED', - NotDistributed = 'NOT_DISTRIBUTED', - PartiallyDistributed = 'PARTIALLY_DISTRIBUTED', - Pending = 'PENDING', - SentToFsp = 'SENT_TO_FSP', - SentToPaymentGateway = 'SENT_TO_PAYMENT_GATEWAY', - TransactionErroneous = 'TRANSACTION_ERRONEOUS', - TransactionSuccessful = 'TRANSACTION_SUCCESSFUL' -} - export type PaymentRecordsAndPaymentsEdges = { __typename?: 'PaymentRecordsAndPaymentsEdges'; cursor?: Maybe; @@ -5472,8 +5027,8 @@ export type PaymentVerificationNode = Node & { id: Scalars['ID']['output']; isManuallyEditable?: Maybe; payment?: Maybe; - paymentContentType: ContentTypeObjectType; - paymentObjectId: Scalars['UUID']['output']; + paymentContentType?: Maybe; + paymentObjectId?: Maybe; paymentVerificationPlan: PaymentVerificationPlanNode; receivedAmount?: Maybe; sentToRapidPro: Scalars['Boolean']['output']; @@ -5532,8 +5087,8 @@ export type PaymentVerificationPlanNode = Node & { marginOfError?: Maybe; notReceivedCount?: Maybe; paymentPlan?: Maybe; - paymentPlanContentType: ContentTypeObjectType; - paymentPlanObjectId: Scalars['UUID']['output']; + paymentPlanContentType?: Maybe; + paymentPlanObjectId?: Maybe; paymentRecordVerifications: PaymentVerificationNodeConnection; rapidProFlowId: Scalars['String']['output']; rapidProFlowStartUuids: Array; @@ -5615,8 +5170,9 @@ export type PaymentVerificationSummaryNode = Node & { completionDate?: Maybe; createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; - paymentPlanContentType: ContentTypeObjectType; - paymentPlanObjectId: Scalars['UUID']['output']; + paymentPlan?: Maybe; + paymentPlanContentType?: Maybe; + paymentPlanObjectId?: Maybe; status: PaymentVerificationSummaryStatus; updatedAt: Scalars['DateTime']['output']; }; @@ -5773,7 +5329,6 @@ export type ProgramNode = Node & { caId?: Maybe; canFinish?: Maybe; cashPlus: Scalars['Boolean']['output']; - cashplanSet: CashPlanNodeConnection; createdAt: Scalars['DateTime']['output']; cycles?: Maybe; dataCollectingType?: Maybe; @@ -5798,7 +5353,6 @@ export type ProgramNode = Node & { partnerAccess: ProgramPartnerAccess; partners?: Maybe>>; paymentSet: PaymentNodeConnection; - paymentplanSet: PaymentPlanNodeConnection; pduFields?: Maybe>>; populationGoal: Scalars['Int']['output']; programmeCode?: Maybe; @@ -5840,15 +5394,6 @@ export type ProgramNodeAdminAreasArgs = { }; -export type ProgramNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type ProgramNodeCyclesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -5928,15 +5473,6 @@ export type ProgramNodePaymentSetArgs = { }; -export type ProgramNodePaymentplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type ProgramNodeRegistrationImportsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -6057,7 +5593,6 @@ export type Query = { allAdminAreas?: Maybe; allAreasTree?: Maybe>>; allBusinessAreas?: Maybe; - allCashPlans?: Maybe; allCashPlansAndPaymentPlans?: Maybe; allCollectorFieldsAttributes?: Maybe>>; allDeliveryMechanisms?: Maybe>>; @@ -6081,7 +5616,6 @@ export type Query = { allMergedHouseholds?: Maybe; allMergedIndividuals?: Maybe; allPaymentPlans?: Maybe; - allPaymentRecords?: Maybe; allPaymentRecordsAndPayments?: Maybe; allPaymentVerificationLogEntries?: Maybe; allPaymentVerificationPlan?: Maybe; @@ -6102,7 +5636,6 @@ export type Query = { businessArea?: Maybe; canRunDeduplication?: Maybe; cashAssistUrlPrefix?: Maybe; - cashPlan?: Maybe; cashPlanStatusChoices?: Maybe>>; cashPlanVerificationSamplingChoices?: Maybe>>; cashPlanVerificationStatusChoices?: Maybe>>; @@ -6163,7 +5696,6 @@ export type Query = { paymentPlan?: Maybe; paymentPlanBackgroundActionStatusChoices?: Maybe>>; paymentPlanStatusChoices?: Maybe>>; - paymentRecord?: Maybe; paymentRecordDeliveryTypeChoices?: Maybe>>; paymentRecordEntitlementCardStatusChoices?: Maybe>>; paymentRecordStatusChoices?: Maybe>>; @@ -6355,31 +5887,6 @@ export type QueryAllBusinessAreasArgs = { }; -export type QueryAllCashPlansArgs = { - after?: InputMaybe; - assistanceThrough?: InputMaybe; - assistanceThrough_Startswith?: InputMaybe; - before?: InputMaybe; - businessArea?: InputMaybe; - deliveryType?: InputMaybe>>; - endDate?: InputMaybe; - endDate_Gte?: InputMaybe; - endDate_Lte?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - orderBy?: InputMaybe; - program?: InputMaybe; - search?: InputMaybe; - serviceProvider_FullName?: InputMaybe; - serviceProvider_FullName_Startswith?: InputMaybe; - startDate?: InputMaybe; - startDate_Gte?: InputMaybe; - startDate_Lte?: InputMaybe; - verificationStatus?: InputMaybe>>; -}; - - export type QueryAllCashPlansAndPaymentPlansArgs = { after?: InputMaybe; before?: InputMaybe; @@ -6670,21 +6177,6 @@ export type QueryAllPaymentPlansArgs = { }; -export type QueryAllPaymentRecordsArgs = { - after?: InputMaybe; - before?: InputMaybe; - businessArea?: InputMaybe; - first?: InputMaybe; - household?: InputMaybe; - individual?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - orderBy?: InputMaybe; - parent?: InputMaybe; - programId?: InputMaybe; -}; - - export type QueryAllPaymentRecordsAndPaymentsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -6938,11 +6430,6 @@ export type QueryBusinessAreaArgs = { }; -export type QueryCashPlanArgs = { - id: Scalars['ID']['input']; -}; - - export type QueryChartGrievancesArgs = { administrativeArea?: InputMaybe; businessAreaSlug: Scalars['String']['input']; @@ -7145,11 +6632,6 @@ export type QueryPaymentPlanArgs = { }; -export type QueryPaymentRecordArgs = { - id: Scalars['ID']['input']; -}; - - export type QueryPaymentRecordVerificationArgs = { id: Scalars['ID']['input']; }; @@ -7690,11 +7172,6 @@ export type RevertMarkPaymentAsFailedMutation = { payment?: Maybe; }; -export type RevertMarkPaymentRecordAsFailedMutation = { - __typename?: 'RevertMarkPaymentRecordAsFailedMutation'; - paymentRecord?: Maybe; -}; - export type RoleChoiceObject = { __typename?: 'RoleChoiceObject'; name?: Maybe; @@ -8038,53 +7515,6 @@ export type SensitiveGrievanceTicketExtras = { paymentRecord?: InputMaybe>>; }; -export type ServiceProviderNode = Node & { - __typename?: 'ServiceProviderNode'; - businessArea: UserBusinessAreaNode; - caId: Scalars['String']['output']; - cashPlans: CashPlanNodeConnection; - country: Scalars['String']['output']; - createdAt: Scalars['DateTime']['output']; - fullName?: Maybe; - id: Scalars['ID']['output']; - paymentrecordSet: PaymentRecordNodeConnection; - shortName?: Maybe; - updatedAt: Scalars['DateTime']['output']; - visionId?: Maybe; -}; - - -export type ServiceProviderNodeCashPlansArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - -export type ServiceProviderNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - -export type ServiceProviderNodeConnection = { - __typename?: 'ServiceProviderNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type ServiceProviderNodeEdge = { - __typename?: 'ServiceProviderNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - export type SetSteficonRuleOnPaymentPlanPaymentListMutation = { __typename?: 'SetSteficonRuleOnPaymentPlanPaymentListMutation'; paymentPlan?: Maybe; @@ -8275,7 +7705,6 @@ export type TargetPopulationNode = Node & { messages: CommunicationMessageNodeConnection; name: Scalars['String']['output']; paymentPlans: PaymentPlanNodeConnection; - paymentRecords: PaymentRecordNodeConnection; program: ProgramNode; programCycle: ProgramCycleNode; selections: Array; @@ -8336,15 +7765,6 @@ export type TargetPopulationNodePaymentPlansArgs = { }; -export type TargetPopulationNodePaymentRecordsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type TargetPopulationNodeSurveysArgs = { after?: InputMaybe; before?: InputMaybe; @@ -8579,6 +7999,7 @@ export type TicketComplaintDetailsNode = Node & { household?: Maybe; id: Scalars['ID']['output']; individual?: Maybe; + payment?: Maybe; paymentContentType?: Maybe; paymentObjectId?: Maybe; paymentRecord?: Maybe; @@ -8903,6 +8324,7 @@ export type TicketSensitiveDetailsNode = Node & { household?: Maybe; id: Scalars['ID']['output']; individual?: Maybe; + payment?: Maybe; paymentContentType?: Maybe; paymentObjectId?: Maybe; paymentRecord?: Maybe; @@ -9106,7 +8528,6 @@ export type UserBusinessAreaNode = Node & { active: Scalars['Boolean']['output']; biometricDeduplicationThreshold: Scalars['Float']['output']; businessAreaPartnerThrough: Array; - cashplanSet: CashPlanNodeConnection; children: UserBusinessAreaNodeConnection; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; @@ -9141,7 +8562,6 @@ export type UserBusinessAreaNode = Node & { partners: Array; paymentSet: PaymentNodeConnection; paymentplanSet: PaymentPlanNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; permissions?: Maybe>>; postponeDeduplication: Scalars['Boolean']['output']; programSet: ProgramNodeConnection; @@ -9155,7 +8575,6 @@ export type UserBusinessAreaNode = Node & { reports: ReportNodeConnection; ruleSet: SteficonRuleNodeConnection; screenBeneficiary: Scalars['Boolean']['output']; - serviceproviderSet: ServiceProviderNodeConnection; slug: Scalars['String']['output']; surveySet: SurveyNodeConnection; targetpopulationSet: TargetPopulationNodeConnection; @@ -9165,15 +8584,6 @@ export type UserBusinessAreaNode = Node & { }; -export type UserBusinessAreaNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeChildrenArgs = { after?: InputMaybe; before?: InputMaybe; @@ -9265,15 +8675,6 @@ export type UserBusinessAreaNodePaymentplanSetArgs = { }; -export type UserBusinessAreaNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeProgramSetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -9311,15 +8712,6 @@ export type UserBusinessAreaNodeRuleSetArgs = { }; -export type UserBusinessAreaNodeServiceproviderSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeSurveySetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -9757,11 +9149,11 @@ export type _TableTotalCashTransferredDataNode = { totalHouseholds?: Maybe; }; -export type GrievanceTicketDetailedFragment = { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null }; +export type GrievanceTicketDetailedFragment = { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null }; export type HouseholdMinimalFragment = { __typename?: 'HouseholdNode', id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, flexFields?: any | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, address: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } }; -export type HouseholdDetailedFragment = { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null }; +export type HouseholdDetailedFragment = { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null }; export type MergedHouseholdMinimalFragment = { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, firstRegistrationDate: any, hasDuplicates?: boolean | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null }; @@ -9771,8 +9163,6 @@ export type IndividualDetailedFragment = { __typename?: 'IndividualNode', givenN export type MergedIndividualMinimalFragment = { __typename?: 'IndividualNode', id: string, unicefId?: string | null, age?: number | null, fullName: string, birthDate: any, sex: IndividualSex, role?: string | null, relationship?: IndividualRelationship | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, fullName?: string | null, score?: number | null, proximityToScore?: number | null, age?: number | null, location?: string | null } | null> | null, deduplicationBatchResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, fullName?: string | null, score?: number | null, proximityToScore?: number | null, age?: number | null, location?: string | null } | null> | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, datahubId?: any | null } }; -export type PaymentRecordDetailsFragment = { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } }; - export type ProgramDetailsFragment = { __typename?: 'ProgramNode', id: string, name: string, programmeCode?: string | null, startDate: any, endDate?: any | null, status: ProgramStatus, caId?: string | null, caHashId?: string | null, description: string, budget?: any | null, frequencyOfPayments: ProgramFrequencyOfPayments, cashPlus: boolean, populationGoal: number, scope?: ProgramScope | null, sector: ProgramSector, totalNumberOfHouseholds?: number | null, totalNumberOfHouseholdsWithTpInProgram?: number | null, administrativeAreasOfImplementation: string, isSocialWorkerProgram?: boolean | null, version: any, adminUrl?: string | null, partnerAccess: ProgramPartnerAccess, targetPopulationsCount?: number | null, canFinish?: boolean | null, dataCollectingType?: { __typename?: 'DataCollectingTypeNode', id: string, code: string, label: string, active: boolean, individualFiltersAvailable: boolean, householdFiltersAvailable: boolean, description: string, type?: DataCollectingTypeType | null } | null, partners?: Array<{ __typename?: 'PartnerNode', id: string, name?: string | null, areaAccess?: string | null, areas?: Array<{ __typename?: 'AreaNode', id: string, level: number } | null> | null } | null> | null, registrationImports: { __typename?: 'RegistrationDataImportNodeConnection', totalCount?: number | null }, pduFields?: Array<{ __typename?: 'PeriodicFieldNode', id: string, label: any, pduData?: { __typename?: 'PeriodicFieldDataNode', id: string, subtype: PeriodicFieldDataSubtype, numberOfRounds: number, roundsNames: Array } | null } | null> | null }; export type RegistrationMinimalFragment = { __typename?: 'RegistrationDataImportNode', id: string, createdAt: any, name: string, status: RegistrationDataImportStatus, erased: boolean, importDate: any, dataSource: RegistrationDataImportDataSource, numberOfHouseholds: number, numberOfIndividuals: number, refuseReason?: string | null, totalHouseholdsCountWithValidPhoneNo?: number | null, adminUrl?: string | null, biometricDeduplicated?: string | null, importedBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, program?: { __typename?: 'ProgramNode', id: string, name: string, startDate: any, endDate?: any | null, status: ProgramStatus } | null }; @@ -9872,7 +9262,7 @@ export type ApproveHouseholdDataChangeMutationVariables = Exact<{ }>; -export type ApproveHouseholdDataChangeMutation = { __typename?: 'Mutations', approveHouseholdDataChange?: { __typename?: 'HouseholdDataChangeApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null } | null } | null }; +export type ApproveHouseholdDataChangeMutation = { __typename?: 'Mutations', approveHouseholdDataChange?: { __typename?: 'HouseholdDataChangeApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null } | null } | null }; export type ApproveIndividualDataChangeMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -9904,7 +9294,7 @@ export type ApproveNeedsAdjudicationMutationVariables = Exact<{ }>; -export type ApproveNeedsAdjudicationMutation = { __typename?: 'Mutations', approveNeedsAdjudication?: { __typename?: 'NeedsAdjudicationApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null } | null } | null }; +export type ApproveNeedsAdjudicationMutation = { __typename?: 'Mutations', approveNeedsAdjudication?: { __typename?: 'NeedsAdjudicationApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null } | null } | null }; export type ApprovePaymentDetailsMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -9978,7 +9368,7 @@ export type GrievanceTicketStatusChangeMutationVariables = Exact<{ }>; -export type GrievanceTicketStatusChangeMutation = { __typename?: 'Mutations', grievanceStatusChange?: { __typename?: 'GrievanceStatusChangeMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null }; +export type GrievanceTicketStatusChangeMutation = { __typename?: 'Mutations', grievanceStatusChange?: { __typename?: 'GrievanceStatusChangeMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null }; export type ReassignRoleGrievanceMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -10184,22 +9574,6 @@ export type InvalidPaymentVerificationPlanMutationVariables = Exact<{ export type InvalidPaymentVerificationPlanMutation = { __typename?: 'Mutations', invalidPaymentVerificationPlan?: { __typename?: 'InvalidPaymentVerificationPlan', paymentPlan?: { __typename?: 'GenericPaymentPlanNode', id?: string | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean } | null } | null> } | null } | null } | null }; -export type MarkPrAsFailedMutationVariables = Exact<{ - paymentRecordId: Scalars['ID']['input']; -}>; - - -export type MarkPrAsFailedMutation = { __typename?: 'Mutations', markPaymentRecordAsFailed?: { __typename?: 'MarkPaymentRecordAsFailedMutation', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null } | null }; - -export type RevertMarkPrAsFailedMutationVariables = Exact<{ - paymentRecordId: Scalars['ID']['input']; - deliveredQuantity: Scalars['Decimal']['input']; - deliveryDate: Scalars['Date']['input']; -}>; - - -export type RevertMarkPrAsFailedMutation = { __typename?: 'Mutations', revertMarkPaymentRecordAsFailed?: { __typename?: 'RevertMarkPaymentRecordAsFailedMutation', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null } | null }; - export type SplitPpMutationVariables = Exact<{ paymentPlanId: Scalars['ID']['input']; splitType: Scalars['String']['input']; @@ -10342,13 +9716,6 @@ export type UploadImportDataXlsxFileAsyncMutationVariables = Exact<{ export type UploadImportDataXlsxFileAsyncMutation = { __typename?: 'Mutations', uploadImportDataXlsxFileAsync?: { __typename?: 'UploadImportDataXLSXFileAsync', errors?: Array<{ __typename?: 'XlsxRowErrorNode', header?: string | null, message?: string | null, rowNumber?: number | null } | null> | null, importData?: { __typename?: 'ImportDataNode', id: string, numberOfIndividuals?: number | null, numberOfHouseholds?: number | null, registrationDataImport?: { __typename?: 'RegistrationDataImportDatahubNode', id: string } | null } | null } | null }; -export type CreateDashboardReportMutationVariables = Exact<{ - reportData: CreateDashboardReportInput; -}>; - - -export type CreateDashboardReportMutation = { __typename?: 'Mutations', createDashboardReport?: { __typename?: 'CreateDashboardReport', success?: boolean | null } | null }; - export type CreateReportMutationVariables = Exact<{ reportData: CreateReportInput; }>; @@ -10765,7 +10132,7 @@ export type GrievanceTicketQueryVariables = Exact<{ }>; -export type GrievanceTicketQuery = { __typename?: 'Query', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null }; +export type GrievanceTicketQuery = { __typename?: 'Query', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, importedIndividualId?: any | null, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email: string, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null }; export type GrievanceTicketFlexFieldsQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -10825,7 +10192,7 @@ export type AllPaymentPlansForTableQueryVariables = Exact<{ }>; -export type AllPaymentPlansForTableQuery = { __typename?: 'Query', allPaymentPlans?: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', cursor: string, node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, name?: string | null, isFollowUp: boolean, status: PaymentPlanStatus, currency: PaymentPlanCurrency, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null } | null } | null> }, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program: { __typename?: 'ProgramNode', id: string, name: string }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } | null }; +export type AllPaymentPlansForTableQuery = { __typename?: 'Query', allPaymentPlans?: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', cursor: string, node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, name?: string | null, isFollowUp: boolean, status: PaymentPlanStatus, currency?: string | null, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null } | null } | null> }, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program?: { __typename?: 'ProgramNode', id: string, name: string } | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } | null }; export type AvailableFspsForDeliveryMechanismsQueryVariables = Exact<{ input: AvailableFspsForDeliveryMechanismsInput; @@ -10839,37 +10206,18 @@ export type PaymentQueryVariables = Exact<{ }>; -export type PaymentQuery = { __typename?: 'Query', payment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, distributionModality?: string | null, status: PaymentStatus, statusDate: any, snapshotCollectorBankName?: string | null, snapshotCollectorBankAccountNumber?: string | null, debitCardNumber?: string | null, debitCardIssuer?: string | null, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, additionalCollectorName?: string | null, additionalDocumentType?: string | null, additionalDocumentNumber?: string | null, reasonForUnsuccessfulPayment?: string | null, snapshotCollectorFullName?: string | null, adminUrl?: string | null, targetPopulation?: { __typename?: 'TargetPopulationNode', id: string, name: string } | null, sourcePayment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, email: string, phoneNo: string, phoneNoValid?: boolean | null, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null }, parent: { __typename?: 'PaymentPlanNode', id: string, status: PaymentPlanStatus, isFollowUp: boolean, unicefId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null }, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, fullName?: string | null } | null } | null }; +export type PaymentQuery = { __typename?: 'Query', payment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, distributionModality?: string | null, status: PaymentStatus, statusDate: any, snapshotCollectorBankName?: string | null, snapshotCollectorBankAccountNumber?: string | null, debitCardNumber?: string | null, debitCardIssuer?: string | null, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, additionalCollectorName?: string | null, additionalDocumentType?: string | null, additionalDocumentNumber?: string | null, reasonForUnsuccessfulPayment?: string | null, snapshotCollectorFullName?: string | null, adminUrl?: string | null, targetPopulation?: { __typename?: 'TargetPopulationNode', id: string, name: string } | null, sourcePayment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, email: string, phoneNo: string, phoneNoValid?: boolean | null, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null }, parent: { __typename?: 'PaymentPlanNode', id: string, status: PaymentPlanStatus, isFollowUp: boolean, unicefId?: string | null, program?: { __typename?: 'ProgramNode', id: string, name: string } | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null }, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, fullName?: string | null } | null } | null }; export type PaymentPlanQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; -export type PaymentPlanQuery = { __typename?: 'Query', paymentPlan?: { __typename?: 'PaymentPlanNode', id: string, version: any, unicefId?: string | null, status: PaymentPlanStatus, canCreateFollowUp?: boolean | null, backgroundActionStatus?: PaymentPlanBackgroundActionStatus | null, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, exchangeRate?: number | null, adminUrl?: string | null, currency: PaymentPlanCurrency, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, totalWithdrawnHouseholdsCount?: number | null, hasPaymentListExportFile?: boolean | null, hasFspDeliveryMechanismXlsxTemplate?: boolean | null, importedFileDate?: any | null, importedFileName?: string | null, totalEntitledQuantityUsd?: number | null, paymentsConflictsCount?: number | null, canSendToPaymentGateway?: boolean | null, canSplit?: boolean | null, exclusionReason: string, excludeHouseholdError: string, isFollowUp: boolean, unsuccessfulPaymentsCount?: number | null, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, approvalProcess: { __typename?: 'ApprovalProcessNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'ApprovalProcessNodeEdge', node?: { __typename?: 'ApprovalProcessNode', id: string, sentForApprovalDate?: any | null, sentForAuthorizationDate?: any | null, sentForFinanceReleaseDate?: any | null, approvalNumberRequired: number, authorizationNumberRequired: number, financeReleaseNumberRequired: number, rejectedOn?: string | null, sentForApprovalBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForAuthorizationBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForFinanceReleaseBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, actions?: { __typename?: 'FilteredActionsListNode', approval?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, authorization?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, financeRelease?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, reject?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null } | null> }, steficonRule?: { __typename?: 'RuleCommitNode', id: string, rule?: { __typename?: 'SteficonRuleNode', id: string, name: string } | null } | null, deliveryMechanisms?: Array<{ __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, code?: string | null, order?: number | null, sentToPaymentGateway: boolean, chosenConfiguration?: string | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string, communicationChannel: FinancialServiceProviderCommunicationChannel, isPaymentGateway?: boolean | null } | null } | null> | null, splitChoices?: Array<{ __typename?: 'ChoiceObject', name?: string | null, value?: string | null } | null> | null, volumeByDeliveryMechanism?: Array<{ __typename?: 'VolumeByDeliveryMechanismNode', volume?: number | null, volumeUsd?: number | null, deliveryMechanism?: { __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, order?: number | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentNodeEdge', node?: { __typename?: 'PaymentNode', id: string, status: PaymentStatus } | null } | null> }, reconciliationSummary?: { __typename?: 'ReconciliationSummaryNode', deliveredFully?: number | null, deliveredPartially?: number | null, notDelivered?: number | null, unsuccessful?: number | null, pending?: number | null, numberOfPayments?: number | null, reconciled?: number | null } | null, excludedHouseholds?: Array<{ __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null> | null, excludedIndividuals?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null } | null> | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, createdAt: any, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null } } | null } | null> }, sourcePaymentPlan?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null } | null, supportingDocuments?: Array<{ __typename?: 'PaymentPlanSupportingDocumentNode', id: string, title: string, file: string } | null> | null } | null }; +export type PaymentPlanQuery = { __typename?: 'Query', paymentPlan?: { __typename?: 'PaymentPlanNode', id: string, version: any, unicefId?: string | null, status: PaymentPlanStatus, canCreateFollowUp?: boolean | null, backgroundActionStatus?: PaymentPlanBackgroundActionStatus | null, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, exchangeRate?: number | null, adminUrl?: string | null, currency?: string | null, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, totalWithdrawnHouseholdsCount?: number | null, hasPaymentListExportFile?: boolean | null, hasFspDeliveryMechanismXlsxTemplate?: boolean | null, importedFileDate?: any | null, importedFileName?: string | null, totalEntitledQuantityUsd?: number | null, paymentsConflictsCount?: number | null, canSendToPaymentGateway?: boolean | null, canSplit?: boolean | null, exclusionReason: string, excludeHouseholdError: string, isFollowUp: boolean, unsuccessfulPaymentsCount?: number | null, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program?: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null } | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, approvalProcess: { __typename?: 'ApprovalProcessNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'ApprovalProcessNodeEdge', node?: { __typename?: 'ApprovalProcessNode', id: string, sentForApprovalDate?: any | null, sentForAuthorizationDate?: any | null, sentForFinanceReleaseDate?: any | null, approvalNumberRequired: number, authorizationNumberRequired: number, financeReleaseNumberRequired: number, rejectedOn?: string | null, sentForApprovalBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForAuthorizationBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForFinanceReleaseBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, actions?: { __typename?: 'FilteredActionsListNode', approval?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, authorization?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, financeRelease?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, reject?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null } | null> }, steficonRule?: { __typename?: 'RuleCommitNode', id: string, rule?: { __typename?: 'SteficonRuleNode', id: string, name: string } | null } | null, deliveryMechanisms?: Array<{ __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, code?: string | null, order?: number | null, sentToPaymentGateway: boolean, chosenConfiguration?: string | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string, communicationChannel: FinancialServiceProviderCommunicationChannel, isPaymentGateway?: boolean | null } | null } | null> | null, splitChoices?: Array<{ __typename?: 'ChoiceObject', name?: string | null, value?: string | null } | null> | null, volumeByDeliveryMechanism?: Array<{ __typename?: 'VolumeByDeliveryMechanismNode', volume?: number | null, volumeUsd?: number | null, deliveryMechanism?: { __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, order?: number | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentNodeEdge', node?: { __typename?: 'PaymentNode', id: string, status: PaymentStatus } | null } | null> }, reconciliationSummary?: { __typename?: 'ReconciliationSummaryNode', deliveredFully?: number | null, deliveredPartially?: number | null, notDelivered?: number | null, unsuccessful?: number | null, pending?: number | null, numberOfPayments?: number | null, reconciled?: number | null } | null, excludedHouseholds?: Array<{ __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null> | null, excludedIndividuals?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null } | null> | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, createdAt: any, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null } } | null } | null> }, sourcePaymentPlan?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null } | null, supportingDocuments?: Array<{ __typename?: 'PaymentPlanSupportingDocumentNode', id: string, title: string, file: string } | null> | null } | null }; -export type AllCashPlansQueryVariables = Exact<{ - program?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - orderBy?: InputMaybe; - search?: InputMaybe; - serviceProvider?: InputMaybe; - deliveryType?: InputMaybe> | InputMaybe>; - verificationStatus?: InputMaybe> | InputMaybe>; - startDateGte?: InputMaybe; - endDateLte?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type AllCashPlansQuery = { __typename?: 'Query', allCashPlans?: { __typename?: 'CashPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'CashPlanNodeEdge', cursor: string, node?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, assistanceThrough: string, totalNumberOfHouseholds?: number | null, deliveryType?: string | null, startDate?: any | null, endDate?: any | null, totalPersonsCovered: number, dispersionDate: any, assistanceMeasurement: string, status: CashPlanStatus, currency?: string | null, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, updatedAt: any, serviceProvider?: { __typename?: 'ServiceProviderNode', id: string, caId: string, fullName?: string | null } | null, program: { __typename?: 'ProgramNode', id: string, name: string }, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, status: PaymentVerificationSummaryStatus } | null } | null } | null> } | null }; - -export type AllCashPlansAndPaymentPlansQueryVariables = Exact<{ - businessArea: Scalars['String']['input']; - program?: InputMaybe; +export type AllCashPlansAndPaymentPlansQueryVariables = Exact<{ + businessArea: Scalars['String']['input']; + program?: InputMaybe; search?: InputMaybe; serviceProvider?: InputMaybe; deliveryType?: InputMaybe> | InputMaybe>; @@ -10887,20 +10235,6 @@ export type AllCashPlansAndPaymentPlansQueryVariables = Exact<{ export type AllCashPlansAndPaymentPlansQuery = { __typename?: 'Query', allCashPlansAndPaymentPlans?: { __typename?: 'PaginatedCashPlanAndPaymentPlanNode', totalCount?: number | null, pageInfo?: { __typename?: 'PageInfoNode', startCursor?: string | null, endCursor?: string | null, hasNextPage?: boolean | null, hasPreviousPage?: boolean | null } | null, edges?: Array<{ __typename?: 'CashPlanAndPaymentPlanEdges', cursor?: string | null, node?: { __typename?: 'CashPlanAndPaymentPlanNode', objType?: string | null, id?: string | null, unicefId?: string | null, verificationStatus?: string | null, status?: string | null, currency?: string | null, totalDeliveredQuantity?: number | null, startDate?: string | null, endDate?: string | null, programName?: string | null, updatedAt?: string | null, totalNumberOfHouseholds?: number | null, assistanceMeasurement?: string | null, totalEntitledQuantity?: number | null, totalUndeliveredQuantity?: number | null, dispersionDate?: string | null, serviceProviderFullName?: string | null, verificationPlans?: Array<{ __typename?: 'PaymentVerificationPlanNode', id: string, createdAt: any, unicefId?: string | null } | null> | null } | null } | null> | null } | null }; -export type AllPaymentRecordsQueryVariables = Exact<{ - parent?: InputMaybe; - household?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type AllPaymentRecordsQuery = { __typename?: 'Query', allPaymentRecords?: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', cursor: string, node?: { __typename?: 'PaymentRecordNode', id: string, createdAt: any, updatedAt: any, fullName: string, statusDate: any, status: PaymentRecordStatus, caId?: string | null, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string } | null, parent?: { __typename?: 'CashPlanNode', id: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> } | null }; - export type AllPaymentRecordsAndPaymentsQueryVariables = Exact<{ household?: InputMaybe; after?: InputMaybe; @@ -10927,13 +10261,6 @@ export type AllPaymentsForTableQueryVariables = Exact<{ export type AllPaymentsForTableQuery = { __typename?: 'Query', allPayments?: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentNodeEdge', cursor: string, node?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, status: PaymentStatus, entitlementQuantity?: number | null, entitlementQuantityUsd?: number | null, currency: string, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, paymentPlanHardConflicted?: boolean | null, paymentPlanSoftConflicted?: boolean | null, fspAuthCode?: string | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string } | null } | null> } | null }, paymentPlanHardConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, paymentPlanSoftConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, financialServiceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> } | null }; -export type CashPlanQueryVariables = Exact<{ - id: Scalars['ID']['input']; -}>; - - -export type CashPlanQuery = { __typename?: 'Query', cashPlan?: { __typename?: 'CashPlanNode', id: string, version: any, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, name: string, startDate?: any | null, endDate?: any | null, updatedAt: any, status: CashPlanStatus, deliveryType?: string | null, fundsCommitment?: string | null, downPayment?: string | null, dispersionDate: any, assistanceThrough: string, caId?: string | null, caHashId?: any | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, totalNumberOfHouseholds?: number | null, serviceProvider?: { __typename?: 'ServiceProviderNode', id: string, caId: string, fullName?: string | null } | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, program: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null }, paymentItems: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } } | null }; - export type IndividualPhotosQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; @@ -10948,27 +10275,6 @@ export type ImportedIndividualPhotosQueryVariables = Exact<{ export type ImportedIndividualPhotosQuery = { __typename?: 'Query', importedIndividual?: { __typename?: 'ImportedIndividualNode', id: string, photo: string, documents?: { __typename?: 'ImportedDocumentNodeConnection', edges: Array<{ __typename?: 'ImportedDocumentNodeEdge', node?: { __typename?: 'ImportedDocumentNode', id: string, photo?: string | null } | null } | null> } | null } | null }; -export type LookUpPaymentRecordsQueryVariables = Exact<{ - parent?: InputMaybe; - household?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type LookUpPaymentRecordsQuery = { __typename?: 'Query', allPaymentRecords?: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', cursor: string, node?: { __typename?: 'PaymentRecordNode', id: string, caId?: string | null, deliveredQuantity?: number | null, parent?: { __typename?: 'CashPlanNode', id: string, name: string } | null } | null } | null> } | null }; - -export type PaymentRecordQueryVariables = Exact<{ - id: Scalars['ID']['input']; -}>; - - -export type PaymentRecordQuery = { __typename?: 'Query', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, parent?: { __typename?: 'CashPlanNode', id: string, unicefId?: string | null, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null }; - export type AllPaymentVerificationLogEntriesQueryVariables = Exact<{ businessArea: Scalars['String']['input']; objectId?: InputMaybe; @@ -11159,7 +10465,7 @@ export type HouseholdQueryVariables = Exact<{ }>; -export type HouseholdQuery = { __typename?: 'Query', household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null }; +export type HouseholdQuery = { __typename?: 'Query', household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email: string, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> }, identities: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> }, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null }; export type HouseholdChoiceDataQueryVariables = Exact<{ [key: string]: never; }>; @@ -12015,24 +11321,6 @@ export const HouseholdDetailedFragmentDoc = gql` username } } - paymentrecordSet { - edges { - node { - id - fullName - parent { - id - totalPersonsCovered - program { - id - name - } - totalDeliveredQuantity - assistanceMeasurement - } - } - } - } flexFields deliveredQuantities { totalDeliveredQuantity @@ -12541,75 +11829,6 @@ export const MergedIndividualMinimalFragmentDoc = gql` } } `; -export const PaymentRecordDetailsFragmentDoc = gql` - fragment paymentRecordDetails on PaymentRecordNode { - id - status - statusDate - caId - caHashId - registrationCaId - verification { - id - status - statusDate - receivedAmount - } - household { - id - status - size - unicefId - headOfHousehold { - id - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - } - } - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - parent { - id - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } - } - } - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - deliveryType { - name - } - entitlementCardIssueDate - entitlementCardNumber - transactionReferenceId - serviceProvider { - id - fullName - shortName - } -} - `; export const ProgramDetailsFragmentDoc = gql` fragment programDetails on ProgramNode { id @@ -15349,82 +14568,6 @@ export function useInvalidPaymentVerificationPlanMutation(baseOptions?: Apollo.M export type InvalidPaymentVerificationPlanMutationHookResult = ReturnType; export type InvalidPaymentVerificationPlanMutationResult = Apollo.MutationResult; export type InvalidPaymentVerificationPlanMutationOptions = Apollo.BaseMutationOptions; -export const MarkPrAsFailedDocument = gql` - mutation markPRAsFailed($paymentRecordId: ID!) { - markPaymentRecordAsFailed(paymentRecordId: $paymentRecordId) { - paymentRecord { - ...paymentRecordDetails - } - } -} - ${PaymentRecordDetailsFragmentDoc}`; -export type MarkPrAsFailedMutationFn = Apollo.MutationFunction; - -/** - * __useMarkPrAsFailedMutation__ - * - * To run a mutation, you first call `useMarkPrAsFailedMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useMarkPrAsFailedMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [markPrAsFailedMutation, { data, loading, error }] = useMarkPrAsFailedMutation({ - * variables: { - * paymentRecordId: // value for 'paymentRecordId' - * }, - * }); - */ -export function useMarkPrAsFailedMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(MarkPrAsFailedDocument, options); - } -export type MarkPrAsFailedMutationHookResult = ReturnType; -export type MarkPrAsFailedMutationResult = Apollo.MutationResult; -export type MarkPrAsFailedMutationOptions = Apollo.BaseMutationOptions; -export const RevertMarkPrAsFailedDocument = gql` - mutation revertMarkPRAsFailed($paymentRecordId: ID!, $deliveredQuantity: Decimal!, $deliveryDate: Date!) { - revertMarkPaymentRecordAsFailed( - paymentRecordId: $paymentRecordId - deliveredQuantity: $deliveredQuantity - deliveryDate: $deliveryDate - ) { - paymentRecord { - ...paymentRecordDetails - } - } -} - ${PaymentRecordDetailsFragmentDoc}`; -export type RevertMarkPrAsFailedMutationFn = Apollo.MutationFunction; - -/** - * __useRevertMarkPrAsFailedMutation__ - * - * To run a mutation, you first call `useRevertMarkPrAsFailedMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useRevertMarkPrAsFailedMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [revertMarkPrAsFailedMutation, { data, loading, error }] = useRevertMarkPrAsFailedMutation({ - * variables: { - * paymentRecordId: // value for 'paymentRecordId' - * deliveredQuantity: // value for 'deliveredQuantity' - * deliveryDate: // value for 'deliveryDate' - * }, - * }); - */ -export function useRevertMarkPrAsFailedMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(RevertMarkPrAsFailedDocument, options); - } -export type RevertMarkPrAsFailedMutationHookResult = ReturnType; -export type RevertMarkPrAsFailedMutationResult = Apollo.MutationResult; -export type RevertMarkPrAsFailedMutationOptions = Apollo.BaseMutationOptions; export const SplitPpDocument = gql` mutation SplitPP($paymentPlanId: ID!, $splitType: String!, $paymentsNo: Int!) { splitPaymentPlan( @@ -16136,39 +15279,6 @@ export function useUploadImportDataXlsxFileAsyncMutation(baseOptions?: Apollo.Mu export type UploadImportDataXlsxFileAsyncMutationHookResult = ReturnType; export type UploadImportDataXlsxFileAsyncMutationResult = Apollo.MutationResult; export type UploadImportDataXlsxFileAsyncMutationOptions = Apollo.BaseMutationOptions; -export const CreateDashboardReportDocument = gql` - mutation CreateDashboardReport($reportData: CreateDashboardReportInput!) { - createDashboardReport(reportData: $reportData) { - success - } -} - `; -export type CreateDashboardReportMutationFn = Apollo.MutationFunction; - -/** - * __useCreateDashboardReportMutation__ - * - * To run a mutation, you first call `useCreateDashboardReportMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useCreateDashboardReportMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [createDashboardReportMutation, { data, loading, error }] = useCreateDashboardReportMutation({ - * variables: { - * reportData: // value for 'reportData' - * }, - * }); - */ -export function useCreateDashboardReportMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(CreateDashboardReportDocument, options); - } -export type CreateDashboardReportMutationHookResult = ReturnType; -export type CreateDashboardReportMutationResult = Apollo.MutationResult; -export type CreateDashboardReportMutationOptions = Apollo.BaseMutationOptions; export const CreateReportDocument = gql` mutation CreateReport($reportData: CreateReportInput!) { createReport(reportData: $reportData) { @@ -19779,112 +18889,6 @@ export type PaymentPlanQueryHookResult = ReturnType; export type PaymentPlanLazyQueryHookResult = ReturnType; export type PaymentPlanSuspenseQueryHookResult = ReturnType; export type PaymentPlanQueryResult = Apollo.QueryResult; -export const AllCashPlansDocument = gql` - query AllCashPlans($program: ID, $after: String, $before: String, $first: Int, $last: Int, $orderBy: String, $search: String, $serviceProvider: String, $deliveryType: [String], $verificationStatus: [String], $startDateGte: DateTime, $endDateLte: DateTime, $businessArea: String) { - allCashPlans( - program: $program - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - search: $search - serviceProvider_FullName_Startswith: $serviceProvider - deliveryType: $deliveryType - verificationStatus: $verificationStatus - startDate_Gte: $startDateGte - endDate_Lte: $endDateLte - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - totalCount - edges { - cursor - node { - id - caId - assistanceThrough - totalNumberOfHouseholds - serviceProvider { - id - caId - fullName - } - deliveryType - startDate - endDate - program { - id - name - } - totalPersonsCovered - dispersionDate - assistanceMeasurement - status - currency - totalEntitledQuantity - totalDeliveredQuantity - totalUndeliveredQuantity - updatedAt - paymentVerificationSummary { - id - status - } - } - } - } -} - `; - -/** - * __useAllCashPlansQuery__ - * - * To run a query within a React component, call `useAllCashPlansQuery` and pass it any options that fit your needs. - * When your component renders, `useAllCashPlansQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAllCashPlansQuery({ - * variables: { - * program: // value for 'program' - * after: // value for 'after' - * before: // value for 'before' - * first: // value for 'first' - * last: // value for 'last' - * orderBy: // value for 'orderBy' - * search: // value for 'search' - * serviceProvider: // value for 'serviceProvider' - * deliveryType: // value for 'deliveryType' - * verificationStatus: // value for 'verificationStatus' - * startDateGte: // value for 'startDateGte' - * endDateLte: // value for 'endDateLte' - * businessArea: // value for 'businessArea' - * }, - * }); - */ -export function useAllCashPlansQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AllCashPlansDocument, options); - } -export function useAllCashPlansLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AllCashPlansDocument, options); - } -export function useAllCashPlansSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(AllCashPlansDocument, options); - } -export type AllCashPlansQueryHookResult = ReturnType; -export type AllCashPlansLazyQueryHookResult = ReturnType; -export type AllCashPlansSuspenseQueryHookResult = ReturnType; -export type AllCashPlansQueryResult = Apollo.QueryResult; export const AllCashPlansAndPaymentPlansDocument = gql` query allCashPlansAndPaymentPlans($businessArea: String!, $program: String, $search: String, $serviceProvider: String, $deliveryType: [String], $verificationStatus: [String], $startDateGte: String, $endDateLte: String, $orderBy: String, $first: Int, $last: Int, $before: String, $after: String, $isPaymentVerificationPage: Boolean) { allCashPlansAndPaymentPlans( @@ -19986,103 +18990,6 @@ export type AllCashPlansAndPaymentPlansQueryHookResult = ReturnType; export type AllCashPlansAndPaymentPlansSuspenseQueryHookResult = ReturnType; export type AllCashPlansAndPaymentPlansQueryResult = Apollo.QueryResult; -export const AllPaymentRecordsDocument = gql` - query AllPaymentRecords($parent: ID, $household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - createdAt - updatedAt - fullName - statusDate - status - caId - totalPersonsCovered - household { - id - unicefId - size - } - headOfHousehold { - id - fullName - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - parent { - id - program { - id - name - } - } - } - } - totalCount - edgeCount - } -} - `; - -/** - * __useAllPaymentRecordsQuery__ - * - * To run a query within a React component, call `useAllPaymentRecordsQuery` and pass it any options that fit your needs. - * When your component renders, `useAllPaymentRecordsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAllPaymentRecordsQuery({ - * variables: { - * parent: // value for 'parent' - * household: // value for 'household' - * after: // value for 'after' - * before: // value for 'before' - * orderBy: // value for 'orderBy' - * first: // value for 'first' - * last: // value for 'last' - * businessArea: // value for 'businessArea' - * }, - * }); - */ -export function useAllPaymentRecordsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AllPaymentRecordsDocument, options); - } -export function useAllPaymentRecordsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AllPaymentRecordsDocument, options); - } -export function useAllPaymentRecordsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(AllPaymentRecordsDocument, options); - } -export type AllPaymentRecordsQueryHookResult = ReturnType; -export type AllPaymentRecordsLazyQueryHookResult = ReturnType; -export type AllPaymentRecordsSuspenseQueryHookResult = ReturnType; -export type AllPaymentRecordsQueryResult = Apollo.QueryResult; export const AllPaymentRecordsAndPaymentsDocument = gql` query AllPaymentRecordsAndPayments($household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String!) { allPaymentRecordsAndPayments( @@ -20286,130 +19193,7 @@ export function useAllPaymentsForTableSuspenseQuery(baseOptions?: Apollo.SkipTok export type AllPaymentsForTableQueryHookResult = ReturnType; export type AllPaymentsForTableLazyQueryHookResult = ReturnType; export type AllPaymentsForTableSuspenseQueryHookResult = ReturnType; -export type AllPaymentsForTableQueryResult = Apollo.QueryResult; -export const CashPlanDocument = gql` - query CashPlan($id: ID!) { - cashPlan(id: $id) { - id - version - canCreatePaymentVerificationPlan - availablePaymentRecordsCount - name - startDate - endDate - updatedAt - status - deliveryType - fundsCommitment - downPayment - dispersionDate - assistanceThrough - serviceProvider { - id - caId - fullName - } - caId - caHashId - dispersionDate - bankReconciliationSuccess - bankReconciliationError - totalNumberOfHouseholds - verificationPlans { - totalCount - edges { - node { - id - unicefId - adminUrl - status - sampleSize - receivedCount - notReceivedCount - respondedCount - verificationChannel - sampling - receivedCount - receivedWithProblemsCount - rapidProFlowId - confidenceInterval - marginOfError - activationDate - completionDate - ageFilter { - min - max - } - excludedAdminAreasFilter - sexFilter - xlsxFileExporting - hasXlsxFile - xlsxFileWasDownloaded - xlsxFileImported - } - } - } - paymentVerificationSummary { - id - createdAt - updatedAt - status - activationDate - completionDate - } - program { - id - name - caId - } - paymentItems { - totalCount - edgeCount - edges { - node { - targetPopulation { - id - name - } - } - } - } - } -} - `; - -/** - * __useCashPlanQuery__ - * - * To run a query within a React component, call `useCashPlanQuery` and pass it any options that fit your needs. - * When your component renders, `useCashPlanQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useCashPlanQuery({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function useCashPlanQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: CashPlanQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(CashPlanDocument, options); - } -export function useCashPlanLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(CashPlanDocument, options); - } -export function useCashPlanSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(CashPlanDocument, options); - } -export type CashPlanQueryHookResult = ReturnType; -export type CashPlanLazyQueryHookResult = ReturnType; -export type CashPlanSuspenseQueryHookResult = ReturnType; -export type CashPlanQueryResult = Apollo.QueryResult; +export type AllPaymentsForTableQueryResult = Apollo.QueryResult; export const IndividualPhotosDocument = gql` query IndividualPhotos($id: ID!) { individual(id: $id) { @@ -20509,190 +19293,6 @@ export type ImportedIndividualPhotosQueryHookResult = ReturnType; export type ImportedIndividualPhotosSuspenseQueryHookResult = ReturnType; export type ImportedIndividualPhotosQueryResult = Apollo.QueryResult; -export const LookUpPaymentRecordsDocument = gql` - query LookUpPaymentRecords($parent: ID, $household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - caId - parent { - id - name - } - deliveredQuantity - } - } - totalCount - edgeCount - } -} - `; - -/** - * __useLookUpPaymentRecordsQuery__ - * - * To run a query within a React component, call `useLookUpPaymentRecordsQuery` and pass it any options that fit your needs. - * When your component renders, `useLookUpPaymentRecordsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useLookUpPaymentRecordsQuery({ - * variables: { - * parent: // value for 'parent' - * household: // value for 'household' - * after: // value for 'after' - * before: // value for 'before' - * orderBy: // value for 'orderBy' - * first: // value for 'first' - * last: // value for 'last' - * businessArea: // value for 'businessArea' - * }, - * }); - */ -export function useLookUpPaymentRecordsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(LookUpPaymentRecordsDocument, options); - } -export function useLookUpPaymentRecordsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(LookUpPaymentRecordsDocument, options); - } -export function useLookUpPaymentRecordsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(LookUpPaymentRecordsDocument, options); - } -export type LookUpPaymentRecordsQueryHookResult = ReturnType; -export type LookUpPaymentRecordsLazyQueryHookResult = ReturnType; -export type LookUpPaymentRecordsSuspenseQueryHookResult = ReturnType; -export type LookUpPaymentRecordsQueryResult = Apollo.QueryResult; -export const PaymentRecordDocument = gql` - query PaymentRecord($id: ID!) { - paymentRecord(id: $id) { - id - status - statusDate - caId - caHashId - registrationCaId - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - verification { - id - status - statusDate - receivedAmount - isManuallyEditable - adminUrl - } - currency - entitlementQuantity - deliveredQuantity - deliveryDate - entitlementCardIssueDate - entitlementCardNumber - household { - id - size - status - unicefId - headOfHousehold { - id - unicefId - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - fullName - } - } - parent { - id - unicefId - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } - } - } - } - deliveredQuantityUsd - deliveryType { - name - } - transactionReferenceId - serviceProvider { - id - fullName - shortName - } - } -} - `; - -/** - * __usePaymentRecordQuery__ - * - * To run a query within a React component, call `usePaymentRecordQuery` and pass it any options that fit your needs. - * When your component renders, `usePaymentRecordQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = usePaymentRecordQuery({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function usePaymentRecordQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: PaymentRecordQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PaymentRecordDocument, options); - } -export function usePaymentRecordLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PaymentRecordDocument, options); - } -export function usePaymentRecordSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(PaymentRecordDocument, options); - } -export type PaymentRecordQueryHookResult = ReturnType; -export type PaymentRecordLazyQueryHookResult = ReturnType; -export type PaymentRecordSuspenseQueryHookResult = ReturnType; -export type PaymentRecordQueryResult = Apollo.QueryResult; export const AllPaymentVerificationLogEntriesDocument = gql` query AllPaymentVerificationLogEntries($businessArea: String!, $objectId: UUID, $objectType: String, $after: String, $before: String, $first: Int, $last: Int, $search: String, $module: String) { allPaymentVerificationLogEntries( @@ -24877,7 +23477,7 @@ export type DirectiveResolverFn> = { - Node: ( ApprovalProcessNode ) | ( AreaNode ) | ( AreaTypeNode ) | ( BankAccountInfoNode ) | ( BusinessAreaNode ) | ( CashPlanNode ) | ( CommunicationMessageNode ) | ( CommunicationMessageRecipientMapNode ) | ( DataCollectingTypeNode ) | ( DeliveryMechanismDataNode ) | ( DeliveryMechanismNode ) | ( DeliveryMechanismPerPaymentPlanNode ) | ( DocumentNode ) | ( FeedbackMessageNode ) | ( FeedbackNode ) | ( FinancialServiceProviderNode ) | ( FinancialServiceProviderXlsxTemplateNode ) | ( GrievanceDocumentNode ) | ( GrievanceTicketNode ) | ( HouseholdNode ) | ( ImportDataNode ) | ( ImportedDocumentNode ) | ( ImportedHouseholdNode ) | ( ImportedIndividualIdentityNode ) | ( ImportedIndividualNode ) | ( IndividualIdentityNode ) | ( IndividualNode ) | ( KoboImportDataNode ) | ( LogEntryNode ) | ( PaymentHouseholdSnapshotNode ) | ( PaymentNode ) | ( PaymentPlanNode ) | ( PaymentPlanSupportingDocumentNode ) | ( PaymentRecordNode ) | ( PaymentVerificationLogEntryNode ) | ( PaymentVerificationNode ) | ( PaymentVerificationPlanNode ) | ( PaymentVerificationSummaryNode ) | ( PeriodicFieldNode ) | ( ProgramCycleNode ) | ( ProgramNode ) | ( RecipientNode ) | ( RegistrationDataImportDatahubNode ) | ( RegistrationDataImportNode ) | ( ReportNode ) | ( RuleCommitNode ) | ( SanctionListIndividualAliasNameNode ) | ( SanctionListIndividualCountriesNode ) | ( SanctionListIndividualDateOfBirthNode ) | ( SanctionListIndividualDocumentNode ) | ( SanctionListIndividualNationalitiesNode ) | ( SanctionListIndividualNode ) | ( ServiceProviderNode ) | ( SteficonRuleNode ) | ( SurveyNode ) | ( TargetPopulationNode ) | ( TicketAddIndividualDetailsNode ) | ( TicketComplaintDetailsNode ) | ( TicketDeleteHouseholdDetailsNode ) | ( TicketDeleteIndividualDetailsNode ) | ( TicketHouseholdDataUpdateDetailsNode ) | ( TicketIndividualDataUpdateDetailsNode ) | ( TicketNeedsAdjudicationDetailsNode ) | ( TicketNegativeFeedbackDetailsNode ) | ( TicketNoteNode ) | ( TicketPaymentVerificationDetailsNode ) | ( TicketPositiveFeedbackDetailsNode ) | ( TicketReferralDetailsNode ) | ( TicketSensitiveDetailsNode ) | ( TicketSystemFlaggingDetailsNode ) | ( UserBusinessAreaNode ) | ( UserNode ) | ( VolumeByDeliveryMechanismNode ); + Node: ( ApprovalProcessNode ) | ( AreaNode ) | ( AreaTypeNode ) | ( BankAccountInfoNode ) | ( BusinessAreaNode ) | ( CommunicationMessageNode ) | ( CommunicationMessageRecipientMapNode ) | ( DataCollectingTypeNode ) | ( DeliveryMechanismDataNode ) | ( DeliveryMechanismNode ) | ( DeliveryMechanismPerPaymentPlanNode ) | ( DocumentNode ) | ( FeedbackMessageNode ) | ( FeedbackNode ) | ( FinancialServiceProviderNode ) | ( FinancialServiceProviderXlsxTemplateNode ) | ( GrievanceDocumentNode ) | ( GrievanceTicketNode ) | ( HouseholdNode ) | ( ImportDataNode ) | ( ImportedDocumentNode ) | ( ImportedHouseholdNode ) | ( ImportedIndividualIdentityNode ) | ( ImportedIndividualNode ) | ( IndividualIdentityNode ) | ( IndividualNode ) | ( KoboImportDataNode ) | ( LogEntryNode ) | ( PaymentHouseholdSnapshotNode ) | ( PaymentNode ) | ( PaymentPlanNode ) | ( PaymentPlanSupportingDocumentNode ) | ( PaymentVerificationLogEntryNode ) | ( PaymentVerificationNode ) | ( PaymentVerificationPlanNode ) | ( PaymentVerificationSummaryNode ) | ( PeriodicFieldNode ) | ( ProgramCycleNode ) | ( ProgramNode ) | ( RecipientNode ) | ( RegistrationDataImportDatahubNode ) | ( RegistrationDataImportNode ) | ( ReportNode ) | ( RuleCommitNode ) | ( SanctionListIndividualAliasNameNode ) | ( SanctionListIndividualCountriesNode ) | ( SanctionListIndividualDateOfBirthNode ) | ( SanctionListIndividualDocumentNode ) | ( SanctionListIndividualNationalitiesNode ) | ( SanctionListIndividualNode ) | ( SteficonRuleNode ) | ( SurveyNode ) | ( TargetPopulationNode ) | ( TicketAddIndividualDetailsNode ) | ( TicketComplaintDetailsNode ) | ( TicketDeleteHouseholdDetailsNode ) | ( TicketDeleteIndividualDetailsNode ) | ( TicketHouseholdDataUpdateDetailsNode ) | ( TicketIndividualDataUpdateDetailsNode ) | ( TicketNeedsAdjudicationDetailsNode ) | ( TicketNegativeFeedbackDetailsNode ) | ( TicketNoteNode ) | ( TicketPaymentVerificationDetailsNode ) | ( TicketPositiveFeedbackDetailsNode ) | ( TicketReferralDetailsNode ) | ( TicketSensitiveDetailsNode ) | ( TicketSystemFlaggingDetailsNode ) | ( UserBusinessAreaNode ) | ( UserNode ) | ( VolumeByDeliveryMechanismNode ); }; /** Mapping between all available schema types and the resolvers types */ @@ -24926,10 +23526,6 @@ export type ResolversTypes = { BusinessAreaNodeEdge: ResolverTypeWrapper; CashPlanAndPaymentPlanEdges: ResolverTypeWrapper; CashPlanAndPaymentPlanNode: ResolverTypeWrapper; - CashPlanNode: ResolverTypeWrapper; - CashPlanNodeConnection: ResolverTypeWrapper; - CashPlanNodeEdge: ResolverTypeWrapper; - CashPlanStatus: CashPlanStatus; CategoryExtrasInput: CategoryExtrasInput; ChartDatasetNode: ResolverTypeWrapper; ChartDetailedDatasetsNode: ResolverTypeWrapper; @@ -24956,8 +23552,6 @@ export type ResolversTypes = { CountAndPercentageNode: ResolverTypeWrapper; CreateAccountabilityCommunicationMessageInput: CreateAccountabilityCommunicationMessageInput; CreateCommunicationMessageMutation: ResolverTypeWrapper; - CreateDashboardReport: ResolverTypeWrapper; - CreateDashboardReportInput: CreateDashboardReportInput; CreateFeedbackInput: CreateFeedbackInput; CreateFeedbackMessageInput: CreateFeedbackMessageInput; CreateFeedbackMessageMutation: ResolverTypeWrapper; @@ -25156,7 +23750,6 @@ export type ResolversTypes = { LogEntryNodeConnection: ResolverTypeWrapper; LogEntryNodeEdge: ResolverTypeWrapper; MarkPaymentAsFailedMutation: ResolverTypeWrapper; - MarkPaymentRecordAsFailedMutation: ResolverTypeWrapper; MergeRegistrationDataImportMutation: ResolverTypeWrapper; MessageSamplingType: MessageSamplingType; Mutations: ResolverTypeWrapper<{}>; @@ -25173,14 +23766,12 @@ export type ResolversTypes = { PartnerRoleNode: ResolverTypeWrapper; PartnerType: ResolverTypeWrapper; PaymentConflictDataNode: ResolverTypeWrapper; - PaymentDeliveryTypeChoice: PaymentDeliveryTypeChoice; PaymentDetailsApproveMutation: ResolverTypeWrapper; PaymentHouseholdSnapshotNode: ResolverTypeWrapper; PaymentNode: ResolverTypeWrapper; PaymentNodeConnection: ResolverTypeWrapper; PaymentNodeEdge: ResolverTypeWrapper; PaymentPlanBackgroundActionStatus: PaymentPlanBackgroundActionStatus; - PaymentPlanCurrency: PaymentPlanCurrency; PaymentPlanNode: ResolverTypeWrapper; PaymentPlanNodeConnection: ResolverTypeWrapper; PaymentPlanNodeEdge: ResolverTypeWrapper; @@ -25189,12 +23780,6 @@ export type ResolversTypes = { PaymentPlanSupportingDocumentNodeConnection: ResolverTypeWrapper; PaymentPlanSupportingDocumentNodeEdge: ResolverTypeWrapper; PaymentRecordAndPaymentNode: ResolverTypeWrapper; - PaymentRecordDeliveryTypeChoice: PaymentRecordDeliveryTypeChoice; - PaymentRecordEntitlementCardStatus: PaymentRecordEntitlementCardStatus; - PaymentRecordNode: ResolverTypeWrapper; - PaymentRecordNodeConnection: ResolverTypeWrapper; - PaymentRecordNodeEdge: ResolverTypeWrapper; - PaymentRecordStatus: PaymentRecordStatus; PaymentRecordsAndPaymentsEdges: ResolverTypeWrapper; PaymentStatus: PaymentStatus; PaymentVerificationLogEntryNode: ResolverTypeWrapper; @@ -25269,7 +23854,6 @@ export type ResolversTypes = { RestartCreateReport: ResolverTypeWrapper; RestartCreateReportInput: RestartCreateReportInput; RevertMarkPaymentAsFailedMutation: ResolverTypeWrapper; - RevertMarkPaymentRecordAsFailedMutation: ResolverTypeWrapper; RoleChoiceObject: ResolverTypeWrapper; RoleNode: ResolverTypeWrapper; RoleSubsystem: RoleSubsystem; @@ -25302,9 +23886,6 @@ export type ResolversTypes = { SaveKoboProjectImportDataAsync: ResolverTypeWrapper; SectionTotalNode: ResolverTypeWrapper; SensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras; - ServiceProviderNode: ResolverTypeWrapper; - ServiceProviderNodeConnection: ResolverTypeWrapper; - ServiceProviderNodeEdge: ResolverTypeWrapper; SetSteficonRuleOnPaymentPlanPaymentListMutation: ResolverTypeWrapper; SetSteficonRuleOnTargetPopulationMutationInput: SetSteficonRuleOnTargetPopulationMutationInput; SetSteficonRuleOnTargetPopulationMutationPayload: ResolverTypeWrapper; @@ -25473,9 +24054,6 @@ export type ResolversParentTypes = { BusinessAreaNodeEdge: BusinessAreaNodeEdge; CashPlanAndPaymentPlanEdges: CashPlanAndPaymentPlanEdges; CashPlanAndPaymentPlanNode: CashPlanAndPaymentPlanNode; - CashPlanNode: CashPlanNode; - CashPlanNodeConnection: CashPlanNodeConnection; - CashPlanNodeEdge: CashPlanNodeEdge; CategoryExtrasInput: CategoryExtrasInput; ChartDatasetNode: ChartDatasetNode; ChartDetailedDatasetsNode: ChartDetailedDatasetsNode; @@ -25502,8 +24080,6 @@ export type ResolversParentTypes = { CountAndPercentageNode: CountAndPercentageNode; CreateAccountabilityCommunicationMessageInput: CreateAccountabilityCommunicationMessageInput; CreateCommunicationMessageMutation: CreateCommunicationMessageMutation; - CreateDashboardReport: CreateDashboardReport; - CreateDashboardReportInput: CreateDashboardReportInput; CreateFeedbackInput: CreateFeedbackInput; CreateFeedbackMessageInput: CreateFeedbackMessageInput; CreateFeedbackMessageMutation: CreateFeedbackMessageMutation; @@ -25673,7 +24249,6 @@ export type ResolversParentTypes = { LogEntryNodeConnection: LogEntryNodeConnection; LogEntryNodeEdge: LogEntryNodeEdge; MarkPaymentAsFailedMutation: MarkPaymentAsFailedMutation; - MarkPaymentRecordAsFailedMutation: MarkPaymentRecordAsFailedMutation; MergeRegistrationDataImportMutation: MergeRegistrationDataImportMutation; Mutations: {}; NeedsAdjudicationApproveMutation: NeedsAdjudicationApproveMutation; @@ -25701,9 +24276,6 @@ export type ResolversParentTypes = { PaymentPlanSupportingDocumentNodeConnection: PaymentPlanSupportingDocumentNodeConnection; PaymentPlanSupportingDocumentNodeEdge: PaymentPlanSupportingDocumentNodeEdge; PaymentRecordAndPaymentNode: PaymentRecordAndPaymentNode; - PaymentRecordNode: PaymentRecordNode; - PaymentRecordNodeConnection: PaymentRecordNodeConnection; - PaymentRecordNodeEdge: PaymentRecordNodeEdge; PaymentRecordsAndPaymentsEdges: PaymentRecordsAndPaymentsEdges; PaymentVerificationLogEntryNode: PaymentVerificationLogEntryNode; PaymentVerificationLogEntryNodeConnection: PaymentVerificationLogEntryNodeConnection; @@ -25760,7 +24332,6 @@ export type ResolversParentTypes = { RestartCreateReport: RestartCreateReport; RestartCreateReportInput: RestartCreateReportInput; RevertMarkPaymentAsFailedMutation: RevertMarkPaymentAsFailedMutation; - RevertMarkPaymentRecordAsFailedMutation: RevertMarkPaymentRecordAsFailedMutation; RoleChoiceObject: RoleChoiceObject; RoleNode: RoleNode; RuleCommitNode: RuleCommitNode; @@ -25787,9 +24358,6 @@ export type ResolversParentTypes = { SaveKoboProjectImportDataAsync: SaveKoboProjectImportDataAsync; SectionTotalNode: SectionTotalNode; SensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras; - ServiceProviderNode: ServiceProviderNode; - ServiceProviderNodeConnection: ServiceProviderNodeConnection; - ServiceProviderNodeEdge: ServiceProviderNodeEdge; SetSteficonRuleOnPaymentPlanPaymentListMutation: SetSteficonRuleOnPaymentPlanPaymentListMutation; SetSteficonRuleOnTargetPopulationMutationInput: SetSteficonRuleOnTargetPopulationMutationInput; SetSteficonRuleOnTargetPopulationMutationPayload: SetSteficonRuleOnTargetPopulationMutationPayload; @@ -26119,7 +24687,6 @@ export type BusinessAreaNodeResolvers; biometricDeduplicationThreshold?: Resolver; businessAreaPartnerThrough?: Resolver, ParentType, ContextType>; - cashplanSet?: Resolver>; children?: Resolver>; code?: Resolver; createdAt?: Resolver; @@ -26154,7 +24721,6 @@ export type BusinessAreaNodeResolvers, ParentType, ContextType>; paymentSet?: Resolver>; paymentplanSet?: Resolver>; - paymentrecordSet?: Resolver>; postponeDeduplication?: Resolver; programSet?: Resolver>; rapidProHost?: Resolver, ParentType, ContextType>; @@ -26167,7 +24733,6 @@ export type BusinessAreaNodeResolvers>; ruleSet?: Resolver>; screenBeneficiary?: Resolver; - serviceproviderSet?: Resolver>; slug?: Resolver; surveySet?: Resolver>; targetpopulationSet?: Resolver>; @@ -26220,71 +24785,6 @@ export type CashPlanAndPaymentPlanNodeResolvers; }; -export type CashPlanNodeResolvers = { - assistanceMeasurement?: Resolver; - assistanceThrough?: Resolver; - availablePaymentRecordsCount?: Resolver, ParentType, ContextType>; - bankReconciliationError?: Resolver, ParentType, ContextType>; - bankReconciliationSuccess?: Resolver, ParentType, ContextType>; - businessArea?: Resolver; - caHashId?: Resolver, ParentType, ContextType>; - caId?: Resolver, ParentType, ContextType>; - canCreatePaymentVerificationPlan?: Resolver, ParentType, ContextType>; - comments?: Resolver, ParentType, ContextType>; - coverageDuration?: Resolver; - coverageUnit?: Resolver; - createdAt?: Resolver; - currency?: Resolver, ParentType, ContextType>; - deliveryType?: Resolver, ParentType, ContextType>; - dispersionDate?: Resolver; - distributionLevel?: Resolver; - downPayment?: Resolver, ParentType, ContextType>; - endDate?: Resolver, ParentType, ContextType>; - exchangeRate?: Resolver, ParentType, ContextType>; - fundsCommitment?: Resolver, ParentType, ContextType>; - id?: Resolver; - name?: Resolver; - paymentItems?: Resolver>; - paymentVerificationSummary?: Resolver, ParentType, ContextType>; - program?: Resolver; - serviceProvider?: Resolver, ParentType, ContextType>; - startDate?: Resolver, ParentType, ContextType>; - status?: Resolver; - statusDate?: Resolver; - totalDeliveredQuantity?: Resolver, ParentType, ContextType>; - totalDeliveredQuantityUsd?: Resolver, ParentType, ContextType>; - totalEntitledQuantity?: Resolver, ParentType, ContextType>; - totalEntitledQuantityRevised?: Resolver, ParentType, ContextType>; - totalEntitledQuantityRevisedUsd?: Resolver, ParentType, ContextType>; - totalEntitledQuantityUsd?: Resolver, ParentType, ContextType>; - totalNumberOfHouseholds?: Resolver, ParentType, ContextType>; - totalPersonsCovered?: Resolver; - totalPersonsCoveredRevised?: Resolver; - totalUndeliveredQuantity?: Resolver, ParentType, ContextType>; - totalUndeliveredQuantityUsd?: Resolver, ParentType, ContextType>; - unicefId?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - validationAlertsCount?: Resolver; - verificationPlans?: Resolver, ParentType, ContextType, Partial>; - version?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CashPlanNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CashPlanNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type ChartDatasetNodeResolvers = { datasets?: Resolver>>, ParentType, ContextType>; labels?: Resolver>>, ParentType, ContextType>; @@ -26446,11 +24946,6 @@ export type CreateCommunicationMessageMutationResolvers; }; -export type CreateDashboardReportResolvers = { - success?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type CreateFeedbackMessageMutationResolvers = { feedbackMessage?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -26666,7 +25161,6 @@ export type DeliveryMechanismNodeResolvers, ParentType, ContextType>; paymentGatewayId?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; requiredFields?: Resolver, ParentType, ContextType>; transferType?: Resolver; uniqueFields?: Resolver, ParentType, ContextType>; @@ -26932,11 +25426,11 @@ export type FinancialServiceProviderNodeResolvers, ParentType, ContextType>; dataTransferConfiguration?: Resolver, ParentType, ContextType>; deliveryMechanisms?: Resolver>; - deliveryMechanismsChoices?: Resolver>, ParentType, ContextType>; deliveryMechanismsPerPaymentPlan?: Resolver>; distributionLimit?: Resolver, ParentType, ContextType>; fullName?: Resolver, ParentType, ContextType>; id?: Resolver; + internalData?: Resolver; isPaymentGateway?: Resolver, ParentType, ContextType>; name?: Resolver; paymentGatewayId?: Resolver, ParentType, ContextType>; @@ -27244,6 +25738,7 @@ export type HouseholdNodeResolvers, ParentType, ContextType>; individuals?: Resolver, ParentType, ContextType, Partial>; individualsAndRoles?: Resolver, ParentType, ContextType>; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRecalculatedGroupAges?: Resolver; @@ -27273,7 +25768,6 @@ export type HouseholdNodeResolvers; originUnicefId?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; positiveFeedbackTicketDetails?: Resolver>; pregnantCount?: Resolver, ParentType, ContextType>; program?: Resolver, ParentType, ContextType>; @@ -27303,7 +25797,6 @@ export type HouseholdNodeResolvers; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; village?: Resolver; withdrawn?: Resolver; @@ -27477,6 +25970,7 @@ export type ImportedHouseholdNodeResolvers; importId?: Resolver, ParentType, ContextType>; individuals?: Resolver, ParentType, ContextType, Partial>; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRecalculatedGroupAges?: Resolver; @@ -27520,7 +26014,6 @@ export type ImportedHouseholdNodeResolvers; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; village?: Resolver; withdrawn?: Resolver; @@ -27610,6 +26103,7 @@ export type ImportedIndividualNodeResolvers, ParentType, ContextType>; importedIndividualId?: Resolver, ParentType, ContextType>; individualId?: Resolver; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRemoved?: Resolver; @@ -27647,7 +26141,6 @@ export type ImportedIndividualNodeResolvers; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; walletAddress?: Resolver; walletName?: Resolver; @@ -27757,6 +26250,7 @@ export type IndividualNodeResolvers, ParentType, ContextType>; individualDataUpdateTicketDetails?: Resolver>; individualId?: Resolver; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRemoved?: Resolver; @@ -27773,7 +26267,6 @@ export type IndividualNodeResolvers>>, ParentType, ContextType>; paymentDeliveryPhoneNo?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; phoneNo?: Resolver; phoneNoAlternative?: Resolver; phoneNoAlternativeValid?: Resolver, ParentType, ContextType>; @@ -27809,7 +26302,6 @@ export type IndividualNodeResolvers>; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; walletAddress?: Resolver; walletName?: Resolver; @@ -27987,11 +26479,6 @@ export type MarkPaymentAsFailedMutationResolvers; }; -export type MarkPaymentRecordAsFailedMutationResolvers = { - paymentRecord?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type MergeRegistrationDataImportMutationResolvers = { registrationDataImport?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -28018,7 +26505,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; copyTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; createAccountabilityCommunicationMessage?: Resolver, ParentType, ContextType, RequireFields>; - createDashboardReport?: Resolver, ParentType, ContextType, RequireFields>; createFeedback?: Resolver, ParentType, ContextType, RequireFields>; createFeedbackMessage?: Resolver, ParentType, ContextType, RequireFields>; createFollowUpPaymentPlan?: Resolver, ParentType, ContextType, RequireFields>; @@ -28053,7 +26539,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; lockTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; markPaymentAsFailed?: Resolver, ParentType, ContextType, RequireFields>; - markPaymentRecordAsFailed?: Resolver, ParentType, ContextType, RequireFields>; mergeRegistrationDataImport?: Resolver, ParentType, ContextType, RequireFields>; reassignRole?: Resolver, ParentType, ContextType, RequireFields>; refuseRegistrationDataImport?: Resolver, ParentType, ContextType, RequireFields>; @@ -28063,7 +26548,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; restartCreateReport?: Resolver, ParentType, ContextType, RequireFields>; revertMarkPaymentAsFailed?: Resolver, ParentType, ContextType, RequireFields>; - revertMarkPaymentRecordAsFailed?: Resolver, ParentType, ContextType, RequireFields>; saveKoboImportDataAsync?: Resolver, ParentType, ContextType, RequireFields>; setSteficonRuleOnPaymentPlanPaymentList?: Resolver, ParentType, ContextType, RequireFields>; setSteficonRuleOnTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; @@ -28087,7 +26571,7 @@ export type NeedsAdjudicationApproveMutationResolvers = { - __resolveType: TypeResolveFn<'ApprovalProcessNode' | 'AreaNode' | 'AreaTypeNode' | 'BankAccountInfoNode' | 'BusinessAreaNode' | 'CashPlanNode' | 'CommunicationMessageNode' | 'CommunicationMessageRecipientMapNode' | 'DataCollectingTypeNode' | 'DeliveryMechanismDataNode' | 'DeliveryMechanismNode' | 'DeliveryMechanismPerPaymentPlanNode' | 'DocumentNode' | 'FeedbackMessageNode' | 'FeedbackNode' | 'FinancialServiceProviderNode' | 'FinancialServiceProviderXlsxTemplateNode' | 'GrievanceDocumentNode' | 'GrievanceTicketNode' | 'HouseholdNode' | 'ImportDataNode' | 'ImportedDocumentNode' | 'ImportedHouseholdNode' | 'ImportedIndividualIdentityNode' | 'ImportedIndividualNode' | 'IndividualIdentityNode' | 'IndividualNode' | 'KoboImportDataNode' | 'LogEntryNode' | 'PaymentHouseholdSnapshotNode' | 'PaymentNode' | 'PaymentPlanNode' | 'PaymentPlanSupportingDocumentNode' | 'PaymentRecordNode' | 'PaymentVerificationLogEntryNode' | 'PaymentVerificationNode' | 'PaymentVerificationPlanNode' | 'PaymentVerificationSummaryNode' | 'PeriodicFieldNode' | 'ProgramCycleNode' | 'ProgramNode' | 'RecipientNode' | 'RegistrationDataImportDatahubNode' | 'RegistrationDataImportNode' | 'ReportNode' | 'RuleCommitNode' | 'SanctionListIndividualAliasNameNode' | 'SanctionListIndividualCountriesNode' | 'SanctionListIndividualDateOfBirthNode' | 'SanctionListIndividualDocumentNode' | 'SanctionListIndividualNationalitiesNode' | 'SanctionListIndividualNode' | 'ServiceProviderNode' | 'SteficonRuleNode' | 'SurveyNode' | 'TargetPopulationNode' | 'TicketAddIndividualDetailsNode' | 'TicketComplaintDetailsNode' | 'TicketDeleteHouseholdDetailsNode' | 'TicketDeleteIndividualDetailsNode' | 'TicketHouseholdDataUpdateDetailsNode' | 'TicketIndividualDataUpdateDetailsNode' | 'TicketNeedsAdjudicationDetailsNode' | 'TicketNegativeFeedbackDetailsNode' | 'TicketNoteNode' | 'TicketPaymentVerificationDetailsNode' | 'TicketPositiveFeedbackDetailsNode' | 'TicketReferralDetailsNode' | 'TicketSensitiveDetailsNode' | 'TicketSystemFlaggingDetailsNode' | 'UserBusinessAreaNode' | 'UserNode' | 'VolumeByDeliveryMechanismNode', ParentType, ContextType>; + __resolveType: TypeResolveFn<'ApprovalProcessNode' | 'AreaNode' | 'AreaTypeNode' | 'BankAccountInfoNode' | 'BusinessAreaNode' | 'CommunicationMessageNode' | 'CommunicationMessageRecipientMapNode' | 'DataCollectingTypeNode' | 'DeliveryMechanismDataNode' | 'DeliveryMechanismNode' | 'DeliveryMechanismPerPaymentPlanNode' | 'DocumentNode' | 'FeedbackMessageNode' | 'FeedbackNode' | 'FinancialServiceProviderNode' | 'FinancialServiceProviderXlsxTemplateNode' | 'GrievanceDocumentNode' | 'GrievanceTicketNode' | 'HouseholdNode' | 'ImportDataNode' | 'ImportedDocumentNode' | 'ImportedHouseholdNode' | 'ImportedIndividualIdentityNode' | 'ImportedIndividualNode' | 'IndividualIdentityNode' | 'IndividualNode' | 'KoboImportDataNode' | 'LogEntryNode' | 'PaymentHouseholdSnapshotNode' | 'PaymentNode' | 'PaymentPlanNode' | 'PaymentPlanSupportingDocumentNode' | 'PaymentVerificationLogEntryNode' | 'PaymentVerificationNode' | 'PaymentVerificationPlanNode' | 'PaymentVerificationSummaryNode' | 'PeriodicFieldNode' | 'ProgramCycleNode' | 'ProgramNode' | 'RecipientNode' | 'RegistrationDataImportDatahubNode' | 'RegistrationDataImportNode' | 'ReportNode' | 'RuleCommitNode' | 'SanctionListIndividualAliasNameNode' | 'SanctionListIndividualCountriesNode' | 'SanctionListIndividualDateOfBirthNode' | 'SanctionListIndividualDocumentNode' | 'SanctionListIndividualNationalitiesNode' | 'SanctionListIndividualNode' | 'SteficonRuleNode' | 'SurveyNode' | 'TargetPopulationNode' | 'TicketAddIndividualDetailsNode' | 'TicketComplaintDetailsNode' | 'TicketDeleteHouseholdDetailsNode' | 'TicketDeleteIndividualDetailsNode' | 'TicketHouseholdDataUpdateDetailsNode' | 'TicketIndividualDataUpdateDetailsNode' | 'TicketNeedsAdjudicationDetailsNode' | 'TicketNegativeFeedbackDetailsNode' | 'TicketNoteNode' | 'TicketPaymentVerificationDetailsNode' | 'TicketPositiveFeedbackDetailsNode' | 'TicketReferralDetailsNode' | 'TicketSensitiveDetailsNode' | 'TicketSystemFlaggingDetailsNode' | 'UserBusinessAreaNode' | 'UserNode' | 'VolumeByDeliveryMechanismNode', ParentType, ContextType>; id?: Resolver; }; @@ -28220,7 +26704,6 @@ export type PaymentNodeResolvers, ParentType, ContextType>; deliveryDate?: Resolver, ParentType, ContextType>; deliveryType?: Resolver, ParentType, ContextType>; - deliveryTypeChoice?: Resolver, ParentType, ContextType>; distributionModality?: Resolver, ParentType, ContextType>; entitlementDate?: Resolver, ParentType, ContextType>; entitlementQuantity?: Resolver, ParentType, ContextType>; @@ -28234,6 +26717,8 @@ export type PaymentNodeResolvers; householdSnapshot?: Resolver, ParentType, ContextType>; id?: Resolver; + internalData?: Resolver; + isCashAssist?: Resolver; isFollowUp?: Resolver; isRemoved?: Resolver; orderNumber?: Resolver, ParentType, ContextType>; @@ -28242,6 +26727,7 @@ export type PaymentNodeResolvers>>, ParentType, ContextType>; paymentPlanSoftConflicted?: Resolver, ParentType, ContextType>; paymentPlanSoftConflictedData?: Resolver>>, ParentType, ContextType>; + paymentVerification?: Resolver, ParentType, ContextType>; program?: Resolver, ParentType, ContextType>; reasonForUnsuccessfulPayment?: Resolver, ParentType, ContextType>; serviceProvider?: Resolver, ParentType, ContextType>; @@ -28255,6 +26741,8 @@ export type PaymentNodeResolvers; statusDate?: Resolver; targetPopulation?: Resolver, ParentType, ContextType>; + ticketComplaintDetails?: Resolver, ParentType, ContextType>; + ticketSensitiveDetails?: Resolver, ParentType, ContextType>; tokenNumber?: Resolver, ParentType, ContextType>; totalPersonsCovered?: Resolver, ParentType, ContextType>; transactionReferenceId?: Resolver, ParentType, ContextType>; @@ -28293,7 +26781,7 @@ export type PaymentPlanNodeResolvers, ParentType, ContextType>; createdAt?: Resolver; createdBy?: Resolver; - currency?: Resolver; + currency?: Resolver, ParentType, ContextType>; currencyName?: Resolver, ParentType, ContextType>; deliveryMechanisms?: Resolver>>, ParentType, ContextType>; dispersionEndDate?: Resolver, ParentType, ContextType>; @@ -28313,16 +26801,19 @@ export type PaymentPlanNodeResolvers; importedFileDate?: Resolver, ParentType, ContextType>; importedFileName?: Resolver, ParentType, ContextType>; + internalData?: Resolver; + isCashAssist?: Resolver; isFollowUp?: Resolver; isRemoved?: Resolver; maleAdultsCount?: Resolver; maleChildrenCount?: Resolver; name?: Resolver, ParentType, ContextType>; paymentItems?: Resolver>; + paymentVerificationPlans?: Resolver>; paymentVerificationSummary?: Resolver, ParentType, ContextType>; paymentsConflictsCount?: Resolver, ParentType, ContextType>; - program?: Resolver; - programCycle?: Resolver, ParentType, ContextType>; + program?: Resolver, ParentType, ContextType>; + programCycle?: Resolver; reconciliationSummary?: Resolver, ParentType, ContextType>; sourcePaymentPlan?: Resolver, ParentType, ContextType>; splitChoices?: Resolver>>, ParentType, ContextType>; @@ -28405,60 +26896,6 @@ export type PaymentRecordAndPaymentNodeResolvers; }; -export type PaymentRecordNodeResolvers = { - adminUrl?: Resolver, ParentType, ContextType>; - businessArea?: Resolver; - caHashId?: Resolver, ParentType, ContextType>; - caId?: Resolver, ParentType, ContextType>; - createdAt?: Resolver; - currency?: Resolver; - deliveredQuantity?: Resolver, ParentType, ContextType>; - deliveredQuantityUsd?: Resolver, ParentType, ContextType>; - deliveryDate?: Resolver, ParentType, ContextType>; - deliveryType?: Resolver, ParentType, ContextType>; - deliveryTypeChoice?: Resolver, ParentType, ContextType>; - distributionModality?: Resolver; - entitlementCardIssueDate?: Resolver, ParentType, ContextType>; - entitlementCardNumber?: Resolver, ParentType, ContextType>; - entitlementCardStatus?: Resolver, ParentType, ContextType>; - entitlementQuantity?: Resolver, ParentType, ContextType>; - entitlementQuantityUsd?: Resolver, ParentType, ContextType>; - fullName?: Resolver; - headOfHousehold?: Resolver, ParentType, ContextType>; - household?: Resolver; - id?: Resolver; - parent?: Resolver, ParentType, ContextType>; - registrationCaId?: Resolver, ParentType, ContextType>; - serviceProvider?: Resolver; - status?: Resolver; - statusDate?: Resolver; - targetPopulation?: Resolver; - targetPopulationCashAssistId?: Resolver; - totalPersonsCovered?: Resolver; - transactionReferenceId?: Resolver, ParentType, ContextType>; - transactionStatusBlockchainLink?: Resolver, ParentType, ContextType>; - unicefId?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - verification?: Resolver, ParentType, ContextType>; - version?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type PaymentRecordNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type PaymentRecordNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type PaymentRecordsAndPaymentsEdgesResolvers = { cursor?: Resolver, ParentType, ContextType>; node?: Resolver, ParentType, ContextType>; @@ -28501,8 +26938,8 @@ export type PaymentVerificationNodeResolvers; isManuallyEditable?: Resolver, ParentType, ContextType>; payment?: Resolver, ParentType, ContextType>; - paymentContentType?: Resolver; - paymentObjectId?: Resolver; + paymentContentType?: Resolver, ParentType, ContextType>; + paymentObjectId?: Resolver, ParentType, ContextType>; paymentVerificationPlan?: Resolver; receivedAmount?: Resolver, ParentType, ContextType>; sentToRapidPro?: Resolver; @@ -28543,8 +26980,8 @@ export type PaymentVerificationPlanNodeResolvers, ParentType, ContextType>; notReceivedCount?: Resolver, ParentType, ContextType>; paymentPlan?: Resolver, ParentType, ContextType>; - paymentPlanContentType?: Resolver; - paymentPlanObjectId?: Resolver; + paymentPlanContentType?: Resolver, ParentType, ContextType>; + paymentPlanObjectId?: Resolver, ParentType, ContextType>; paymentRecordVerifications?: Resolver>; rapidProFlowId?: Resolver; rapidProFlowStartUuids?: Resolver, ParentType, ContextType>; @@ -28584,8 +27021,9 @@ export type PaymentVerificationSummaryNodeResolvers, ParentType, ContextType>; createdAt?: Resolver; id?: Resolver; - paymentPlanContentType?: Resolver; - paymentPlanObjectId?: Resolver; + paymentPlan?: Resolver, ParentType, ContextType>; + paymentPlanContentType?: Resolver, ParentType, ContextType>; + paymentPlanObjectId?: Resolver, ParentType, ContextType>; status?: Resolver; updatedAt?: Resolver; __isTypeOf?: IsTypeOfResolverFn; @@ -28666,7 +27104,6 @@ export type ProgramNodeResolvers, ParentType, ContextType>; canFinish?: Resolver, ParentType, ContextType>; cashPlus?: Resolver; - cashplanSet?: Resolver>; createdAt?: Resolver; cycles?: Resolver, ParentType, ContextType, Partial>; dataCollectingType?: Resolver, ParentType, ContextType>; @@ -28691,7 +27128,6 @@ export type ProgramNodeResolvers; partners?: Resolver>>, ParentType, ContextType>; paymentSet?: Resolver>; - paymentplanSet?: Resolver>; pduFields?: Resolver>>, ParentType, ContextType>; populationGoal?: Resolver; programmeCode?: Resolver, ParentType, ContextType>; @@ -28742,7 +27178,6 @@ export type QueryResolvers, ParentType, ContextType, Partial>; allAreasTree?: Resolver>>, ParentType, ContextType, RequireFields>; allBusinessAreas?: Resolver, ParentType, ContextType, Partial>; - allCashPlans?: Resolver, ParentType, ContextType, Partial>; allCashPlansAndPaymentPlans?: Resolver, ParentType, ContextType, RequireFields>; allCollectorFieldsAttributes?: Resolver>>, ParentType, ContextType, Partial>; allDeliveryMechanisms?: Resolver>>, ParentType, ContextType>; @@ -28766,7 +27201,6 @@ export type QueryResolvers, ParentType, ContextType, Partial>; allMergedIndividuals?: Resolver, ParentType, ContextType, Partial>; allPaymentPlans?: Resolver, ParentType, ContextType, RequireFields>; - allPaymentRecords?: Resolver, ParentType, ContextType, Partial>; allPaymentRecordsAndPayments?: Resolver, ParentType, ContextType, RequireFields>; allPaymentVerificationLogEntries?: Resolver, ParentType, ContextType, RequireFields>; allPaymentVerificationPlan?: Resolver, ParentType, ContextType, Partial>; @@ -28787,7 +27221,6 @@ export type QueryResolvers, ParentType, ContextType, RequireFields>; canRunDeduplication?: Resolver, ParentType, ContextType>; cashAssistUrlPrefix?: Resolver, ParentType, ContextType>; - cashPlan?: Resolver, ParentType, ContextType, RequireFields>; cashPlanStatusChoices?: Resolver>>, ParentType, ContextType>; cashPlanVerificationSamplingChoices?: Resolver>>, ParentType, ContextType>; cashPlanVerificationStatusChoices?: Resolver>>, ParentType, ContextType>; @@ -28848,7 +27281,6 @@ export type QueryResolvers, ParentType, ContextType, RequireFields>; paymentPlanBackgroundActionStatusChoices?: Resolver>>, ParentType, ContextType>; paymentPlanStatusChoices?: Resolver>>, ParentType, ContextType>; - paymentRecord?: Resolver, ParentType, ContextType, RequireFields>; paymentRecordDeliveryTypeChoices?: Resolver>>, ParentType, ContextType>; paymentRecordEntitlementCardStatusChoices?: Resolver>>, ParentType, ContextType>; paymentRecordStatusChoices?: Resolver>>, ParentType, ContextType>; @@ -29129,11 +27561,6 @@ export type RevertMarkPaymentAsFailedMutationResolvers; }; -export type RevertMarkPaymentRecordAsFailedMutationResolvers = { - paymentRecord?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type RoleChoiceObjectResolvers = { name?: Resolver, ParentType, ContextType>; subsystem?: Resolver, ParentType, ContextType>; @@ -29354,35 +27781,6 @@ export type SectionTotalNodeResolvers; }; -export type ServiceProviderNodeResolvers = { - businessArea?: Resolver; - caId?: Resolver; - cashPlans?: Resolver>; - country?: Resolver; - createdAt?: Resolver; - fullName?: Resolver, ParentType, ContextType>; - id?: Resolver; - paymentrecordSet?: Resolver>; - shortName?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type ServiceProviderNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type ServiceProviderNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type SetSteficonRuleOnPaymentPlanPaymentListMutationResolvers = { paymentPlan?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -29519,7 +27917,6 @@ export type TargetPopulationNodeResolvers>; name?: Resolver; paymentPlans?: Resolver>; - paymentRecords?: Resolver>; program?: Resolver; programCycle?: Resolver; selections?: Resolver, ParentType, ContextType>; @@ -29679,6 +28076,7 @@ export type TicketComplaintDetailsNodeResolvers, ParentType, ContextType>; id?: Resolver; individual?: Resolver, ParentType, ContextType>; + payment?: Resolver, ParentType, ContextType>; paymentContentType?: Resolver, ParentType, ContextType>; paymentObjectId?: Resolver, ParentType, ContextType>; paymentRecord?: Resolver, ParentType, ContextType>; @@ -29966,6 +28364,7 @@ export type TicketSensitiveDetailsNodeResolvers, ParentType, ContextType>; id?: Resolver; individual?: Resolver, ParentType, ContextType>; + payment?: Resolver, ParentType, ContextType>; paymentContentType?: Resolver, ParentType, ContextType>; paymentObjectId?: Resolver, ParentType, ContextType>; paymentRecord?: Resolver, ParentType, ContextType>; @@ -30078,7 +28477,6 @@ export type UserBusinessAreaNodeResolvers; biometricDeduplicationThreshold?: Resolver; businessAreaPartnerThrough?: Resolver, ParentType, ContextType>; - cashplanSet?: Resolver>; children?: Resolver>; code?: Resolver; createdAt?: Resolver; @@ -30113,7 +28511,6 @@ export type UserBusinessAreaNodeResolvers, ParentType, ContextType>; paymentSet?: Resolver>; paymentplanSet?: Resolver>; - paymentrecordSet?: Resolver>; permissions?: Resolver>>, ParentType, ContextType>; postponeDeduplication?: Resolver; programSet?: Resolver>; @@ -30127,7 +28524,6 @@ export type UserBusinessAreaNodeResolvers>; ruleSet?: Resolver>; screenBeneficiary?: Resolver; - serviceproviderSet?: Resolver>; slug?: Resolver; surveySet?: Resolver>; targetpopulationSet?: Resolver>; @@ -30300,9 +28696,6 @@ export type Resolvers = { BusinessAreaNodeEdge?: BusinessAreaNodeEdgeResolvers; CashPlanAndPaymentPlanEdges?: CashPlanAndPaymentPlanEdgesResolvers; CashPlanAndPaymentPlanNode?: CashPlanAndPaymentPlanNodeResolvers; - CashPlanNode?: CashPlanNodeResolvers; - CashPlanNodeConnection?: CashPlanNodeConnectionResolvers; - CashPlanNodeEdge?: CashPlanNodeEdgeResolvers; ChartDatasetNode?: ChartDatasetNodeResolvers; ChartDetailedDatasetsNode?: ChartDetailedDatasetsNodeResolvers; ChartGrievanceTicketsNode?: ChartGrievanceTicketsNodeResolvers; @@ -30323,7 +28716,6 @@ export type Resolvers = { CoreFieldChoiceObject?: CoreFieldChoiceObjectResolvers; CountAndPercentageNode?: CountAndPercentageNodeResolvers; CreateCommunicationMessageMutation?: CreateCommunicationMessageMutationResolvers; - CreateDashboardReport?: CreateDashboardReportResolvers; CreateFeedbackMessageMutation?: CreateFeedbackMessageMutationResolvers; CreateFeedbackMutation?: CreateFeedbackMutationResolvers; CreateFollowUpPaymentPlanMutation?: CreateFollowUpPaymentPlanMutationResolvers; @@ -30455,7 +28847,6 @@ export type Resolvers = { LogEntryNodeConnection?: LogEntryNodeConnectionResolvers; LogEntryNodeEdge?: LogEntryNodeEdgeResolvers; MarkPaymentAsFailedMutation?: MarkPaymentAsFailedMutationResolvers; - MarkPaymentRecordAsFailedMutation?: MarkPaymentRecordAsFailedMutationResolvers; MergeRegistrationDataImportMutation?: MergeRegistrationDataImportMutationResolvers; Mutations?: MutationsResolvers; NeedsAdjudicationApproveMutation?: NeedsAdjudicationApproveMutationResolvers; @@ -30481,9 +28872,6 @@ export type Resolvers = { PaymentPlanSupportingDocumentNodeConnection?: PaymentPlanSupportingDocumentNodeConnectionResolvers; PaymentPlanSupportingDocumentNodeEdge?: PaymentPlanSupportingDocumentNodeEdgeResolvers; PaymentRecordAndPaymentNode?: PaymentRecordAndPaymentNodeResolvers; - PaymentRecordNode?: PaymentRecordNodeResolvers; - PaymentRecordNodeConnection?: PaymentRecordNodeConnectionResolvers; - PaymentRecordNodeEdge?: PaymentRecordNodeEdgeResolvers; PaymentRecordsAndPaymentsEdges?: PaymentRecordsAndPaymentsEdgesResolvers; PaymentVerificationLogEntryNode?: PaymentVerificationLogEntryNodeResolvers; PaymentVerificationLogEntryNodeConnection?: PaymentVerificationLogEntryNodeConnectionResolvers; @@ -30530,7 +28918,6 @@ export type Resolvers = { ReportNodeEdge?: ReportNodeEdgeResolvers; RestartCreateReport?: RestartCreateReportResolvers; RevertMarkPaymentAsFailedMutation?: RevertMarkPaymentAsFailedMutationResolvers; - RevertMarkPaymentRecordAsFailedMutation?: RevertMarkPaymentRecordAsFailedMutationResolvers; RoleChoiceObject?: RoleChoiceObjectResolvers; RoleNode?: RoleNodeResolvers; RuleCommitNode?: RuleCommitNodeResolvers; @@ -30556,9 +28943,6 @@ export type Resolvers = { SanctionListIndividualNodeEdge?: SanctionListIndividualNodeEdgeResolvers; SaveKoboProjectImportDataAsync?: SaveKoboProjectImportDataAsyncResolvers; SectionTotalNode?: SectionTotalNodeResolvers; - ServiceProviderNode?: ServiceProviderNodeResolvers; - ServiceProviderNodeConnection?: ServiceProviderNodeConnectionResolvers; - ServiceProviderNodeEdge?: ServiceProviderNodeEdgeResolvers; SetSteficonRuleOnPaymentPlanPaymentListMutation?: SetSteficonRuleOnPaymentPlanPaymentListMutationResolvers; SetSteficonRuleOnTargetPopulationMutationPayload?: SetSteficonRuleOnTargetPopulationMutationPayloadResolvers; SimpleApproveMutation?: SimpleApproveMutationResolvers; diff --git a/src/frontend/src/__generated__/introspection-result.ts b/src/frontend/src/__generated__/introspection-result.ts index be91b923e8..8eea93cfb4 100644 --- a/src/frontend/src/__generated__/introspection-result.ts +++ b/src/frontend/src/__generated__/introspection-result.ts @@ -12,7 +12,6 @@ "AreaTypeNode", "BankAccountInfoNode", "BusinessAreaNode", - "CashPlanNode", "CommunicationMessageNode", "CommunicationMessageRecipientMapNode", "DataCollectingTypeNode", @@ -40,7 +39,6 @@ "PaymentNode", "PaymentPlanNode", "PaymentPlanSupportingDocumentNode", - "PaymentRecordNode", "PaymentVerificationLogEntryNode", "PaymentVerificationNode", "PaymentVerificationPlanNode", @@ -59,7 +57,6 @@ "SanctionListIndividualDocumentNode", "SanctionListIndividualNationalitiesNode", "SanctionListIndividualNode", - "ServiceProviderNode", "SteficonRuleNode", "SurveyNode", "TargetPopulationNode", diff --git a/src/frontend/src/apollo/fragments/HouseholdFragments.ts b/src/frontend/src/apollo/fragments/HouseholdFragments.ts index 39df47d7d1..fb63358481 100644 --- a/src/frontend/src/apollo/fragments/HouseholdFragments.ts +++ b/src/frontend/src/apollo/fragments/HouseholdFragments.ts @@ -140,24 +140,6 @@ export const householdDetailed = gql` username } } - paymentrecordSet { - edges { - node { - id - fullName - parent { - id - totalPersonsCovered - program { - id - name - } - totalDeliveredQuantity - assistanceMeasurement - } - } - } - } flexFields deliveredQuantities { totalDeliveredQuantity diff --git a/src/frontend/src/apollo/fragments/PaymentRecordFragments.ts b/src/frontend/src/apollo/fragments/PaymentRecordFragments.ts deleted file mode 100644 index ece7eae88d..0000000000 --- a/src/frontend/src/apollo/fragments/PaymentRecordFragments.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { gql } from '@apollo/client'; - -export const paymentRecordDetails = gql` - fragment paymentRecordDetails on PaymentRecordNode { - id - status - statusDate - caId - caHashId - registrationCaId - verification { - id - status - statusDate - receivedAmount - } - household { - id - status - size - unicefId - headOfHousehold { - id - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - } - } - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - parent { - id - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } - } - } - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - deliveryType { - name - } - entitlementCardIssueDate - entitlementCardNumber - transactionReferenceId - serviceProvider { - id - fullName - shortName - } - } -`; diff --git a/src/frontend/src/apollo/mutations/payments/MarkPaymentRecordAsFailed.ts b/src/frontend/src/apollo/mutations/payments/MarkPaymentRecordAsFailed.ts deleted file mode 100644 index d02c507a31..0000000000 --- a/src/frontend/src/apollo/mutations/payments/MarkPaymentRecordAsFailed.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { gql } from '@apollo/client'; - -export const MARK_PAYMENT_RECORD_AS_FAILED = gql` - mutation markPRAsFailed($paymentRecordId: ID!) { - markPaymentRecordAsFailed(paymentRecordId: $paymentRecordId) { - paymentRecord { - ...paymentRecordDetails - } - } - } -`; diff --git a/src/frontend/src/apollo/mutations/payments/RevertMarkPaymentRecordAsFailed.ts b/src/frontend/src/apollo/mutations/payments/RevertMarkPaymentRecordAsFailed.ts deleted file mode 100644 index d5c9374cb8..0000000000 --- a/src/frontend/src/apollo/mutations/payments/RevertMarkPaymentRecordAsFailed.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { gql } from '@apollo/client'; - -export const REVERT_MARK_PAYMENT_RECORD_AS_FAILED = gql` - mutation revertMarkPRAsFailed( - $paymentRecordId: ID! - $deliveredQuantity: Decimal! - $deliveryDate: Date! - ) { - revertMarkPaymentRecordAsFailed( - paymentRecordId: $paymentRecordId - deliveredQuantity: $deliveredQuantity - deliveryDate: $deliveryDate - ) { - paymentRecord { - ...paymentRecordDetails - } - } - } -`; diff --git a/src/frontend/src/apollo/mutations/reporting/CreateDashboardReport.ts b/src/frontend/src/apollo/mutations/reporting/CreateDashboardReport.ts deleted file mode 100644 index 7150c1762b..0000000000 --- a/src/frontend/src/apollo/mutations/reporting/CreateDashboardReport.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { gql } from '@apollo/client'; - -export const CREATE_DASHBOARD_REPORT_MUTATION = gql` - mutation CreateDashboardReport($reportData: CreateDashboardReportInput!) { - createDashboardReport(reportData: $reportData) { - success - } - } -`; diff --git a/src/frontend/src/apollo/queries/payments/AllCashPlans.ts b/src/frontend/src/apollo/queries/payments/AllCashPlans.ts deleted file mode 100644 index b835bd043f..0000000000 --- a/src/frontend/src/apollo/queries/payments/AllCashPlans.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { gql } from '@apollo/client'; - -export const AllCashPlans = gql` - query AllCashPlans( - $program: ID - $after: String - $before: String - $first: Int - $last: Int - $orderBy: String - $search: String - $serviceProvider: String - $deliveryType: [String] - $verificationStatus: [String] - $startDateGte: DateTime - $endDateLte: DateTime - $businessArea: String - ) { - allCashPlans( - program: $program - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - search: $search - serviceProvider_FullName_Startswith: $serviceProvider - deliveryType: $deliveryType - verificationStatus: $verificationStatus - startDate_Gte: $startDateGte - endDate_Lte: $endDateLte - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - totalCount - edges { - cursor - node { - id - caId - assistanceThrough - totalNumberOfHouseholds - serviceProvider { - id - caId - fullName - } - deliveryType - startDate - endDate - program { - id - name - } - totalPersonsCovered - dispersionDate - assistanceMeasurement - status - currency - totalEntitledQuantity - totalDeliveredQuantity - totalUndeliveredQuantity - updatedAt - paymentVerificationSummary { - id - status - } - } - } - } - } -`; diff --git a/src/frontend/src/apollo/queries/payments/AllPaymentRecords.ts b/src/frontend/src/apollo/queries/payments/AllPaymentRecords.ts deleted file mode 100644 index e95b662798..0000000000 --- a/src/frontend/src/apollo/queries/payments/AllPaymentRecords.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { gql } from '@apollo/client'; - -export const AllPaymentRecords = gql` - query AllPaymentRecords( - $parent: ID - $household: ID - $after: String - $before: String - $orderBy: String - $first: Int - $last: Int - $businessArea: String - ) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - createdAt - updatedAt - fullName - statusDate - status - caId - totalPersonsCovered - household { - id - unicefId - size - } - headOfHousehold { - id - fullName - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - parent { - id - program { - id - name - } - } - } - } - totalCount - edgeCount - } - } -`; diff --git a/src/frontend/src/apollo/queries/payments/CashPlan.ts b/src/frontend/src/apollo/queries/payments/CashPlan.ts deleted file mode 100644 index da430a9912..0000000000 --- a/src/frontend/src/apollo/queries/payments/CashPlan.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { gql } from '@apollo/client'; - -export const CashPlan = gql` - query CashPlan($id: ID!) { - cashPlan(id: $id) { - id - version - canCreatePaymentVerificationPlan - availablePaymentRecordsCount - name - startDate - endDate - updatedAt - status - deliveryType - fundsCommitment - downPayment - dispersionDate - assistanceThrough - serviceProvider { - id - caId - fullName - } - caId - caHashId - dispersionDate - bankReconciliationSuccess - bankReconciliationError - totalNumberOfHouseholds - verificationPlans { - totalCount - edges { - node { - id - unicefId - adminUrl - status - sampleSize - receivedCount - notReceivedCount - respondedCount - verificationChannel - sampling - receivedCount - receivedWithProblemsCount - rapidProFlowId - confidenceInterval - marginOfError - activationDate - completionDate - ageFilter { - min - max - } - excludedAdminAreasFilter - sexFilter - xlsxFileExporting - hasXlsxFile - xlsxFileWasDownloaded - xlsxFileImported - } - } - } - paymentVerificationSummary { - id - createdAt - updatedAt - status - activationDate - completionDate - } - program { - id - name - caId - } - paymentItems { - totalCount - edgeCount - edges { - node { - targetPopulation { - id - name - } - } - } - } - } - } -`; diff --git a/src/frontend/src/apollo/queries/payments/LookUpPaymentRecords.ts b/src/frontend/src/apollo/queries/payments/LookUpPaymentRecords.ts deleted file mode 100644 index 1e90199853..0000000000 --- a/src/frontend/src/apollo/queries/payments/LookUpPaymentRecords.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { gql } from '@apollo/client'; - -export const LookUpPaymentRecords = gql` - query LookUpPaymentRecords( - $parent: ID - $household: ID - $after: String - $before: String - $orderBy: String - $first: Int - $last: Int - $businessArea: String - ) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - caId - parent { - id - name - } - deliveredQuantity - } - } - totalCount - edgeCount - } - } -`; diff --git a/src/frontend/src/apollo/queries/payments/PaymentRecord.ts b/src/frontend/src/apollo/queries/payments/PaymentRecord.ts deleted file mode 100644 index 3906c3c789..0000000000 --- a/src/frontend/src/apollo/queries/payments/PaymentRecord.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { gql } from '@apollo/client'; - -export const PAYMENT_RECORD_QUERY = gql` - query PaymentRecord($id: ID!) { - paymentRecord(id: $id) { - id - status - statusDate - caId - caHashId - registrationCaId - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - verification { - id - status - statusDate - receivedAmount - isManuallyEditable - adminUrl - } - currency - entitlementQuantity - deliveredQuantity - deliveryDate - entitlementCardIssueDate - entitlementCardNumber - household { - id - size - status - unicefId - headOfHousehold { - id - unicefId - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - fullName - } - } - parent { - id - unicefId - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } - } - } - } - deliveredQuantityUsd - deliveryType { - name - } - transactionReferenceId - serviceProvider { - id - fullName - shortName - } - } - } -`; diff --git a/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.test.tsx b/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.test.tsx deleted file mode 100644 index 6b3b3cc96f..0000000000 --- a/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.test.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { render } from '../../../testUtils/testUtils'; -import { fakeCashPlan } from '../../../../fixtures/payments/fakeCashPlan'; -import { CashPlanDetails } from '.'; -import { fakeBaseUrl } from '../../../../fixtures/core/fakeBaseUrl'; - -describe('components/core/CashPlanDetails', () => { - it('should render', () => { - const { container } = render( - , - ); - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.tsx b/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.tsx deleted file mode 100644 index 390edf1528..0000000000 --- a/src/frontend/src/components/core/CashPlanDetails/CashPlanDetails.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import { Box, Grid, Typography } from '@mui/material'; -import { useTranslation } from 'react-i18next'; -import styled from 'styled-components'; -import { MiśTheme } from '../../../theme'; -import { cashPlanStatusToColor } from '@utils/utils'; -import { CashPlanNode } from '@generated/graphql'; -import { ContainerWithBorder } from '../ContainerWithBorder'; -import { ContentLink } from '../ContentLink'; -import { LabelizedField } from '../LabelizedField'; -import { OverviewContainer } from '../OverviewContainer'; -import { StatusBox } from '../StatusBox'; -import { Title } from '../Title'; -import { UniversalMoment } from '../UniversalMoment'; -import { ReactElement } from 'react'; - -const NumberOfHouseHolds = styled.div` - padding: ${({ theme }) => theme.spacing(8)}; - border-color: #b1b1b5; - border-left-width: 1px; - border-left-style: solid; -`; -const NumberOfHouseHoldsValue = styled.div` - font-family: ${({ theme }: { theme: MiśTheme }) => - theme.hctTypography.fontFamily}; - color: #253b46; - font-size: 36px; - line-height: 32px; - margin-top: ${({ theme }) => theme.spacing(2)}; -`; -interface CashPlanProps { - cashPlan: CashPlanNode; - baseUrl: string; -} - -export function CashPlanDetails({ - cashPlan, - baseUrl, -}: CashPlanProps): ReactElement { - const { t } = useTranslation(); - - const filteredTps = (): Array<{ - id: string; - name: string; - }> => { - const mappedTPs = cashPlan.paymentItems?.edges.map((edge) => ({ - id: edge.node.targetPopulation?.id, - name: edge.node.targetPopulation?.name, - })); - - const uniques = []; - for (const obj of mappedTPs) { - if (obj && !uniques.find((el) => el?.id === obj?.id)) { - uniques.push(obj); - } - } - return uniques; - }; - - const renderTargetPopulations = (): ReactElement | Array => - filteredTps().length ? ( - filteredTps().map((el) => ( - - - {el.name} - {' '} - - )) - ) : ( - - - ); - return ( - - - - <Typography variant="h6">{t('Payment Plan Details')}</Typography> - - - - - - - - - - {cashPlan?.startDate}} - /> - - - {cashPlan?.endDate}} - /> - - - - - - - - - - - - {cashPlan?.dispersionDate} - } - /> - - - - - - - - - - - - - - - {cashPlan.totalNumberOfHouseholds} - - - - - - - ); -} diff --git a/src/frontend/src/components/core/CashPlanDetails/__snapshots__/CashPlanDetails.test.tsx.snap b/src/frontend/src/components/core/CashPlanDetails/__snapshots__/CashPlanDetails.test.tsx.snap deleted file mode 100644 index cbe2a62c86..0000000000 --- a/src/frontend/src/components/core/CashPlanDetails/__snapshots__/CashPlanDetails.test.tsx.snap +++ /dev/null @@ -1,342 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/core/CashPlanDetails should render 1`] = ` -
-
-
-
-
-
- Payment Plan Details -
-
-
-
-
-
- - Status - -
- -
-
- DISTRIBUTION COMPLETED -
-
-
-
-
-
-
-
- - Plan Start Date - -
- - - -
-
-
-
-
- - Plan End Date - -
- - - -
-
-
-
-
- - Payment Plan Name - -
- - Military citizen until amount. - -
-
-
-
-
- - delivery type - -
- - Voucher - -
-
-
-
-
- - assistance through - -
- - -
-
-
-
-
- - dispertion date - -
- - - -
-
-
-
-
- - fc id - -
- - 62947144 - -
-
-
-
-
- - dp id - -
- - 27371694 - -
-
-
- -
-
-
- - Total Number of Households - -
- -
- 5 -
-
-
-
-
-
-
-
-
-
-`; diff --git a/src/frontend/src/components/core/CashPlanDetails/index.ts b/src/frontend/src/components/core/CashPlanDetails/index.ts deleted file mode 100644 index 84cc563906..0000000000 --- a/src/frontend/src/components/core/CashPlanDetails/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CashPlanDetails } from './CashPlanDetails'; diff --git a/src/frontend/src/components/dashboard/ExportModal.tsx b/src/frontend/src/components/dashboard/ExportModal.tsx deleted file mode 100644 index 1d07bd840d..0000000000 --- a/src/frontend/src/components/dashboard/ExportModal.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import { - Box, - Button, - Checkbox, - DialogContent, - DialogTitle, - Table, - TableBody, - TableCell, - TableHead, - TableRow, - Typography, -} from '@mui/material'; -import { ReactElement, useEffect, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Dialog } from '@containers/dialogs/Dialog'; -import { DialogActions } from '@containers/dialogs/DialogActions'; -import { DialogContainer } from '@containers/dialogs/DialogContainer'; -import { DialogFooter } from '@containers/dialogs/DialogFooter'; -import { DialogTitleWrapper } from '@containers/dialogs/DialogTitleWrapper'; -import { useSnackbar } from '@hooks/useSnackBar'; -import { - useCreateDashboardReportMutation, - useDashboardReportChoiceDataQuery, -} from '@generated/graphql'; -import { LoadingComponent } from '@core/LoadingComponent'; -import { useBaseUrl } from '@hooks/useBaseUrl'; - -export function ExportModal({ filter, year }): ReactElement { - const [dialogOpen, setDialogOpen] = useState(false); - const [selected, setSelected] = useState([]); - const { businessArea, programId, isAllPrograms } = useBaseUrl(); - const { showMessage } = useSnackbar(); - const { t } = useTranslation(); - const numSelected = selected.length; - const isSelected = (id: string): boolean => selected.includes(id); - - const { data: choicesData, loading: choicesLoading } = - useDashboardReportChoiceDataQuery({ variables: { businessArea } }); - const [mutate] = useCreateDashboardReportMutation(); - - useEffect(() => { - setSelected([]); - }, [businessArea]); - - if (choicesLoading) return ; - if (!choicesData) return null; - - const data = choicesData.dashboardReportTypesChoices.map((choice) => ({ - id: choice.value, - name: choice.name, - })); - - const rowCount = data.length; - - const onSelectAllClick = (event, rows): void => { - if (event.target.checked) { - const newSelecteds = rows.map((row) => row.id); - setSelected(newSelecteds); - return; - } - setSelected([]); - }; - const onCheckboxClick = (id: string): void => { - const selectedIndex = selected.indexOf(id); - const newSelected = [...selected]; - if (selectedIndex !== -1) { - newSelected.splice(selectedIndex, 1); - } else { - newSelected.push(id); - } - setSelected(newSelected); - }; - - const renderRows = (): Array => - data.map((el) => { - const isItemSelected = isSelected(el.id); - return ( - onCheckboxClick(el.id)} key={el.id}> - - onCheckboxClick(el.id)} - checked={isItemSelected} - inputProps={{ 'aria-labelledby': el.id }} - /> - - {el.name} - - ); - }); - - const submitFormHandler = (): void => { - mutate({ - variables: { - reportData: { - businessAreaSlug: businessArea, - reportTypes: selected, - year: parseInt(year, 10), - adminArea: filter.administrativeArea?.node?.id, - program: isAllPrograms ? null : programId, - }, - }, - }) - .then((response) => { - if (!response.errors && response.data.createDashboardReport.success) { - showMessage(t('Report was created.')); - } else { - showMessage(t('Report create action failed.')); - } - setSelected([]); - setDialogOpen(false); - }) - .catch((error) => { - console.error(error); - }); - }; - - return ( - <> - - setDialogOpen(false)} - scroll="paper" - aria-labelledby="form-dialog-title" - maxWidth="md" - > - - {t('Export Data')} - - - - - - {t( - 'The filters applied on the dashboard will be used for the reports.', - )} - - - - - {t('Select types of reports to be exported')}: - - - - - - - 0 && numSelected < rowCount} - checked={rowCount > 0 && numSelected === rowCount} - onChange={(event) => onSelectAllClick(event, data)} - inputProps={{ 'aria-label': 'select all' }} - /> - - {t('Report Type')} - - - {renderRows()} -
- - - {t( - 'Upon clicking export button, report will be generated and send to your email address when ready.', - )} - - -
-
- - - - - - -
- - ); -} diff --git a/src/frontend/src/components/grievances/LookUps/LookUpPaymentRecordTable/LookUpPaymentRecordTable.tsx b/src/frontend/src/components/grievances/LookUps/LookUpPaymentRecordTable/LookUpPaymentRecordTable.tsx index 55f4cc235f..71164a4293 100644 --- a/src/frontend/src/components/grievances/LookUps/LookUpPaymentRecordTable/LookUpPaymentRecordTable.tsx +++ b/src/frontend/src/components/grievances/LookUps/LookUpPaymentRecordTable/LookUpPaymentRecordTable.tsx @@ -1,10 +1,9 @@ import { MouseEvent, ReactElement, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { - LookUpPaymentRecordsQueryVariables, + AllPaymentRecordsAndPaymentsQueryVariables, PaymentRecordAndPaymentNode, useAllPaymentRecordsAndPaymentsQuery, - useLookUpPaymentRecordsQuery, } from '@generated/graphql'; import { UniversalTable } from '@containers/tables/UniversalTable'; import { useBaseUrl } from '@hooks/useBaseUrl'; @@ -64,11 +63,11 @@ export function LookUpPaymentRecordTable({ return ( headCells={headCells} - query={useLookUpPaymentRecordsQuery} - queriedObjectName="allPaymentRecords" + query={useAllPaymentRecordsAndPaymentsQuery} + queriedObjectName="allPaymentRecordsAndPayments" initialVariables={initialVariables} renderRow={(row) => ( headCells={headCells} query={useAllPaymentRecordsAndPaymentsQuery} diff --git a/src/frontend/src/components/grievances/PaymentIds.tsx b/src/frontend/src/components/grievances/PaymentIds.tsx index 4942db1802..36211cb8fe 100644 --- a/src/frontend/src/components/grievances/PaymentIds.tsx +++ b/src/frontend/src/components/grievances/PaymentIds.tsx @@ -1,6 +1,6 @@ import { Box, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; -import { PaymentRecordNode, PaymentVerificationNode } from '@generated/graphql'; +import { PaymentRecordAndPaymentNode, PaymentVerificationNode } from '@generated/graphql'; import { useBaseUrl } from '@hooks/useBaseUrl'; import { ContentLink } from '@core/ContentLink'; import { Title } from '@core/Title'; @@ -9,7 +9,7 @@ import { ReactElement } from 'react'; type VerificationId = { id: PaymentVerificationNode['id']; - caId: PaymentRecordNode['caId']; + caId: PaymentRecordAndPaymentNode['caId']; }; interface PaymentIdsProps { diff --git a/src/frontend/src/components/payments/CashPlanDetailsSection.tsx b/src/frontend/src/components/payments/CashPlanDetailsSection.tsx index 183c257dd6..55f5743687 100644 --- a/src/frontend/src/components/payments/CashPlanDetailsSection.tsx +++ b/src/frontend/src/components/payments/CashPlanDetailsSection.tsx @@ -3,7 +3,7 @@ import { Doughnut } from 'react-chartjs-2'; import { useTranslation } from 'react-i18next'; import styled from 'styled-components'; import { countPercentage } from '@utils/utils'; -import { CashPlanQuery, PaymentPlanQuery } from '@generated/graphql'; +import { PaymentPlanQuery } from '@generated/graphql'; import { BlackLink } from '@core/BlackLink'; import { LabelizedField } from '@core/LabelizedField'; import { Title } from '@core/Title'; @@ -23,7 +23,7 @@ const BorderLeftBox = styled.div` `; interface CashPlanDetailsSectionProps { - planNode: CashPlanQuery['cashPlan'] | PaymentPlanQuery['paymentPlan']; + planNode: PaymentPlanQuery['paymentPlan']; } export function CashPlanDetailsSection({ diff --git a/src/frontend/src/components/payments/ForceFailedButton.tsx b/src/frontend/src/components/payments/ForceFailedButton.tsx deleted file mode 100644 index 3a0ff80eb6..0000000000 --- a/src/frontend/src/components/payments/ForceFailedButton.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { Box, Button, DialogContent, DialogTitle } from '@mui/material'; -import { ReactElement, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Dialog } from '@containers/dialogs/Dialog'; -import { DialogActions } from '@containers/dialogs/DialogActions'; -import { DialogContainer } from '@containers/dialogs/DialogContainer'; -import { DialogFooter } from '@containers/dialogs/DialogFooter'; -import { DialogTitleWrapper } from '@containers/dialogs/DialogTitleWrapper'; -import { useSnackbar } from '@hooks/useSnackBar'; -import { useMarkPrAsFailedMutation } from '@generated/graphql'; - -export interface ForceFailedButtonProps { - paymentRecordId: string; - disabled?: boolean; -} -export function ForceFailedButton({ - paymentRecordId, - disabled = false, -}: ForceFailedButtonProps): ReactElement { - const { t } = useTranslation(); - const [isOpenModal, setOpenModal] = useState(false); - const { showMessage } = useSnackbar(); - const [mutate, { loading }] = useMarkPrAsFailedMutation(); - - const submit = async (): Promise => { - try { - await mutate({ - variables: { - paymentRecordId, - }, - }); - setOpenModal(false); - showMessage(t('Payment record has been marked as failed.')); - } catch (e) { - e.graphQLErrors.map((x) => showMessage(x.message)); - } - }; - - return ( - - - - - setOpenModal(false)} - scroll="paper" - aria-labelledby="form-dialog-title" - maxWidth="md" - > - - {t('Mark as failed')} - - - - - {t( - 'Are you sure you would like to mark payment record as failed?', - )} - - - - - - - - - - - - ); -} diff --git a/src/frontend/src/components/payments/PaymentRecordDetails.tsx b/src/frontend/src/components/payments/PaymentRecordDetails.tsx deleted file mode 100644 index 8621d6110a..0000000000 --- a/src/frontend/src/components/payments/PaymentRecordDetails.tsx +++ /dev/null @@ -1,223 +0,0 @@ -import { Grid, Paper, Typography } from '@mui/material'; -import { useTranslation } from 'react-i18next'; -import styled from 'styled-components'; -import { UniversalActivityLogTable } from '@containers/tables/UniversalActivityLogTable'; -import { - formatCurrencyWithSymbol, - getPhoneNoLabel, - paymentRecordStatusToColor, - paymentStatusDisplayMap, - verificationRecordsStatusToColor, -} from '@utils/utils'; -import { PaymentRecordNode, PaymentVerificationNode } from '@generated/graphql'; -import { ContainerColumnWithBorder } from '@core/ContainerColumnWithBorder'; -import { LabelizedField } from '@core/LabelizedField'; -import { StatusBox } from '@core/StatusBox'; -import { Title } from '@core/Title'; -import { UniversalMoment } from '@core/UniversalMoment'; -import { BlackLink } from '@core/BlackLink'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { ReactElement } from 'react'; - -const Overview = styled(Paper)` - margin: 20px; - padding: ${({ theme }) => theme.spacing(8)} - ${({ theme }) => theme.spacing(11)}; -`; - -interface PaymentRecordDetailsProps { - paymentRecord: PaymentRecordNode; - canViewActivityLog: boolean; -} - -export function PaymentRecordDetails({ - paymentRecord, - canViewActivityLog, -}: PaymentRecordDetailsProps): ReactElement { - const { t } = useTranslation(); - const { baseUrl } = useBaseUrl(); - let paymentVerification: PaymentVerificationNode = null; - if (paymentRecord.verification) { - paymentVerification = paymentRecord.verification; - } - return ( - <> - - - <Typography variant="h6">{t('Payment Record Details')}</Typography> - - - - - - - - - - - {paymentRecord.household.unicefId} - - - - - - - - - - - - {paymentVerification != null ? ( - - - <Typography variant="h6">{t('Verification Details')}</Typography> - - - - - - - - - - - - - ) : null} - - - <Typography variant="h6">{t('Household')}</Typography> - - - - - - - - - - - - - - - - - - - - - - <Typography variant="h6">{t('Entitlement Details')}</Typography> - - - - - - - - - - - - - - - - {paymentRecord.deliveryDate} - } - /> - - - - - - - - - - {paymentRecord.entitlementCardIssueDate} - - } - /> - - - - - - - {paymentVerification != null && canViewActivityLog ? ( - - ) : null} - - ); -} diff --git a/src/frontend/src/components/payments/RevertForceFailedButton.tsx b/src/frontend/src/components/payments/RevertForceFailedButton.tsx deleted file mode 100644 index 2911d0fdfb..0000000000 --- a/src/frontend/src/components/payments/RevertForceFailedButton.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { Box, Button, DialogContent, DialogTitle } from '@mui/material'; -import { ReactElement, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Field, Form, Formik } from 'formik'; -import * as Yup from 'yup'; -import CalendarTodayRoundedIcon from '@mui/icons-material/CalendarTodayRounded'; -import { Dialog } from '@containers/dialogs/Dialog'; -import { DialogActions } from '@containers/dialogs/DialogActions'; -import { DialogFooter } from '@containers/dialogs/DialogFooter'; -import { DialogTitleWrapper } from '@containers/dialogs/DialogTitleWrapper'; -import { useSnackbar } from '@hooks/useSnackBar'; -import { useRevertMarkPrAsFailedMutation } from '@generated/graphql'; -import { FormikTextField } from '@shared/Formik/FormikTextField'; -import { FormikDateField } from '@shared/Formik/FormikDateField'; - -export interface RevertForceFailedButtonProps { - paymentRecordId: string; - disabled?: boolean; -} -export function RevertForceFailedButton({ - paymentRecordId, - disabled = false, -}: RevertForceFailedButtonProps): ReactElement { - const { t } = useTranslation(); - const [isOpenModal, setOpenModal] = useState(false); - const { showMessage } = useSnackbar(); - const [mutate, { loading }] = useRevertMarkPrAsFailedMutation(); - - const validationSchema = Yup.object().shape({ - deliveredQuantity: Yup.number() - .min(0) - .max(99999999, t('Number is too big')), - deliveryDate: Yup.date().required(t('Delivery date is required')), - }); - - const submit = async (values, { resetForm }): Promise => { - try { - await mutate({ - variables: { - paymentRecordId, - deliveredQuantity: values.deliveredQuantity, - deliveryDate: values.deliveryDate, - }, - }); - setOpenModal(false); - showMessage(t('Force failed has been reverted.')); - resetForm(); - } catch (e) { - e.graphQLErrors.map((x) => showMessage(x.message)); - } - }; - - return ( - - - - - - {({ submitForm, resetForm }) => ( - setOpenModal(false)} - scroll="paper" - aria-labelledby="form-dialog-title" - maxWidth="md" - > - - {t('Revert mark as failed')} - - -
- - } - /> - -
- - - - - - -
- )} -
-
- ); -} diff --git a/src/frontend/src/components/payments/VerificationPaymentRecordDetails.tsx b/src/frontend/src/components/payments/VerificationPaymentRecordDetails.tsx deleted file mode 100644 index e0e28567d5..0000000000 --- a/src/frontend/src/components/payments/VerificationPaymentRecordDetails.tsx +++ /dev/null @@ -1,179 +0,0 @@ -import { Grid, Typography } from '@mui/material'; -import { useTranslation } from 'react-i18next'; -import { UniversalActivityLogTable } from '@containers/tables/UniversalActivityLogTable'; -import { - formatCurrencyWithSymbol, - paymentRecordStatusToColor, - paymentStatusDisplayMap, - verificationRecordsStatusToColor, -} from '@utils/utils'; -import { PaymentRecordQuery } from '@generated/graphql'; -import { ContainerColumnWithBorder } from '@core/ContainerColumnWithBorder'; -import { LabelizedField } from '@core/LabelizedField'; -import { StatusBox } from '@core/StatusBox'; -import { UniversalMoment } from '@core/UniversalMoment'; -import { BlackLink } from '@core/BlackLink'; -import { Title } from '@core/Title'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { Overview } from '@components/payments/Overview'; -import { HouseholdDetails } from '@components/payments/HouseholdDetails'; -import { useProgramContext } from '../../programContext'; -import { IndividualDetails } from '@components/payments/IndividualDetails'; -import { ReactElement } from 'react'; - -interface VerificationPaymentRecordDetailsProps { - paymentRecord: PaymentRecordQuery['paymentRecord']; - canViewActivityLog: boolean; -} - -export function VerificationPaymentRecordDetails({ - paymentRecord, - canViewActivityLog, -}: VerificationPaymentRecordDetailsProps): ReactElement { - const { t } = useTranslation(); - const { baseUrl } = useBaseUrl(); - const { isSocialDctType } = useProgramContext(); - - return ( - <> - - - <Typography variant="h6">{t('Payment Record Details')}</Typography> - - - - - - - - - - - {paymentRecord.household.unicefId} - - - - - - - - - - - - - - <Typography variant="h6">{t('Verification Details')}</Typography> - - - - - - - - - - - - - {isSocialDctType ? ( - - ) : ( - - )} - - - <Typography variant="h6">{t('Entitlement Details')}</Typography> - - - - - - - - - - - - - - - - {paymentRecord.deliveryDate} - } - /> - - - - - - - - - - {paymentRecord.entitlementCardIssueDate} - - } - /> - - - - - - - {canViewActivityLog && ( - - )} - - ); -} diff --git a/src/frontend/src/components/payments/VerificationPlanActions.tsx b/src/frontend/src/components/payments/VerificationPlanActions.tsx index d7099f4ce7..7b2d4912b0 100644 --- a/src/frontend/src/components/payments/VerificationPlanActions.tsx +++ b/src/frontend/src/components/payments/VerificationPlanActions.tsx @@ -3,7 +3,6 @@ import { GetApp } from '@mui/icons-material'; import { useTranslation } from 'react-i18next'; import styled from 'styled-components'; import { - CashPlanQuery, CashPlanVerificationSamplingChoicesQuery, PaymentPlanQuery, PaymentVerificationPlanStatus, @@ -31,7 +30,7 @@ const StyledLink = styled.a` interface VerificationPlanActionsProps { verificationPlan: PaymentPlanQuery['paymentPlan']['verificationPlans']['edges'][0]['node']; samplingChoicesData: CashPlanVerificationSamplingChoicesQuery; - planNode: CashPlanQuery['cashPlan'] | PaymentPlanQuery['paymentPlan']; + planNode: PaymentPlanQuery['paymentPlan']; } export function VerificationPlanActions({ diff --git a/src/frontend/src/components/payments/VerificationPlanDetails.tsx b/src/frontend/src/components/payments/VerificationPlanDetails.tsx index 5ac83b6808..36f42dc468 100644 --- a/src/frontend/src/components/payments/VerificationPlanDetails.tsx +++ b/src/frontend/src/components/payments/VerificationPlanDetails.tsx @@ -2,7 +2,6 @@ import { Box, Grid, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import styled from 'styled-components'; import { - CashPlanQuery, CashPlanVerificationSamplingChoicesQuery, PaymentPlanQuery, } from '@generated/graphql'; @@ -32,7 +31,7 @@ const Container = styled.div` interface VerificationPlanDetailsProps { verificationPlan: PaymentPlanQuery['paymentPlan']['verificationPlans']['edges'][0]['node']; samplingChoicesData: CashPlanVerificationSamplingChoicesQuery; - planNode: CashPlanQuery['cashPlan'] | PaymentPlanQuery['paymentPlan']; + planNode: PaymentPlanQuery['paymentPlan']; } export function VerificationPlanDetails({ diff --git a/src/frontend/src/components/payments/VerificationPlansSummary.tsx b/src/frontend/src/components/payments/VerificationPlansSummary.tsx index 86cc745475..eefb1f8ff1 100644 --- a/src/frontend/src/components/payments/VerificationPlansSummary.tsx +++ b/src/frontend/src/components/payments/VerificationPlansSummary.tsx @@ -1,7 +1,7 @@ import { Box, Grid, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { paymentVerificationStatusToColor } from '@utils/utils'; -import { CashPlanQuery, PaymentPlanQuery } from '@generated/graphql'; +import { PaymentPlanQuery } from '@generated/graphql'; import { LabelizedField } from '@core/LabelizedField'; import { StatusBox } from '@core/StatusBox'; import { Title } from '@core/Title'; @@ -9,7 +9,7 @@ import { UniversalMoment } from '@core/UniversalMoment'; import { ReactElement } from 'react'; interface VerificationPlansSummaryProps { - planNode: CashPlanQuery['cashPlan'] | PaymentPlanQuery['paymentPlan']; + planNode: PaymentPlanQuery['paymentPlan']; } export function VerificationPlansSummary({ diff --git a/src/frontend/src/containers/pages/dashboard/DashboardPage.tsx b/src/frontend/src/containers/pages/dashboard/DashboardPage.tsx index d6e4c1ac50..d66a36dacf 100644 --- a/src/frontend/src/containers/pages/dashboard/DashboardPage.tsx +++ b/src/frontend/src/containers/pages/dashboard/DashboardPage.tsx @@ -8,7 +8,6 @@ import { PageHeader } from '@components/core/PageHeader'; import { PermissionDenied } from '@components/core/PermissionDenied'; import { DashboardFilters } from '@components/dashboard/DashboardFilters'; import { DashboardPaper } from '@components/dashboard/DashboardPaper'; -import { ExportModal } from '@components/dashboard/ExportModal'; import { Tabs, Tab } from '@core/Tabs'; import { PERMISSIONS, hasPermissions } from '../../../config/permissions'; import { useBaseUrl } from '@hooks/useBaseUrl'; @@ -45,10 +44,6 @@ export function DashboardPage(): ReactElement { PERMISSIONS.DASHBOARD_VIEW_COUNTRY, permissions, ); - const hasPermissionToExport = hasPermissions( - PERMISSIONS.DASHBOARD_EXPORT, - permissions, - ); const years = data.dashboardYearsChoices; @@ -79,9 +74,6 @@ export function DashboardPage(): ReactElement { componentName="DashboardPage" > - {hasPermissionToExport && ( - - )} {hasPermissionToView ? ( <> diff --git a/src/frontend/src/containers/pages/payments/CashPlanDetailsPage.tsx b/src/frontend/src/containers/pages/payments/CashPlanDetailsPage.tsx deleted file mode 100644 index 27bb0eb6bb..0000000000 --- a/src/frontend/src/containers/pages/payments/CashPlanDetailsPage.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { Button } from '@mui/material'; -import OpenInNewRoundedIcon from '@mui/icons-material/OpenInNewRounded'; -import { useTranslation } from 'react-i18next'; -import { useLocation, useParams } from 'react-router-dom'; -import styled from 'styled-components'; -import { BreadCrumbsItem } from '@components/core/BreadCrumbs'; -import { CashPlanDetails } from '@components/core/CashPlanDetails/CashPlanDetails'; -import { LoadingComponent } from '@components/core/LoadingComponent'; -import { PageHeader } from '@components/core/PageHeader'; -import { PermissionDenied } from '@components/core/PermissionDenied'; -import { TableWrapper } from '@components/core/TableWrapper'; -import { hasPermissions, PERMISSIONS } from '../../../config/permissions'; -import { usePermissions } from '@hooks/usePermissions'; -import { isPermissionDeniedError } from '@utils/utils'; -import { - CashPlanNode, - useBusinessAreaDataQuery, - useCashAssistUrlPrefixQuery, - useCashPlanQuery, -} from '@generated/graphql'; -import { PaymentRecordTable } from '../../tables/payments/PaymentRecordTable'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { UniversalErrorBoundary } from '@components/core/UniversalErrorBoundary'; -import { ReactElement } from 'react'; - -const Container = styled.div` - && { - display: flex; - flex-direction: column; - width: 100%; - } -`; - -export function CashPlanDetailsPage(): ReactElement { - const { t } = useTranslation(); - const { id } = useParams(); - const location = useLocation(); - const permissions = usePermissions(); - const { baseUrl, isAllPrograms, businessArea } = useBaseUrl(); - const { data: businessAreaData, loading: businessAreaDataLoading } = - useBusinessAreaDataQuery({ - variables: { businessAreaSlug: businessArea }, - }); - const { data, loading, error } = useCashPlanQuery({ - variables: { id }, - fetchPolicy: 'cache-and-network', - }); - const { data: caData, loading: caPrefixLoading } = - useCashAssistUrlPrefixQuery({ fetchPolicy: 'cache-first' }); - if (loading || caPrefixLoading || businessAreaDataLoading) - return ; - if (isPermissionDeniedError(error)) return ; - if (!data || !caData || !businessAreaData || permissions === null) - return null; - - const breadCrumbsItems: BreadCrumbsItem[] = [ - { - title: data.cashPlan.program.name, - to: `/${baseUrl}/details/${data.cashPlan.program.id}/`, - }, - ]; - - if (isAllPrograms) { - breadCrumbsItems.unshift({ - title: t('Programme Management'), - to: `/${baseUrl}/list/`, - }); - } - - const cashPlan = data.cashPlan as CashPlanNode; - return ( - { - scope.setTag('location', location.pathname); - scope.setTag('component', 'CashPlanDetailsPage.tsx'); - }} - componentName="CashPlanDetailsPage" - > -
- - {!businessAreaData.businessArea.isPaymentPlanApplicable && ( - - )} - - - - - - - -
-
- ); -} diff --git a/src/frontend/src/containers/pages/payments/CashPlanVerificationDetailsPage.tsx b/src/frontend/src/containers/pages/payments/CashPlanVerificationDetailsPage.tsx deleted file mode 100644 index d369b2deb8..0000000000 --- a/src/frontend/src/containers/pages/payments/CashPlanVerificationDetailsPage.tsx +++ /dev/null @@ -1,252 +0,0 @@ -import { Button } from '@mui/material'; -import { ReactElement, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Link, useLocation, useParams } from 'react-router-dom'; -import styled from 'styled-components'; -import { - PaymentVerificationPlanStatus, - useCashPlanQuery, - useCashPlanVerificationSamplingChoicesQuery, -} from '@generated/graphql'; -import { BlackLink } from '@components/core/BlackLink'; -import { BreadCrumbsItem } from '@components/core/BreadCrumbs'; -import { LoadingComponent } from '@components/core/LoadingComponent'; -import { PageHeader } from '@components/core/PageHeader'; -import { PermissionDenied } from '@components/core/PermissionDenied'; -import { TableWrapper } from '@components/core/TableWrapper'; -import { CashPlanDetailsSection } from '@components/payments/CashPlanDetailsSection'; -import { CreateVerificationPlan } from '@components/payments/CreateVerificationPlan'; -import { VerificationPlanDetails } from '@components/payments/VerificationPlanDetails'; -import { VerificationPlansSummary } from '@components/payments/VerificationPlansSummary'; -import { PERMISSIONS, hasPermissions } from '../../../config/permissions'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { usePermissions } from '@hooks/usePermissions'; -import { - decodeIdString, - getFilterFromQueryParams, - isPermissionDeniedError, -} from '@utils/utils'; -import { UniversalActivityLogTablePaymentVerification } from '../../tables/UniversalActivityLogTablePaymentVerification'; -import { VerificationRecordsTable } from '../../tables/payments/VerificationRecordsTable'; -import { VerificationRecordsFilters } from '../../tables/payments/VerificationRecordsTable/VerificationRecordsFilters'; -import { useProgramContext } from '../../../programContext'; -import { PeopleVerificationRecordsTable } from '@containers/tables/payments/VerificationRecordsTable/People/PeopleVerificationRecordsTable'; -import { UniversalErrorBoundary } from '@components/core/UniversalErrorBoundary'; - -const Container = styled.div` - display: flex; - flex: 1; - width: 100%; - background-color: #fff; - padding: 32px 44px; - flex-direction: column; - border-color: #b1b1b5; - border-bottom-width: 1px; - border-bottom-style: solid; -`; - -const BottomTitle = styled.div` - color: rgba(0, 0, 0, 0.38); - font-size: 24px; - line-height: 28px; - text-align: center; - padding: 70px; -`; - -const initialFilter = { - search: '', - status: '', - verificationChannel: '', - paymentVerificationPlan: '', -}; - -export function CashPlanVerificationDetailsPage(): ReactElement { - const { t } = useTranslation(); - const { isSocialDctType } = useProgramContext(); - const permissions = usePermissions(); - - const { baseUrl, businessArea, isAllPrograms } = useBaseUrl(); - const location = useLocation(); - - const [filter, setFilter] = useState( - getFilterFromQueryParams(location, initialFilter), - ); - const [appliedFilter, setAppliedFilter] = useState( - getFilterFromQueryParams(location, initialFilter), - ); - - const { id } = useParams(); - const { data, loading, error } = useCashPlanQuery({ - variables: { id }, - fetchPolicy: 'cache-and-network', - }); - const { data: choicesData, loading: choicesLoading } = - useCashPlanVerificationSamplingChoicesQuery(); - - if (loading || choicesLoading) return ; - - if (isPermissionDeniedError(error)) return ; - if (!data || !choicesData || permissions === null) return null; - - const { cashPlan } = data; - - const breadCrumbsItems: BreadCrumbsItem[] = [ - { - title: 'Payment Verification', - to: `/${baseUrl}/payment-verification`, - }, - ]; - - const canCreate = hasPermissions( - PERMISSIONS.PAYMENT_VERIFICATION_CREATE, - permissions, - ); - - const statesArray = cashPlan.verificationPlans?.edges?.map( - (v) => v.node.status, - ); - - const canSeeVerificationRecords = (): boolean => { - const showTable = - statesArray.includes(PaymentVerificationPlanStatus.Finished) || - statesArray.includes(PaymentVerificationPlanStatus.Active); - - return showTable && statesArray.length > 0; - }; - const canSeeCreationMessage = (): boolean => statesArray.length === 0; - - const canSeeActivationMessage = (): boolean => - !canSeeVerificationRecords() && !canSeeCreationMessage(); - - const isFinished = - cashPlan?.paymentVerificationSummary?.status === 'FINISHED'; - - const toolbar = ( - - {t('Payment Plan')} {cashPlan.caId} - - } - breadCrumbs={ - hasPermissions(PERMISSIONS.PAYMENT_VERIFICATION_VIEW_LIST, permissions) - ? breadCrumbsItems - : null - } - > - <> - {canCreate && ( - - )} - - {isFinished && - (isAllPrograms ? ( - - ) : null)} - - - ); - - const renderVerificationRecordsTable = () => { - if (isSocialDctType) { - return ( - - ); - } - return ( - - ); - }; - - return ( - { - scope.setTag('location', location.pathname); - scope.setTag('component', 'CashPlanVerificationDetailsPage.tsx'); - }} - componentName="CashPlanVerificationDetailsPage" - > - {toolbar} - - - - - - - {cashPlan.verificationPlans?.edges?.length - ? cashPlan.verificationPlans.edges.map((edge) => ( - - )) - : null} - {canSeeVerificationRecords() ? ( - <> - - - - {renderVerificationRecordsTable()} - - ) : null} - {canSeeActivationMessage() ? ( - - {t('To see more details please activate Verification Plan')} - - ) : null} - {canSeeCreationMessage() ? ( - - {t('To see more details please create Verification Plan')} - - ) : null} - {cashPlan.verificationPlans?.edges[0]?.node?.id && - hasPermissions(PERMISSIONS.ACTIVITY_LOG_VIEW, permissions) && ( - - )} - - ); -} diff --git a/src/frontend/src/containers/pages/payments/CashplanVerificationRedirectPage.tsx b/src/frontend/src/containers/pages/payments/CashplanVerificationRedirectPage.tsx deleted file mode 100644 index ab851389cf..0000000000 --- a/src/frontend/src/containers/pages/payments/CashplanVerificationRedirectPage.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { FC, useEffect } from 'react'; -import { useParams, useNavigate } from 'react-router-dom'; -import { usePaymentVerificationPlanQuery } from '@generated/graphql'; -import { useBaseUrl } from '@hooks/useBaseUrl'; - -export const CashPlanVerificationRedirectPage: FC = () => { - const { id } = useParams(); - const { data, loading } = usePaymentVerificationPlanQuery({ - variables: { id }, - }); - const { baseUrl } = useBaseUrl(); - const navigate = useNavigate(); - - useEffect(() => { - if (!loading && data) { - navigate( - `/${baseUrl}/payment-verification/${data.paymentVerificationPlan.id}`, - ); - } - }, [loading, data, navigate, baseUrl]); - - if (loading) { - return null; - } - - return null; -}; diff --git a/src/frontend/src/containers/pages/payments/PaymentRecordDetailsPage.tsx b/src/frontend/src/containers/pages/payments/PaymentRecordDetailsPage.tsx deleted file mode 100644 index ee3a85bf21..0000000000 --- a/src/frontend/src/containers/pages/payments/PaymentRecordDetailsPage.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import { Box, Button } from '@mui/material'; -import OpenInNewRoundedIcon from '@mui/icons-material/OpenInNewRounded'; -import { useTranslation } from 'react-i18next'; -import { useLocation, useParams } from 'react-router-dom'; -import { BreadCrumbsItem } from '@components/core/BreadCrumbs'; -import { LoadingComponent } from '@components/core/LoadingComponent'; -import { PageHeader } from '@components/core/PageHeader'; -import { PermissionDenied } from '@components/core/PermissionDenied'; -import { PaymentRecordDetails } from '@components/payments/PaymentRecordDetails'; -import { hasPermissions, PERMISSIONS } from '../../../config/permissions'; -import { usePermissions } from '@hooks/usePermissions'; -import { - PaymentRecordNode, - PaymentRecordStatus, - useBusinessAreaDataQuery, - useCashAssistUrlPrefixQuery, - usePaymentRecordQuery, -} from '@generated/graphql'; -import { ForceFailedButton } from '@components/payments/ForceFailedButton'; -import { RevertForceFailedButton } from '@components/payments/RevertForceFailedButton'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { UniversalErrorBoundary } from '@components/core/UniversalErrorBoundary'; -import { ReactElement } from 'react'; - -export function PaymentRecordDetailsPage(): ReactElement { - const { t } = useTranslation(); - const location = useLocation(); - const { id } = useParams(); - const { businessArea } = useBaseUrl(); - const { data: businessAreaData, loading: businessAreaDataLoading } = - useBusinessAreaDataQuery({ - variables: { businessAreaSlug: businessArea }, - }); - const { data: caData, loading: caLoading } = useCashAssistUrlPrefixQuery({ - fetchPolicy: 'cache-first', - }); - - const { data, loading } = usePaymentRecordQuery({ - variables: { id }, - fetchPolicy: 'cache-and-network', - }); - const permissions = usePermissions(); - const { baseUrl, isAllPrograms } = useBaseUrl(); - if (loading || caLoading || businessAreaDataLoading) - return ; - if (permissions === null) return null; - if ( - !hasPermissions( - PERMISSIONS.PROGRAMME_VIEW_PAYMENT_RECORD_DETAILS, - permissions, - ) - ) - return ; - - if (!data || !caData || !businessAreaData) return null; - - const breadCrumbsItems: BreadCrumbsItem[] = [ - { - title: data.paymentRecord.parent.program.name, - to: `/${baseUrl}/details/${data.paymentRecord.parent.program.id}/`, - }, - { - title: `Payment Plan #${data.paymentRecord.parent.caId}`, - to: `/${baseUrl}/cashplans/${data.paymentRecord.parent.id}`, - }, - ]; - if (isAllPrograms) { - breadCrumbsItems.unshift({ - title: t('Programme Management'), - to: `/${baseUrl}/list/`, - }); - } - const paymentRecord = data.paymentRecord as PaymentRecordNode; - - const renderButtons = (): Array => { - const buttons: Array = []; - - if ( - hasPermissions( - PERMISSIONS.PAYMENT_VERIFICATION_MARK_AS_FAILED, - permissions, - ) - ) { - const ButtonComponent = - paymentRecord.status === PaymentRecordStatus.ForceFailed - ? RevertForceFailedButton - : ForceFailedButton; - buttons.push( - , - ); - } - - if (!businessAreaData.businessArea.isPaymentPlanApplicable) { - buttons.push( - , - ); - } - return buttons; - }; - - return ( - { - scope.setTag('location', location.pathname); - scope.setTag('component', 'PaymentRecordDetailsPage.tsx'); - }} - componentName="PaymentRecordDetailsPage" - > - {' '} - - <>{renderButtons()} - - - - - - ); -} diff --git a/src/frontend/src/containers/pages/payments/VerificationPaymentRecordDetailsPage.tsx b/src/frontend/src/containers/pages/payments/VerificationPaymentRecordDetailsPage.tsx deleted file mode 100644 index a64bc25bf5..0000000000 --- a/src/frontend/src/containers/pages/payments/VerificationPaymentRecordDetailsPage.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import { useParams, useLocation } from 'react-router-dom'; -import { - PaymentVerificationPlanStatus, - usePaymentRecordQuery, - usePaymentVerificationChoicesQuery, -} from '@generated/graphql'; -import { BreadCrumbsItem } from '@components/core/BreadCrumbs'; -import { LoadingComponent } from '@components/core/LoadingComponent'; -import { PageHeader } from '@components/core/PageHeader'; -import { PermissionDenied } from '@components/core/PermissionDenied'; -import { VerificationPaymentRecordDetails } from '@components/payments/VerificationPaymentRecordDetails'; -import { VerifyManual } from '@components/payments/VerifyManual'; -import { hasPermissions, PERMISSIONS } from '../../../config/permissions'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { usePermissions } from '@hooks/usePermissions'; -import { isPermissionDeniedError } from '@utils/utils'; -import { AdminButton } from '@core/AdminButton'; -import { UniversalErrorBoundary } from '@components/core/UniversalErrorBoundary'; -import { ReactElement } from 'react'; - -export function VerificationPaymentRecordDetailsPage(): ReactElement { - const { t } = useTranslation(); - const { id } = useParams(); - const permissions = usePermissions(); - const location = useLocation(); - const { data, loading, error } = usePaymentRecordQuery({ - variables: { id }, - fetchPolicy: 'cache-and-network', - }); - const { data: choicesData, loading: choicesLoading } = - usePaymentVerificationChoicesQuery(); - const { baseUrl } = useBaseUrl(); - if (loading || choicesLoading) return ; - if (isPermissionDeniedError(error)) return ; - const { paymentRecord } = data; - if (!paymentRecord || !choicesData || permissions === null) return null; - - const { verificationPlans } = paymentRecord?.parent || {}; - const verificationPlansAmount = verificationPlans?.edges.length; - const verification = - verificationPlans.edges[verificationPlansAmount - 1].node; - - const breadCrumbsItems: BreadCrumbsItem[] = [ - ...(hasPermissions(PERMISSIONS.PAYMENT_VERIFICATION_VIEW_LIST, permissions) - ? [ - { - title: t('Payment Verification'), - to: `/${baseUrl}/payment-verification`, - }, - ] - : []), - ...(hasPermissions( - PERMISSIONS.PAYMENT_VERIFICATION_VIEW_DETAILS, - permissions, - ) - ? [ - { - title: `${t('Payment Plan')} ${paymentRecord.parent.unicefId}`, - to: `/${baseUrl}/payment-verification/cash-plan/${paymentRecord.parent.id}`, - }, - ] - : []), - ]; - - const toolbar = ( - } - > - {verification?.verificationChannel === 'MANUAL' && - hasPermissions(PERMISSIONS.PAYMENT_VERIFICATION_VERIFY, permissions) && - verification?.status !== PaymentVerificationPlanStatus.Finished ? ( - - ) : null} - - ); - return ( - { - scope.setTag('location', location.pathname); - scope.setTag('component', 'VerificationPaymentRecordDetailsPage.tsx'); - }} - componentName="VerificationPaymentRecordDetailsPage" - > -
- {toolbar} - -
-
- ); -} diff --git a/src/frontend/src/containers/routers/PaymentVerificationRoutes.tsx b/src/frontend/src/containers/routers/PaymentVerificationRoutes.tsx index 1caf24011c..ff9b0e6d87 100644 --- a/src/frontend/src/containers/routers/PaymentVerificationRoutes.tsx +++ b/src/frontend/src/containers/routers/PaymentVerificationRoutes.tsx @@ -1,23 +1,11 @@ import { useRoutes } from 'react-router-dom'; -import { CashPlanDetailsPage } from '../pages/payments/CashPlanDetailsPage'; -import { CashPlanVerificationDetailsPage } from '../pages/payments/CashPlanVerificationDetailsPage'; -import { CashPlanVerificationRedirectPage } from '../pages/payments/CashplanVerificationRedirectPage'; import { PaymentPlanVerificationDetailsPage } from '../pages/payments/PaymentPlanVerificationDetailsPage'; import { PaymentVerificationPage } from '../pages/payments/PaymentVerificationPage'; import { VerificationPaymentDetailsPage } from '../pages/payments/VerificationPaymentDetailsPage'; -import { VerificationPaymentRecordDetailsPage } from '../pages/payments/VerificationPaymentRecordDetailsPage'; import { ReactElement } from 'react'; export const PaymentVerificationRoutes = (): ReactElement => { const paymentVerificationRoutes = [ - { - path: 'cashplans/:id', - element: , - }, - { - path: 'verification/payment-record/:id', - element: , - }, { path: 'verification/payment/:id', element: , @@ -26,18 +14,10 @@ export const PaymentVerificationRoutes = (): ReactElement => { path: 'payment-verification', element: , }, - { - path: 'payment-verification/cash-plan/:id', - element: , - }, { path: 'payment-verification/payment-plan/:paymentPlanId', element: , }, - { - path: 'csh-payment-verification/:id', - element: , - }, ]; return useRoutes(paymentVerificationRoutes); diff --git a/src/frontend/src/containers/routers/SelectedProgramRoutesSwitch.tsx b/src/frontend/src/containers/routers/SelectedProgramRoutesSwitch.tsx index e53c2a0fc7..4b0df90ba5 100644 --- a/src/frontend/src/containers/routers/SelectedProgramRoutesSwitch.tsx +++ b/src/frontend/src/containers/routers/SelectedProgramRoutesSwitch.tsx @@ -1,7 +1,6 @@ import { useRoutes } from 'react-router-dom'; import { ActivityLogPage } from '../pages/core/MainActivityLogPage'; import { UsersPage } from '../pages/core/UsersPage'; -import { PaymentRecordDetailsPage } from '../pages/payments/PaymentRecordDetailsPage'; import { ReportingDetailsPage } from '../pages/reporting/ReportingDetailsPage'; import { ReportingPage } from '../pages/reporting/ReportingPage'; import { GrievanceRoutes } from './GrievanceRoutes'; @@ -21,10 +20,6 @@ export const SelectedProgramRoutesSwitch = (): ReactElement => { path: 'country-dashboard', element: , }, - { - path: 'payment-records/:id', - element: , - }, { path: 'reporting/:id', element: , diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.test.tsx b/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.test.tsx deleted file mode 100644 index f8142bbdbd..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.test.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { MockedProvider } from '@apollo/react-testing'; - -import { act } from 'react'; -import wait from 'waait'; -import { render, ApolloLoadingLink } from '../../../../testUtils/testUtils'; -import { fakeApolloAllCashPlansAndPaymentPlans } from '../../../../../fixtures/payments/fakeApolloAllCashPlansAndPaymentPlansForProgram'; -import { fakeProgram } from '../../../../../fixtures/programs/fakeProgram'; -import { CashPlanTable } from '.'; - -describe('containers/tables/payments/CashPlanTable', () => { - it('should render with data', async () => { - const { container } = render( - - - , - ); - await act(() => wait(0)); // wait for response - - expect(container).toMatchSnapshot(); - }); - - it('should render loading', () => { - const { container } = render( - - - , - ); - - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.tsx b/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.tsx deleted file mode 100644 index 61d29967cb..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTable.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { ReactElement } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - AllCashPlansAndPaymentPlansQueryVariables, - CashPlanAndPaymentPlanNode, - ProgramQuery, - useAllCashPlansAndPaymentPlansQuery, -} from '@generated/graphql'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { UniversalTable } from '../../UniversalTable'; -import { headCells } from './CashPlanTableHeadCells'; -import { CashPlanTableRow } from './CashPlanTableRow'; - -interface CashPlanTableProps { - program: ProgramQuery['program']; -} - -export function CashPlanTable({ program }: CashPlanTableProps): ReactElement { - const { t } = useTranslation(); - const { businessArea } = useBaseUrl(); - const initialVariables = { - program: program.id, - businessArea, - isPaymentVerificationPage: false, - }; - - return ( - - title={t('Payment Plans')} - headCells={headCells} - query={useAllCashPlansAndPaymentPlansQuery} - queriedObjectName="allCashPlansAndPaymentPlans" - initialVariables={initialVariables} - renderRow={(cashPlanAndPaymentPlanNode) => ( - - )} - /> - ); -} diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableHeadCells.tsx b/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableHeadCells.tsx deleted file mode 100644 index 4a816841ee..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableHeadCells.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { HeadCell } from '@components/core/Table/EnhancedTableHead'; -import { CashPlanAndPaymentPlanNode } from '@generated/graphql'; - -export const headCells: HeadCell[] = [ - { - disablePadding: false, - label: 'Payment Plan ID', - id: 'unicef_id', - numeric: false, - }, - { - disablePadding: false, - label: 'Status', - id: 'status', - numeric: false, - }, - { - disablePadding: false, - label: 'Num. of Payments', - id: 'total_number_of_households', - numeric: true, - }, - { - disablePadding: false, - label: 'Currency', - id: 'currency_order', - numeric: false, - }, - { - disablePadding: false, - label: 'Total Entitled Quantity', - id: 'total_entitled_quantity_order', - numeric: true, - }, - { - disablePadding: false, - label: 'Total Delivered Quantity', - id: 'total_delivered_quantity_order', - numeric: true, - }, - { - disablePadding: false, - label: 'Total Undelivered Quantity', - id: 'total_undelivered_quantity_order', - numeric: true, - }, - { - disablePadding: false, - label: 'Dispersion Date', - id: 'dispersion_date', - numeric: false, - }, -]; diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableRow.tsx b/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableRow.tsx deleted file mode 100644 index 10f1425539..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/CashPlanTableRow.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import TableCell from '@mui/material/TableCell'; -import { useNavigate } from 'react-router-dom'; -import { CashPlanAndPaymentPlanNode } from '@generated/graphql'; -import { BlackLink } from '@components/core/BlackLink'; -import { StatusBox } from '@components/core/StatusBox'; -import { ClickableTableRow } from '@components/core/Table/ClickableTableRow'; -import { UniversalMoment } from '@components/core/UniversalMoment'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { paymentPlanStatusToColor, renderSomethingOrDash } from '@utils/utils'; -import { ReactElement } from 'react'; - -interface CashPlanTableRowProps { - cashAndPaymentPlan: CashPlanAndPaymentPlanNode; -} - -export function CashPlanTableRow({ - cashAndPaymentPlan, -}: CashPlanTableRowProps): ReactElement { - const navigate = useNavigate(); - const { baseUrl, isAllPrograms } = useBaseUrl(); - const objectPath = - cashAndPaymentPlan.objType === 'PaymentPlan' - ? `/${baseUrl}/payment-module/payment-plans/${cashAndPaymentPlan.id}` - : `/${baseUrl}/cashplans/${cashAndPaymentPlan.id}`; - - const handleClick = (): void => { - navigate(objectPath); - }; - return ( - - - {!isAllPrograms ? ( - -
{cashAndPaymentPlan.unicefId}
-
- ) : ( -
{cashAndPaymentPlan.unicefId}
- )} -
- - - - - {cashAndPaymentPlan.totalNumberOfHouseholds} - - {cashAndPaymentPlan.currency} - - {renderSomethingOrDash( - cashAndPaymentPlan?.totalEntitledQuantity?.toLocaleString('en-US', { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }), - )} - - - {renderSomethingOrDash( - cashAndPaymentPlan?.totalDeliveredQuantity?.toLocaleString('en-US', { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }), - )} - - - {renderSomethingOrDash( - cashAndPaymentPlan?.totalUndeliveredQuantity?.toLocaleString( - 'en-US', - { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }, - ), - )} - - - {cashAndPaymentPlan.dispersionDate} - -
- ); -} diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/__snapshots__/CashPlanTable.test.tsx.snap b/src/frontend/src/containers/tables/payments/CashPlanTable/__snapshots__/CashPlanTable.test.tsx.snap deleted file mode 100644 index 543d892f64..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/__snapshots__/CashPlanTable.test.tsx.snap +++ /dev/null @@ -1,1068 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`containers/tables/payments/CashPlanTable should render loading 1`] = ` -
-
-
-
-
-
-
- Payment Plans -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Payment Plan ID - - - - - Status - - - - - Num. of Payments - - - - - Currency - - - - - Total Entitled Quantity - - - - - Total Delivered Quantity - - - - - Total Undelivered Quantity - - - - - Dispersion Date - - -
- -
- -
- -
- -
- -
-
-
-
-
-

- Rows per page: -

-
- - - -
-

- 0–0 of 0 -

-
- - -
-
-
-
-
-
-`; - -exports[`containers/tables/payments/CashPlanTable should render with data 1`] = ` -
-
-
-
-
-
-
- Payment Plans -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Payment Plan ID - - - - - Status - - - - - Num. of Payments - - - - - Currency - - - - - Total Entitled Quantity - - - - - Total Delivered Quantity - - - - - Total Undelivered Quantity - - - - - Dispersion Date - - -
- -
- -
- -
- -
-
-
-
-
-

- Rows per page: -

-
- - - -
-

- 1–5 of 7 -

-
- - -
-
-
-
-
-
-`; diff --git a/src/frontend/src/containers/tables/payments/CashPlanTable/index.ts b/src/frontend/src/containers/tables/payments/CashPlanTable/index.ts deleted file mode 100644 index e3ddb705a4..0000000000 --- a/src/frontend/src/containers/tables/payments/CashPlanTable/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { CashPlanTable } from './CashPlanTable'; - -export { CashPlanTable }; diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.test.tsx b/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.test.tsx deleted file mode 100644 index dbe131c873..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { MockedProvider } from '@apollo/react-testing'; -import { act } from 'react'; - -import wait from 'waait'; -import { PaymentRecordTable } from '.'; -import { fakeApolloAllPaymentRecords } from '../../../../../fixtures/payments/fakeApolloAllPaymentRecords'; -import { fakeCashPlan } from '../../../../../fixtures/payments/fakeCashPlan'; -import { ApolloLoadingLink, render } from '../../../../testUtils/testUtils'; - -describe('containers/tables/payments/PaymentRecordTable', () => { - it('should render with data', async () => { - const { container } = render( - - - , - ); - await act(() => wait(0)); // wait for response - - expect(container).toMatchSnapshot(); - }); - - it('should render loading', () => { - const { container } = render( - - - , - ); - - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.tsx b/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.tsx deleted file mode 100644 index 327f435bee..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTable.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { ReactElement } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - AllPaymentRecordsQueryVariables, - CashPlanNode, - PaymentRecordNode, - useAllPaymentRecordsQuery, -} from '@generated/graphql'; -import { UniversalTable } from '../../UniversalTable'; -import { headCells } from './PaymentRecordTableHeadCells'; -import { PaymentRecordTableRow } from './PaymentRecordTableRow'; - -interface PaymentRecordTableProps { - cashPlan: CashPlanNode; - openInNewTab?: boolean; -} -export function PaymentRecordTable({ - cashPlan, - openInNewTab = false, -}: PaymentRecordTableProps): ReactElement { - const { t } = useTranslation(); - const initialVariables: AllPaymentRecordsQueryVariables = { - parent: cashPlan.id, - }; - return ( - - title={t('Payment Records')} - headCells={headCells} - query={useAllPaymentRecordsQuery} - queriedObjectName="allPaymentRecords" - initialVariables={initialVariables} - renderRow={(row) => ( - - )} - /> - ); -} diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableHeadCells.tsx b/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableHeadCells.tsx deleted file mode 100644 index 863f427d97..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableHeadCells.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { HeadCell } from '@components/core/Table/EnhancedTableHead'; -import { PaymentRecordNode } from '@generated/graphql'; - -export const headCells: HeadCell[] = [ - { - disablePadding: false, - label: 'Payment ID', - id: 'ca_id', - numeric: false, - }, - { - disablePadding: false, - label: 'Status', - id: 'status', - numeric: false, - }, - { - disablePadding: false, - label: 'Head of Household', - id: 'head_of_household__full_name', - numeric: false, - }, - { - disablePadding: false, - label: 'Household ID', - id: 'household__unicef_id', - numeric: false, - }, - { - disablePadding: false, - label: 'Household Status', - id: 'household__status', - numeric: false, - }, - { - disablePadding: false, - label: 'Household Size', - id: 'household__size', - numeric: false, - }, - { - disablePadding: false, - label: 'Entitlement Quantity', - id: 'entitlement_quantity', - numeric: true, - }, - { - disablePadding: false, - label: 'Delivered Quantity', - id: 'delivered_quantity', - numeric: true, - }, - { - disablePadding: false, - label: 'Delivery Date', - id: 'delivery_date', - numeric: true, - }, -]; diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableRow.tsx b/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableRow.tsx deleted file mode 100644 index 5472ae825a..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/PaymentRecordTableRow.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import TableCell from '@mui/material/TableCell'; -import { useNavigate } from 'react-router-dom'; -import { BlackLink } from '@components/core/BlackLink'; -import { StatusBox } from '@components/core/StatusBox'; -import { AnonTableCell } from '@components/core/Table/AnonTableCell'; -import { ClickableTableRow } from '@components/core/Table/ClickableTableRow'; -import { UniversalMoment } from '@components/core/UniversalMoment'; -import { - formatCurrencyWithSymbol, - householdStatusToColor, - paymentRecordStatusToColor, - paymentStatusDisplayMap, -} from '@utils/utils'; -import { PaymentRecordNode } from '@generated/graphql'; -import { useBaseUrl } from '@hooks/useBaseUrl'; -import { ReactElement } from 'react'; - -interface PaymentRecordTableRowProps { - paymentRecord: PaymentRecordNode; - openInNewTab: boolean; -} - -export function PaymentRecordTableRow({ - paymentRecord, - openInNewTab, -}: PaymentRecordTableRowProps): ReactElement { - const { baseUrl } = useBaseUrl(); - const navigate = useNavigate(); - const paymentRecordPath = `/${baseUrl}/payment-records/${paymentRecord.id}`; - const handleClick = (): void => { - if (openInNewTab) { - window.open(paymentRecordPath); - } else { - navigate(paymentRecordPath); - } - }; - return ( - - - {paymentRecord.caId} - - - - - {paymentRecord.headOfHousehold?.fullName} - {paymentRecord.household.unicefId} - - - - {paymentRecord.household.size} - - {formatCurrencyWithSymbol( - paymentRecord.entitlementQuantity, - paymentRecord.currency, - )} - - - {formatCurrencyWithSymbol( - paymentRecord.deliveredQuantity, - paymentRecord.currency, - )} - - - {paymentRecord.deliveryDate} - - - ); -} diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/__snapshots__/PaymentRecordTable.test.tsx.snap b/src/frontend/src/containers/tables/payments/PaymentRecordTable/__snapshots__/PaymentRecordTable.test.tsx.snap deleted file mode 100644 index 263f8d9a7a..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/__snapshots__/PaymentRecordTable.test.tsx.snap +++ /dev/null @@ -1,923 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`containers/tables/payments/PaymentRecordTable should render loading 1`] = ` -
-
-
-
-
-
-
- Payment Records -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Payment ID - - - - - Status - - - - - Head of Household - - - - - Household ID - - - - - Household Status - - - - - Household Size - - - - - Entitlement Quantity - - - - - Delivered Quantity - - - - - Delivery Date - - -
- -
- -
- -
- -
- -
-
-
-
-
-

- Rows per page: -

-
- - - -
-

- 0–0 of 0 -

-
- - -
-
-
-
-
-
-`; - -exports[`containers/tables/payments/PaymentRecordTable should render with data 1`] = ` -
-
-
-
-
-
-
- Payment Records -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Payment ID - - - - - Status - - - - - Head of Household - - - - - Household ID - - - - - Household Status - - - - - Household Size - - - - - Entitlement Quantity - - - - - Delivered Quantity - - - - - Delivery Date - - -
- -
- -
- -
- -
-
-
-
-
-

- Rows per page: -

-
- - - -
-

- 1–5 of 5 -

-
- - -
-
-
-
-
-
-`; diff --git a/src/frontend/src/containers/tables/payments/PaymentRecordTable/index.ts b/src/frontend/src/containers/tables/payments/PaymentRecordTable/index.ts deleted file mode 100644 index 252941ad01..0000000000 --- a/src/frontend/src/containers/tables/payments/PaymentRecordTable/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { PaymentRecordTable } from './PaymentRecordTable'; - -export { PaymentRecordTable }; diff --git a/src/frontend/src/containers/tables/payments/VerificationRecordsTable/People/PeopleVerificationRecordsTableRow.tsx b/src/frontend/src/containers/tables/payments/VerificationRecordsTable/People/PeopleVerificationRecordsTableRow.tsx index d35bc70c26..c7fb5df1a9 100644 --- a/src/frontend/src/containers/tables/payments/VerificationRecordsTable/People/PeopleVerificationRecordsTableRow.tsx +++ b/src/frontend/src/containers/tables/payments/VerificationRecordsTable/People/PeopleVerificationRecordsTableRow.tsx @@ -27,7 +27,7 @@ export function PeopleVerificationRecordsTableRow({ const nodeType = atob(paymentVerification.payment.id).split(':')[0]; const linkPath = `/${baseUrl}/verification/payment${ - nodeType === 'PaymentRecordNode' ? '-record' : '' + nodeType === 'PaymentRecordAndPaymentNode' ? '-record' : '' }/${paymentVerification.payment.id}`; return ( diff --git a/src/frontend/src/containers/tables/payments/VerificationRecordsTable/VerificationRecordsTableRow.tsx b/src/frontend/src/containers/tables/payments/VerificationRecordsTable/VerificationRecordsTableRow.tsx index e46a01d619..6b90018463 100644 --- a/src/frontend/src/containers/tables/payments/VerificationRecordsTable/VerificationRecordsTableRow.tsx +++ b/src/frontend/src/containers/tables/payments/VerificationRecordsTable/VerificationRecordsTableRow.tsx @@ -29,7 +29,7 @@ export function VerificationRecordsTableRow({ const nodeType = atob(paymentVerification.payment.id).split(':')[0]; const linkPath = `/${baseUrl}/verification/payment${ - nodeType === 'PaymentRecordNode' ? '-record' : '' + nodeType === 'PaymentRecordAndPaymentNode' ? '-record' : '' }/${paymentVerification.payment.id}`; return ( diff --git a/src/frontend/src/hooks/usePaymentRefetchQueries.ts b/src/frontend/src/hooks/usePaymentRefetchQueries.ts index c1c6ba701f..832ee9aff4 100644 --- a/src/frontend/src/hooks/usePaymentRefetchQueries.ts +++ b/src/frontend/src/hooks/usePaymentRefetchQueries.ts @@ -1,7 +1,6 @@ import { DocumentNode } from 'graphql'; import { AllPaymentVerificationsDocument, - CashPlanDocument, PaymentPlanDocument, } from '@generated/graphql'; import { useBaseUrl } from './useBaseUrl'; @@ -16,7 +15,6 @@ export const usePaymentRefetchQueries = ( { query: DocumentNode; variables: { id: string } }, ]) => { const { businessArea } = useBaseUrl(); - const planType = atob(paymentPlanId).split(':')[0]; return () => [ { @@ -33,8 +31,7 @@ export const usePaymentRefetchQueries = ( }, }, { - query: - planType === 'PaymentPlanNode' ? PaymentPlanDocument : CashPlanDocument, + query: PaymentPlanDocument, variables: { id: paymentPlanId }, }, ]; diff --git a/src/frontend/src/utils/utils.ts b/src/frontend/src/utils/utils.ts index 08ba582a88..dd702ec5be 100644 --- a/src/frontend/src/utils/utils.ts +++ b/src/frontend/src/utils/utils.ts @@ -10,7 +10,6 @@ import { ChoiceObject, PaymentPlanBackgroundActionStatus, PaymentPlanStatus, - PaymentRecordStatus, PaymentStatus, ProgramStatus, TargetPopulationBuildStatus, @@ -135,12 +134,12 @@ export function paymentRecordStatusToColor( status: string, ): string { switch (status) { - case PaymentRecordStatus.Pending: + case PaymentStatus.Pending: return theme.hctPalette.orange; - case PaymentRecordStatus.DistributionSuccessful: - case PaymentRecordStatus.TransactionSuccessful: + case PaymentStatus.DistributionSuccessful: + case PaymentStatus.TransactionSuccessful: return theme.hctPalette.green; - case PaymentRecordStatus.PartiallyDistributed: + case PaymentStatus.PartiallyDistributed: return theme.hctPalette.lightBlue; default: return theme.palette.error.main; @@ -169,19 +168,14 @@ export function paymentStatusToColor( export function paymentStatusDisplayMap(status: string): string { switch (status) { case PaymentStatus.Pending: - case PaymentRecordStatus.Pending: return 'PENDING'; case PaymentStatus.DistributionSuccessful: case PaymentStatus.TransactionSuccessful: - case PaymentRecordStatus.DistributionSuccessful: - case PaymentRecordStatus.TransactionSuccessful: return 'DELIVERED FULLY'; case PaymentStatus.PartiallyDistributed: return 'DELIVERED PARTIALLY'; - case PaymentRecordStatus.NotDistributed: case PaymentStatus.NotDistributed: return 'NOT DELIVERED'; - case PaymentRecordStatus.ForceFailed: case PaymentStatus.ForceFailed: return 'FORCE FAILED'; case PaymentStatus.ManuallyCancelled: diff --git a/src/hct_mis_api/apps/core/exchange_rates/utils.py b/src/hct_mis_api/apps/core/exchange_rates/utils.py index 2b68ff44b6..1d67b87654 100644 --- a/src/hct_mis_api/apps/core/exchange_rates/utils.py +++ b/src/hct_mis_api/apps/core/exchange_rates/utils.py @@ -1,8 +1,5 @@ import logging from decimal import Decimal -from typing import Any, Optional - -from django.db.models import Q from hct_mis_api.apps.core.exchange_rates import ExchangeRates from hct_mis_api.apps.payment.models import PaymentRecord @@ -10,20 +7,6 @@ logger = logging.getLogger(__name__) -def fix_exchange_rates(all: Optional[Any] = None) -> None: - all_payment_records = PaymentRecord.objects.all() - if not all: - all_payment_records = all_payment_records.filter( - Q(delivered_quantity_usd__isnull=True) | Q(delivered_quantity_usd=0) - ) - exchange_rates_client = ExchangeRates() - - for payment_record in all_payment_records: - calculate_delivery_quantity_in_usd(exchange_rates_client, payment_record) - - PaymentRecord.objects.bulk_update(all_payment_records, ["delivered_quantity_usd"], 1000) - - def calculate_delivery_quantity_in_usd(exchange_rates_client: ExchangeRates, payment_record: PaymentRecord) -> None: exchange_rate = exchange_rates_client.get_exchange_rate_for_currency_code( payment_record.currency, payment_record.parent.dispersion_date diff --git a/src/hct_mis_api/apps/core/hope_redirect.py b/src/hct_mis_api/apps/core/hope_redirect.py deleted file mode 100644 index b04661c306..0000000000 --- a/src/hct_mis_api/apps/core/hope_redirect.py +++ /dev/null @@ -1,171 +0,0 @@ -import abc -from typing import Optional, Union - -from django.contrib.auth.base_user import AbstractBaseUser -from django.contrib.auth.models import AnonymousUser -from django.db.models import Q - -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.core.utils import encode_id_base64 -from hct_mis_api.apps.household.models import Household, Individual -from hct_mis_api.apps.payment.models import CashPlan, PaymentRecord, PaymentVerification -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.targeting.models import TargetPopulation - - -class HopeRedirect(abc.ABC): - def __init__( - self, - user: Union[AbstractBaseUser, AnonymousUser], - ca_id: Optional[str] = "", - source_id: Optional[str] = "", - program_id: Optional[str] = "", - ) -> None: - self.user = user - self.ca_id = ca_id - self.source_id = source_id.lower() - self.program_id = program_id.lower() - - @abc.abstractmethod - def url(self) -> str: - pass - - def get_business_area_slug(self) -> str: - if any([self.ca_id, self.source_id, self.program_id]): - return self._get_business_area_slug_from_obj() - return self._get_business_area_slug_from_user() - - @abc.abstractmethod - def _get_business_area_slug_from_obj(self) -> str: - pass - - def _get_business_area_slug_from_user(self) -> str: - business_area = BusinessArea.objects.exclude(slug="global").filter(user_roles__user=self.user).first() - if business_area: - return business_area.slug - return "/" - - -class HopeRedirectHousehold(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.source_id: - return f"/{business_area_slug}/population/household" - return f"/{business_area_slug}/population/household/{encode_id_base64(self.source_id, 'Household')}" - - def _get_business_area_slug_from_obj(self) -> str: - if household := Household.objects.filter(pk=self.source_id).first(): - return household.business_area.slug - return "/" - - -class HopeRedirectIndividual(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.source_id: - return f"/{business_area_slug}/population/individuals" - return f"/{business_area_slug}/population/individuals/{encode_id_base64(self.source_id, 'Individual')}" - - def _get_business_area_slug_from_obj(self) -> str: - if individual := Individual.objects.filter(pk=self.source_id).first(): - return individual.business_area.slug - return "/" - - -class HopeRedirectProgram(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.source_id: - return f"/{business_area_slug}/programs" - return f"/{business_area_slug}/programs/{encode_id_base64(self.source_id, 'Program')}" - - def _get_business_area_slug_from_obj(self) -> str: - if program := Program.objects.filter(pk=self.source_id).first(): - return program.business_area.slug - return "/" - - -class HopeRedirectCashPlan(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.program_id: - return f"/{business_area_slug}/payment-verification" - if cash_plan := self._get_cash_plan(): - return f"/{business_area_slug}/cashplans/{encode_id_base64(cash_plan.id, 'CashPlan')}" - return "/" - - def _get_business_area_slug_from_obj(self) -> str: - if cash_plan := self._get_cash_plan(): - return cash_plan.business_area.slug - return "/" - - def _get_cash_plan(self) -> Optional[CashPlan]: - return CashPlan.objects.filter(Q(ca_id=self.ca_id) | Q(program__pk=self.program_id)).first() - - -class HopeRedirectPayment(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.program_id: - return f"/{business_area_slug}/payment-verification" - payment_verification = self._get_payment_verification() - return f"/{business_area_slug}/verification-records/{encode_id_base64(payment_verification.id, 'PaymentVerification')}" - - def _get_business_area_slug_from_obj(self) -> str: - if payment_verification := self._get_payment_verification(): - return payment_verification.payment_obj.business_area.slug - return "/" - - def _get_payment_verification(self) -> Optional[PaymentVerification]: - if payment_record := PaymentRecord.objects.filter(ca_id=self.ca_id).first(): - return payment_record.verification - return None - - -class HopeRedirectTargetPopulation(HopeRedirect): - def url(self) -> str: - business_area_slug = self.get_business_area_slug() - - if not self.source_id: - return f"/{business_area_slug}/target-population" - return f"/{business_area_slug}/target-population/{encode_id_base64(self.source_id, 'TargetPopulation')}" - - def _get_business_area_slug_from_obj(self) -> str: - if target_population := TargetPopulation.objects.filter(pk=self.source_id).first(): - return target_population.business_area.slug - return "/" - - -class HopeRedirectDefault(HopeRedirect): - def url(self) -> str: - return "/" - - def _get_business_area_slug_from_obj(self) -> str: - return "" - - -def get_hope_redirect( - user: Union[AbstractBaseUser, AnonymousUser], - ent: Optional[str] = "", - ca_id: Optional[str] = "", - source_id: Optional[str] = "", - program_id: Optional[str] = "", -) -> HopeRedirect: - if ent == "progres_registrationgroup": - return HopeRedirectHousehold(user, ca_id, source_id, program_id) - if ent == "progres_individual": - return HopeRedirectIndividual(user, ca_id, source_id, program_id) - if ent == "progres_program": - return HopeRedirectProgram(user, ca_id, source_id, program_id) - if ent == "progres_cashplan": - return HopeRedirectCashPlan(user, ca_id, source_id, program_id) - if ent == "progres_payment": - return HopeRedirectPayment(user, ca_id, source_id, program_id) - if ent == "progres_targetpopulation": - return HopeRedirectTargetPopulation(user, ca_id, source_id, program_id) - return HopeRedirectDefault(user, ca_id, source_id, program_id) diff --git a/src/hct_mis_api/apps/core/management/commands/fixexchangerates.py b/src/hct_mis_api/apps/core/management/commands/fixexchangerates.py deleted file mode 100644 index 84eb2886bd..0000000000 --- a/src/hct_mis_api/apps/core/management/commands/fixexchangerates.py +++ /dev/null @@ -1,27 +0,0 @@ -from argparse import ArgumentParser -from typing import Any - -from django.core.management import BaseCommand - -from hct_mis_api.apps.core.exchange_rates.utils import fix_exchange_rates - - -class Command(BaseCommand): - help = "Fix Exchange Rates for Payment Records" - - def add_arguments(self, parser: ArgumentParser) -> None: - parser.add_argument( - "--silent", - dest="silent", - const=True, - default=True, - action="store", - nargs="?", - type=bool, - help="Silence the command output messages", - ) - - def handle(self, *args: Any, **options: Any) -> None: - fix_exchange_rates(all=True) - if options["silent"] is False: - self.stdout.write("Exchange rates for Payment Records successfully modified") diff --git a/src/hct_mis_api/apps/core/management/commands/generatefixtures.py b/src/hct_mis_api/apps/core/management/commands/generatefixtures.py index 00e2c1ae18..9d710cac9f 100644 --- a/src/hct_mis_api/apps/core/management/commands/generatefixtures.py +++ b/src/hct_mis_api/apps/core/management/commands/generatefixtures.py @@ -25,8 +25,8 @@ ) from hct_mis_api.apps.household.models import DocumentType from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, ) @@ -36,7 +36,6 @@ TargetingCriteriaFactory, TargetingCriteriaRuleFactory, TargetingCriteriaRuleFilterFactory, - TargetPopulationFactory, ) from hct_mis_api.apps.utils.elasticsearch_utils import rebuild_search_index @@ -118,17 +117,11 @@ def _generate_program_with_dependencies(options: Dict, business_area_index: int) for rule in rules: TargetingCriteriaRuleFilterFactory.create_batch(random.randint(1, 5), targeting_criteria_rule=rule) - target_population = TargetPopulationFactory( - created_by=user, - targeting_criteria=targeting_criteria, - business_area=business_area, - ) for _ in range(cash_plans_amount): - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( program=program, business_area=business_area, ) - cash_plan.save() for _ in range(payment_record_amount): registration_data_import = RegistrationDataImportFactory(imported_by=user, business_area=business_area) household, individuals = create_household_for_fixtures( @@ -146,17 +139,16 @@ def _generate_program_with_dependencies(options: Dict, business_area_index: int) if household.admin_area: program.admin_areas.add(household.admin_area) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, - target_population=target_population, delivered_quantity_usd=None, business_area=business_area, ) - payment_record.delivered_quantity_usd = Decimal( - cash_plan.exchange_rate * payment_record.delivered_quantity + payment.delivered_quantity_usd = Decimal( + payment_plan.exchange_rate * payment.delivered_quantity ).quantize(Decimal(".01")) - payment_record.save() + payment.save() should_create_grievance = random.choice((True, False)) if should_create_grievance: @@ -174,13 +166,13 @@ def _generate_program_with_dependencies(options: Dict, business_area_index: int) SensitiveGrievanceTicketWithoutExtrasFactory, household=household, individual=random.choice(individuals), - payment_record=payment_record if should_contain_payment_record else None, + payment=payment if should_contain_payment_record else None, ), "complaint": partial( GrievanceComplaintTicketWithoutExtrasFactory, household=household, individual=random.choice(individuals), - payment_record=payment_record if should_contain_payment_record else None, + payment=payment if should_contain_payment_record else None, ), } diff --git a/src/hct_mis_api/apps/core/management/commands/initdemo.py b/src/hct_mis_api/apps/core/management/commands/initdemo.py index 53400a9d27..d065b825d0 100644 --- a/src/hct_mis_api/apps/core/management/commands/initdemo.py +++ b/src/hct_mis_api/apps/core/management/commands/initdemo.py @@ -65,7 +65,6 @@ from hct_mis_api.apps.payment.fixtures import ( generate_delivery_mechanisms, generate_payment_plan, - generate_real_cash_plans, generate_reconciled_payment_plan, update_fsps, ) @@ -149,7 +148,6 @@ def handle(self, *args: Any, **options: Any) -> None: self.stdout.write("Generating payment plan...") generate_payment_plan() self.stdout.write("Generating real cash plans...") - generate_real_cash_plans() self.stdout.write("Generating reconciled payment plan...") generate_reconciled_payment_plan() self.stdout.write("Updating FSPs...") diff --git a/src/hct_mis_api/apps/core/querysets.py b/src/hct_mis_api/apps/core/querysets.py deleted file mode 100644 index 23237a5d04..0000000000 --- a/src/hct_mis_api/apps/core/querysets.py +++ /dev/null @@ -1,70 +0,0 @@ -import logging -from typing import Any, List, Optional - -from queryset_sequence import ModelIterable, QuerySetSequence - -logger = logging.getLogger(__name__) - - -class ExtendedQuerySetSequence(QuerySetSequence): - def _clone(self) -> "ExtendedQuerySetSequence": - clone = ExtendedQuerySetSequence(*[qs._clone() for qs in self._querysets]) - clone._queryset_idxs = self._queryset_idxs - clone._order_by = self._order_by - clone._fields = self._fields - clone._standard_ordering = self._standard_ordering - clone._low_mark = self._low_mark - clone._high_mark = self._high_mark - clone._iterable_class = self._iterable_class - clone.model = self.model - - return clone - - def aggregate(self, *args: Any, **kwargs: Any) -> dict: - results_dict = {} - - aggregated_querysets: List[dict] = [qs.aggregate(*args, **kwargs) for qs in self._querysets] - keys = list(aggregated_querysets[0].keys()) - for key in keys: - values = [qs.get(key, None) for qs in aggregated_querysets] - results_dict[key] = sum(list(filter(lambda x: x is not None, values))) - - return results_dict - - def merge_by( - self, - merge_field: str, - aggregated_fields: Optional[List[str]] = None, - regular_fields: Optional[List[str]] = None, - ) -> List[dict]: - """Merge grouped_by + annotated querysets""" - aggregated_fields = aggregated_fields or [] - regular_fields = regular_fields or [] - results_list = [] - - object_list = list(self.values(merge_field, *aggregated_fields, *regular_fields)) - # make unique and maintain order - merge_unique_field_values = list(dict.fromkeys([obj[merge_field] for obj in object_list])) - - for merge_field_value in merge_unique_field_values: - merged_object = {merge_field: merge_field_value} - objects = [obj for obj in object_list if obj.get(merge_field) == merge_field_value] - - for annotated_field_name in aggregated_fields: - annotated_field_values = [obj.get(annotated_field_name) for obj in objects] - merged_object[annotated_field_name] = sum(list(filter(lambda x: x is not None, annotated_field_values))) - - for regular_field_name in regular_fields: - merged_object[regular_field_name] = objects[0][regular_field_name] - - results_list.append(merged_object) - - return results_list - - def distinct(self, *fields: Any) -> Any: - clone = super().distinct(*fields) - - if clone._iterable_class != ModelIterable: - clone._querysets = [clone._querysets[0].union(*clone._querysets[1:])] - - return clone diff --git a/src/hct_mis_api/apps/core/utils.py b/src/hct_mis_api/apps/core/utils.py index e495f30f04..ef4e407768 100644 --- a/src/hct_mis_api/apps/core/utils.py +++ b/src/hct_mis_api/apps/core/utils.py @@ -458,11 +458,11 @@ def is_valid_uuid(uuid_str: str) -> bool: def decode_and_get_payment_object(encoded_id: str, required: bool) -> Optional[Any]: - from hct_mis_api.apps.payment.utils import get_payment_items_sequence_qs + from hct_mis_api.apps.payment.models import Payment if required or encoded_id is not None: decoded_id = decode_id_string(encoded_id) - qs = get_payment_items_sequence_qs() + qs = Payment.objects.filter(excluded=False, conflicted=False) try: return qs.get(id=decoded_id) except Exception: diff --git a/src/hct_mis_api/apps/core/views.py b/src/hct_mis_api/apps/core/views.py index 2a212574cb..3eaf10cec9 100644 --- a/src/hct_mis_api/apps/core/views.py +++ b/src/hct_mis_api/apps/core/views.py @@ -16,7 +16,6 @@ from hct_mis_api.apps.account.permissions import Permissions from hct_mis_api.apps.core.forms import StorageFileForm -from hct_mis_api.apps.core.hope_redirect import get_hope_redirect from hct_mis_api.apps.core.models import StorageFile from hct_mis_api.apps.core.permissions_views_mixins import UploadFilePermissionMixin from hct_mis_api.apps.reporting.models import DashboardReport @@ -62,16 +61,6 @@ def download_dashboard_report(request: HttpRequest, report_id: "UUID") -> Any: return redirect(report.file.url) -@login_required -def hope_redirect(request: HttpRequest) -> HttpResponse: - ent = request.GET.get("ent") - caid = request.GET.get("caid") - sourceid = request.GET.get("sourceid") - programid = request.GET.get("programid") - hope_redirect = get_hope_redirect(request.user, ent, caid, sourceid, programid) - return redirect(hope_redirect.url()) - - class UploadFile(UploadFilePermissionMixin, View): login_url = "/login" redirect_field_name = "next" diff --git a/src/hct_mis_api/apps/dashboard/services.py b/src/hct_mis_api/apps/dashboard/services.py index 6ba3140c86..748e93f9c4 100644 --- a/src/hct_mis_api/apps/dashboard/services.py +++ b/src/hct_mis_api/apps/dashboard/services.py @@ -90,7 +90,7 @@ def refresh_data(cls, business_area_slug: str) -> ReturnDict: sectors=Coalesce(F("household__program__sector"), Value("Unknown sector")), admin1=Coalesce(F("household__admin1__name"), Value("Unknown admin1")), fsp=Coalesce(F("financial_service_provider__name"), Value("Unknown fsp")), - delivery_types=Coalesce(F("delivery_type__name"), F("delivery_type_choice")), + delivery_types=F("delivery_type__name"), ) .distinct() .values( @@ -134,7 +134,7 @@ def refresh_data(cls, business_area_slug: str) -> ReturnDict: sectors=Coalesce(F("household__program__sector"), Value("Unknown sector")), admin1=Coalesce(F("household__admin1__name"), Value("Unknown admin1")), fsp=Coalesce(F("service_provider__short_name"), Value("Unknown fsp")), - delivery_types=Coalesce(F("delivery_type__name"), F("delivery_type_choice")), + delivery_types=F("delivery_type__name"), ) .distinct() .values( diff --git a/src/hct_mis_api/apps/grievance/filters.py b/src/hct_mis_api/apps/grievance/filters.py index a88bf032f6..c766dd6113 100644 --- a/src/hct_mis_api/apps/grievance/filters.py +++ b/src/hct_mis_api/apps/grievance/filters.py @@ -25,7 +25,7 @@ from hct_mis_api.apps.grievance.constants import PRIORITY_CHOICES, URGENCY_CHOICES from hct_mis_api.apps.grievance.models import GrievanceTicket, TicketNote from hct_mis_api.apps.household.models import HEAD, Household, Individual -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.program.models import Program logger = logging.getLogger(__name__) @@ -103,7 +103,7 @@ class GrievanceTicketFilter(FilterSet): fsp = CharFilter(method="fsp_filter") cash_plan = CharFilter( field_name="payment_verification_ticket_details", - lookup_expr="payment_verification__payment_verification_plan__payment_plan_object_id", + lookup_expr="payment_verification__payment_verification_plan__payment_plan_id", ) created_at_range = DateTimeRangeFilter(field_name="created_at") permissions = MultipleChoiceFilter(choices=Permissions.choices(), method="permissions_filter") @@ -325,7 +325,7 @@ class ExistingGrievanceTicketFilter(FilterSet): issue_type = ChoiceFilter(field_name="issue_type", choices=GrievanceTicket.ALL_ISSUE_TYPES) household = ModelChoiceFilter(queryset=Household.objects.all()) individual = ModelChoiceFilter(queryset=Individual.objects.all()) - payment_record = ModelMultipleChoiceFilter(queryset=PaymentRecord.objects.all()) + payment_record = ModelMultipleChoiceFilter(queryset=Payment.objects.all()) permissions = MultipleChoiceFilter(choices=Permissions.choices(), method="permissions_filter") class Meta: @@ -343,7 +343,7 @@ def prepare_ticket_filters(self, lookup: str, obj: GrievanceTicket) -> Q: ticket_type in ("complaint_ticket_details", "sensitive_ticket_details") and real_lookup == "payment_record" ): - q_obj |= Q(**{f"{ticket_type}__payment_object_id": str(obj.id)}) + q_obj |= Q(**{f"{ticket_type}__payment_id": str(obj.id)}) elif real_lookup: q_obj |= Q(**{f"{ticket_type}__{real_lookup}": obj}) return q_obj diff --git a/src/hct_mis_api/apps/grievance/fixtures.py b/src/hct_mis_api/apps/grievance/fixtures.py index c8f6ed5fde..f2add77bea 100644 --- a/src/hct_mis_api/apps/grievance/fixtures.py +++ b/src/hct_mis_api/apps/grievance/fixtures.py @@ -30,10 +30,7 @@ TicketSystemFlaggingDetails, ) from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import ( - PaymentRecordFactory, - PaymentVerificationFactory, -) +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentVerificationFactory from hct_mis_api.apps.payment.models import PaymentVerification @@ -91,7 +88,7 @@ def create_extras(obj, create: bool, extracted: bool, **kwargs: Any) -> None: ) obj.household = household obj.individual = individuals[0] - obj.payment_obj = PaymentRecordFactory(household=household, currency="EUR") + obj.payment = PaymentFactory(household=household, currency="EUR") obj.save() @@ -118,8 +115,7 @@ def create_extras(obj, create: bool, extracted: bool, **kwargs: Any) -> None: ) obj.household = household obj.individual = individuals[0] - obj.payment_object_id = PaymentRecordFactory(household=household, currency="EUR").id - obj.payment_content_type_id = 80 + obj.payment = PaymentFactory(household=household, currency="EUR") obj.save() diff --git a/src/hct_mis_api/apps/grievance/inputs.py b/src/hct_mis_api/apps/grievance/inputs.py index 8ab9420974..d2bfb9b463 100644 --- a/src/hct_mis_api/apps/grievance/inputs.py +++ b/src/hct_mis_api/apps/grievance/inputs.py @@ -5,7 +5,7 @@ from hct_mis_api.apps.core.schema import BusinessAreaNode from hct_mis_api.apps.grievance.schema import GrievanceTicketNode from hct_mis_api.apps.household.schema import HouseholdNode, IndividualNode -from hct_mis_api.apps.payment.schema import PaymentRecordNode +from hct_mis_api.apps.payment.schema import PaymentNode from hct_mis_api.apps.program.schema import ProgramNode from hct_mis_api.apps.utils.schema import Arg @@ -359,7 +359,7 @@ class UpdateGrievanceTicketInput(graphene.InputObjectType): linked_tickets = graphene.List(graphene.ID) household = graphene.GlobalID(node=HouseholdNode, required=False) individual = graphene.GlobalID(node=IndividualNode, required=False) - payment_record = graphene.GlobalID(node=PaymentRecordNode, required=False) + payment_record = graphene.GlobalID(node=PaymentNode, required=False) extras = UpdateGrievanceTicketExtrasInput() priority = graphene.Int(required=False) urgency = graphene.Int(required=False) diff --git a/src/hct_mis_api/apps/grievance/migrations/0004_migration.py b/src/hct_mis_api/apps/grievance/migrations/0004_migration.py new file mode 100644 index 0000000000..65364def52 --- /dev/null +++ b/src/hct_mis_api/apps/grievance/migrations/0004_migration.py @@ -0,0 +1,62 @@ +# Generated by Django 3.2.25 on 2024-09-25 17:16 + +from django.db import migrations, models + + +def migrate_payment_tickets_generic_foreign_key_to_onetoone(apps, schema_editor): + TicketComplaintDetails = apps.get_model("grievance", "TicketComplaintDetails") + TicketSensitiveDetails = apps.get_model("grievance", "TicketSensitiveDetails") + + Payment = apps.get_model("payment", "Payment") + ContentType = apps.get_model("contenttypes", "ContentType") + + ticket_complaint_details_to_update = [] + ticket_sensitive_details_to_update = [] + + for model in [TicketComplaintDetails, TicketSensitiveDetails]: + for ticket_details in model.objects.exclude(payment_content_type__isnull=True, payment_object_id__isnull=True): + if ticket_details.payment_content_type.model == "payment": + related_instance = Payment.objects.get(id=ticket_details.payment_object_id) + ticket_details.payment = related_instance + if model == TicketComplaintDetails: + ticket_complaint_details_to_update.append(ticket_details) + else: + ticket_sensitive_details_to_update.append(ticket_details) + + TicketComplaintDetails.objects.bulk_update(ticket_complaint_details_to_update, ["payment"]) + TicketSensitiveDetails.objects.bulk_update(ticket_sensitive_details_to_update, ["payment"]) + + +class Migration(migrations.Migration): + + dependencies = [ + ("grievance", "0003_migration"), + ("payment", "0003_migration"), + ] + + operations = [ + migrations.AddField( + model_name="ticketcomplaintdetails", + name="payment", + field=models.OneToOneField( + to="payment.Payment", + null=True, # Temporarily allow nulls for migration purposes + on_delete=models.CASCADE, + related_name="ticket_complaint_details", + ), + ), + migrations.AddField( + model_name="ticketsensitivedetails", + name="payment", + field=models.OneToOneField( + to="payment.Payment", + null=True, # Temporarily allow nulls for migration purposes + on_delete=models.CASCADE, + related_name="ticket_sensitive_details", + ), + ), + migrations.RunPython( + migrate_payment_tickets_generic_foreign_key_to_onetoone, + migrations.RunPython.noop, + ), + ] diff --git a/src/hct_mis_api/apps/grievance/models.py b/src/hct_mis_api/apps/grievance/models.py index d8fd5090e6..67acda98ee 100644 --- a/src/hct_mis_api/apps/grievance/models.py +++ b/src/hct_mis_api/apps/grievance/models.py @@ -28,7 +28,7 @@ URGENCY_NOT_SET, ) from hct_mis_api.apps.household.models import Individual -from hct_mis_api.apps.payment.models import PaymentRecord, PaymentVerification +from hct_mis_api.apps.payment.models import Payment, PaymentVerification from hct_mis_api.apps.utils.models import ( AdminUrlMixin, ConcurrencyModel, @@ -628,7 +628,7 @@ class TicketNote(TimeStampedUUIDModel): } -class TicketComplaintDetails(GenericPaymentTicket): +class TicketComplaintDetails(GenericPaymentTicket): # TODO TP drop GenericPaymentTicket STATUS_FLOW = GENERAL_STATUS_FLOW ticket = models.OneToOneField( @@ -648,12 +648,18 @@ class TicketComplaintDetails(GenericPaymentTicket): on_delete=models.CASCADE, null=True, ) + payment = models.OneToOneField( + Payment, + on_delete=models.CASCADE, + null=True, + related_name="ticket_complaint_details", + ) class Meta: verbose_name_plural = "Ticket Complaint Details" -class TicketSensitiveDetails(GenericPaymentTicket): +class TicketSensitiveDetails(GenericPaymentTicket): # TODO TP drop GenericPaymentTicket STATUS_FLOW = GENERAL_STATUS_FLOW ticket = models.OneToOneField( @@ -673,6 +679,12 @@ class TicketSensitiveDetails(GenericPaymentTicket): on_delete=models.CASCADE, null=True, ) + payment = models.OneToOneField( + Payment, + on_delete=models.CASCADE, + null=True, + related_name="ticket_sensitive_details", + ) class Meta: verbose_name_plural = "Ticket Sensitive Details" @@ -955,9 +967,9 @@ def individual(self) -> Optional["Individual"]: return getattr(self.payment_record, "head_of_household", None) @property - def payment_record(self) -> Optional["PaymentRecord"]: + def payment_record(self) -> Optional["Payment"]: # TODO: need to double check this property sometimes return null ??? - return getattr(self.payment_verification, "payment_obj", None) + return getattr(self.payment_verification, "payment", None) class Meta: verbose_name_plural = "Ticket Payment Verification Details" diff --git a/src/hct_mis_api/apps/grievance/schema.py b/src/hct_mis_api/apps/grievance/schema.py index de3b244b93..55cff156d4 100644 --- a/src/hct_mis_api/apps/grievance/schema.py +++ b/src/hct_mis_api/apps/grievance/schema.py @@ -181,8 +181,8 @@ def resolve_individual(grievance_ticket: GrievanceTicket, info: Any) -> Optional @staticmethod def resolve_payment_record(grievance_ticket: GrievanceTicket, info: Any) -> Optional[Any]: payment_verification = getattr(grievance_ticket.ticket_details, "payment_verification", None) - payment_obj = getattr(grievance_ticket.ticket_details, "payment_obj", None) - return getattr(payment_verification, "payment_obj", None) if payment_verification else payment_obj + payment_obj = getattr(grievance_ticket.ticket_details, "payment", None) + return getattr(payment_verification, "payment", None) if payment_verification else payment_obj @staticmethod def resolve_admin(grievance_ticket: GrievanceTicket, info: Any) -> Optional[str]: @@ -247,7 +247,7 @@ class Meta: connection_class = ExtendedConnection def resolve_payment_record(self, info: Any) -> Optional[Any]: - return getattr(self, "payment_obj", None) + return getattr(self, "payment", None) class TicketSensitiveDetailsNode(DjangoObjectType): @@ -260,7 +260,7 @@ class Meta: connection_class = ExtendedConnection def resolve_payment_record(self, info: Any) -> Optional[Any]: - return getattr(self, "payment_obj", None) + return getattr(self, "payment", None) class TicketIndividualDataUpdateDetailsNode(DjangoObjectType): diff --git a/src/hct_mis_api/apps/grievance/services/payment_verification_services.py b/src/hct_mis_api/apps/grievance/services/payment_verification_services.py index 8b7203aa07..65ad7b00b3 100644 --- a/src/hct_mis_api/apps/grievance/services/payment_verification_services.py +++ b/src/hct_mis_api/apps/grievance/services/payment_verification_services.py @@ -23,8 +23,8 @@ def update_payment_verification_service( if payment_verification_details.new_status == PaymentVerification.STATUS_NOT_RECEIVED: status = payment_verification_details.new_status elif ( - payment_verification.payment_obj - and payment_verification_details.new_received_amount == payment_verification.payment_obj.delivered_quantity + payment_verification.payment + and payment_verification_details.new_received_amount == payment_verification.payment.delivered_quantity ): status = PaymentVerification.STATUS_RECEIVED else: diff --git a/src/hct_mis_api/apps/grievance/services/ticket_based_on_payment_record_services.py b/src/hct_mis_api/apps/grievance/services/ticket_based_on_payment_record_services.py index b39c2b5aee..b29654ab34 100644 --- a/src/hct_mis_api/apps/grievance/services/ticket_based_on_payment_record_services.py +++ b/src/hct_mis_api/apps/grievance/services/ticket_based_on_payment_record_services.py @@ -1,5 +1,5 @@ from base64 import b64decode -from typing import Dict, List, Optional, Type, Union +from typing import Dict, List, Optional, Type from django.core.exceptions import ValidationError from django.shortcuts import get_object_or_404 @@ -10,7 +10,7 @@ ) from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.models import Household, Individual -from hct_mis_api.apps.payment.models import Payment, PaymentRecord +from hct_mis_api.apps.payment.models import Payment def create_tickets_based_on_payment_records_service( @@ -42,9 +42,7 @@ def create_tickets_based_on_payment_records_service( for payment_record_encoded_id in payment_record_encoded_ids_list: node_name, obj_id = b64decode(payment_record_encoded_id).decode().split(":") - payment_record: Union["Payment", "PaymentRecord"] = get_object_or_404( # type: ignore - Payment if node_name == "PaymentNode" else PaymentRecord, id=obj_id - ) + payment: Payment = get_object_or_404(Payment, id=obj_id) # copy GrievanceTicket object and assign linked tickets if not ticket: ticket = grievance_ticket @@ -58,7 +56,7 @@ def create_tickets_based_on_payment_records_service( model.objects.create( individual=individual, household=household, - payment_obj=payment_record, + payment=payment, ticket=ticket, ) ticket.refresh_from_db() @@ -88,9 +86,7 @@ def update_ticket_based_on_payment_record_service( if payment_record_id := input_data.get("payment_record"): node_name, obj_id = b64decode(payment_record_id).decode().split(":") - payment_record: Union["Payment", "PaymentRecord"] = get_object_or_404( # type: ignore - Payment if node_name == "PaymentNode" else PaymentRecord, id=obj_id - ) - ticket_details.payment_obj = payment_record + payment_record: "Payment" = get_object_or_404(Payment, id=obj_id) + ticket_details.payment = payment_record ticket_details.save() return grievance_ticket diff --git a/src/hct_mis_api/apps/household/admin/household.py b/src/hct_mis_api/apps/household/admin/household.py index 7b4c7f6f10..dc1b35520a 100644 --- a/src/hct_mis_api/apps/household/admin/household.py +++ b/src/hct_mis_api/apps/household/admin/household.py @@ -121,7 +121,7 @@ def mass_withdraw_households_from_list_bulk(self, household_id_list: list, tag: households.update( withdrawn=True, withdrawn_date=timezone.now(), - user_fields=JSONBSet(F("user_fields"), Value("{withdrawn_tag}"), Value(f'"{tag}"')), + internal_data=JSONBSet(F("internal_data"), Value("{withdrawn_tag}"), Value(f'"{tag}"')), ) @staticmethod diff --git a/src/hct_mis_api/apps/household/fixtures/data-cypress.json b/src/hct_mis_api/apps/household/fixtures/data-cypress.json index e8693b4d80..e1acd63ba3 100644 --- a/src/hct_mis_api/apps/household/fixtures/data-cypress.json +++ b/src/hct_mis_api/apps/household/fixtures/data-cypress.json @@ -125,7 +125,7 @@ "collect_individual_data": "1", "currency": "USD", "unhcr_id": "", - "user_fields": {}, + "internal_data": {}, "detail_id": "4", "total_cash_received_usd": null, "total_cash_received": null, @@ -205,7 +205,7 @@ "collect_individual_data": "1", "currency": "USD", "unhcr_id": "", - "user_fields": {}, + "internal_data": {}, "detail_id": "3", "total_cash_received_usd": null, "total_cash_received": null, @@ -432,7 +432,7 @@ "first_registration_date": "1974-12-15", "last_registration_date": "1974-12-15", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-74-0000.0001", @@ -529,7 +529,7 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0002", @@ -608,7 +608,7 @@ "first_registration_date": "1942-12-12", "last_registration_date": "1942-12-12", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-42-0000.0003", @@ -687,7 +687,7 @@ "first_registration_date": "1969-06-22", "last_registration_date": "1969-06-22", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-69-0000.0004", @@ -766,7 +766,7 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0005", @@ -845,7 +845,7 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, + "internal_data": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0006", diff --git a/src/hct_mis_api/apps/household/fixtures/data.json b/src/hct_mis_api/apps/household/fixtures/data.json index ff0882dafd..9e7e224d00 100644 --- a/src/hct_mis_api/apps/household/fixtures/data.json +++ b/src/hct_mis_api/apps/household/fixtures/data.json @@ -126,7 +126,6 @@ "collect_individual_data": "1", "currency": "USD", "unhcr_id": "", - "user_fields": {}, "detail_id": "4", "total_cash_received_usd": null, "total_cash_received": null, @@ -205,7 +204,6 @@ "collect_individual_data": "1", "currency": "USD", "unhcr_id": "", - "user_fields": {}, "detail_id": "3", "total_cash_received_usd": null, "total_cash_received": null, @@ -450,7 +448,6 @@ "first_registration_date": "1974-12-15", "last_registration_date": "1974-12-15", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-74-0000.0001", @@ -547,7 +544,6 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0002", @@ -625,7 +621,6 @@ "first_registration_date": "1942-12-12", "last_registration_date": "1942-12-12", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-42-0000.0003", @@ -703,7 +698,6 @@ "first_registration_date": "1969-06-22", "last_registration_date": "1969-06-22", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-69-0000.0004", @@ -781,7 +775,6 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0005", @@ -859,7 +852,6 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0006", @@ -956,7 +948,6 @@ "first_registration_date": "1988-06-15", "last_registration_date": "1988-06-15", "flex_fields": {}, - "user_fields": {}, "enrolled_in_nutrition_programme": null, "administration_of_rutf": null, "unicef_id": "IND-88-0000.0999", diff --git a/src/hct_mis_api/apps/household/management/commands/detect_paid_households.py b/src/hct_mis_api/apps/household/management/commands/detect_paid_households.py index b80abc0254..22ebfc7ce9 100644 --- a/src/hct_mis_api/apps/household/management/commands/detect_paid_households.py +++ b/src/hct_mis_api/apps/household/management/commands/detect_paid_households.py @@ -10,7 +10,7 @@ from hct_mis_api.apps.core.models import StorageFile from hct_mis_api.apps.household.models import Document, Household -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.models import Payment def find_paid_households(sf_pk: UUID, business_area_slug: str = "ukraine") -> Dict[str, List[str]]: @@ -27,8 +27,8 @@ def find_paid_households(sf_pk: UUID, business_area_slug: str = "ukraine") -> Di ) & ~Q(storage_obj=storage_file) ).values_list("id", flat=True) - payment_records = PaymentRecord.objects.filter(household__id__in=hh_ids_not_loaded_via_sf).distinct("household") - already_paid_households = payment_records.values_list("household", flat=True) + payments = Payment.objects.filter(household__id__in=hh_ids_not_loaded_via_sf).distinct("household") + already_paid_households = payments.values_list("household", flat=True) def match(household_to_match: Household) -> QuerySet[Household]: tax_ids_in_household_to_match = Document.objects.filter( diff --git a/src/hct_mis_api/apps/household/migrations/0003_migration.py b/src/hct_mis_api/apps/household/migrations/0003_migration.py new file mode 100644 index 0000000000..cb9a767490 --- /dev/null +++ b/src/hct_mis_api/apps/household/migrations/0003_migration.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.25 on 2024-10-23 11:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("household", "0002_migration"), + ] + + operations = [ + migrations.RenameField( + model_name="household", + old_name="user_fields", + new_name="internal_data", + ), + migrations.RenameField( + model_name="individual", + old_name="user_fields", + new_name="internal_data", + ), + ] diff --git a/src/hct_mis_api/apps/household/models.py b/src/hct_mis_api/apps/household/models.py index fc95d80aca..8122dda901 100644 --- a/src/hct_mis_api/apps/household/models.py +++ b/src/hct_mis_api/apps/household/models.py @@ -39,6 +39,7 @@ AbstractSyncable, AdminUrlMixin, ConcurrencyModel, + InternalDataFieldModel, MergeStatusModel, RepresentationManager, SoftDeletableRepresentationMergeStatusModel, @@ -336,6 +337,7 @@ def business_area(self) -> Optional[BusinessArea]: class Household( + InternalDataFieldModel, SoftDeletableRepresentationMergeStatusModelWithDate, TimeStampedUUIDModel, AbstractSyncable, @@ -509,7 +511,6 @@ class CollectType(models.TextChoices): ) # TODO remove currency = models.CharField(max_length=250, choices=CURRENCY_CHOICES, default=BLANK) unhcr_id = models.CharField(max_length=250, blank=True, default=BLANK, db_index=True) - user_fields = JSONField(default=dict, blank=True) detail_id = models.CharField( max_length=150, blank=True, null=True, help_text="Kobo asset ID, Xlsx row ID, Aurora source ID" ) @@ -595,9 +596,7 @@ def status(self) -> str: def withdraw(self, tag: Optional[Any] = None) -> None: self.withdrawn = True self.withdrawn_date = timezone.now() - user_fields = self.user_fields or {} - user_fields["withdrawn_tag"] = tag - self.user_fields = user_fields + self.internal_data["withdrawn_tag"] = tag self.save() household_withdrawn.send(sender=self.__class__, instance=self) @@ -607,13 +606,13 @@ def unwithdraw(self) -> None: self.save() def set_sys_field(self, key: str, value: Any) -> None: - if "sys" not in self.user_fields: - self.user_fields["sys"] = {} - self.user_fields["sys"][key] = value + if "sys" not in self.internal_data: + self.internal_data["sys"] = {} + self.internal_data["sys"][key] = value def get_sys_field(self, key: str) -> Any: - if "sys" in self.user_fields: - return self.user_fields["sys"][key] + if "sys" in self.internal_data: + return self.internal_data["sys"][key] return None def set_admin_areas(self, new_admin_area: Optional[Area] = None, save: bool = True) -> None: @@ -870,6 +869,7 @@ def business_area(self) -> Optional[BusinessArea]: class Individual( + InternalDataFieldModel, SoftDeletableRepresentationMergeStatusModelWithDate, TimeStampedUUIDModel, AbstractSyncable, @@ -989,7 +989,6 @@ class Individual( first_registration_date = models.DateField() last_registration_date = models.DateField() flex_fields = JSONField(default=dict, blank=True, encoder=FlexFieldsEncoder) - user_fields = JSONField(default=dict, blank=True) enrolled_in_nutrition_programme = models.BooleanField(null=True) administration_of_rutf = models.BooleanField(null=True) deduplication_golden_record_status = models.CharField( @@ -1184,16 +1183,6 @@ class Meta: verbose_name = "Individual" indexes = (GinIndex(fields=["vector_column"]),) - def set_sys_field(self, key: str, value: Any) -> None: - if "sys" not in self.user_fields: - self.user_fields["sys"] = {} - self.user_fields["sys"][key] = value - - def get_sys_field(self, key: str) -> Any: - if "sys" in self.user_fields: - return self.user_fields["sys"][key] - return None - def recalculate_data(self, save: bool = True) -> Tuple[Any, List[str]]: update_fields = ["disability"] diff --git a/src/hct_mis_api/apps/household/serializers.py b/src/hct_mis_api/apps/household/serializers.py index 8060f2e254..f8c4cf15ff 100644 --- a/src/hct_mis_api/apps/household/serializers.py +++ b/src/hct_mis_api/apps/household/serializers.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Dict, Optional, Tuple from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation from hct_mis_api.apps.utils.models import MergeStatusModel @@ -14,9 +14,9 @@ def get_household_status(household: Household) -> Tuple[str, datetime]: if household.rdi_merge_status == MergeStatusModel.PENDING: return "imported", household.updated_at if household.rdi_merge_status == MergeStatusModel.MERGED: - payment_records = PaymentRecord.objects.filter(household=household) - if payment_records.exists(): - return "paid", payment_records.first().updated_at + payments = Payment.objects.filter(household=household, delivered_quantity__isnull=False) + if payments.exists(): + return "paid", payments.first().delivery_date selections = HouseholdSelection.objects.filter(household=household) if selections.exists(): diff --git a/src/hct_mis_api/apps/household/services/household_programs_with_delivered_quantity.py b/src/hct_mis_api/apps/household/services/household_programs_with_delivered_quantity.py index 3e7aa07018..3ea2bd3bdb 100644 --- a/src/hct_mis_api/apps/household/services/household_programs_with_delivered_quantity.py +++ b/src/hct_mis_api/apps/household/services/household_programs_with_delivered_quantity.py @@ -4,28 +4,22 @@ from django.db.models import DecimalField, Sum from django.db.models.functions import Coalesce -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.models import Payment def delivered_quantity_service(household: Household) -> List[Dict[str, Any]]: - payment_items = ExtendedQuerySetSequence(household.paymentrecord_set.all(), household.payment_set.all()) - quantity_in_usd = payment_items.exclude(status=PaymentRecord.STATUS_FORCE_FAILED).aggregate( + payment_items = household.payment_set.all() + quantity_in_usd = payment_items.exclude(status=Payment.STATUS_FORCE_FAILED).aggregate( total_delivered_quantity_usd=Coalesce(Sum("delivered_quantity_usd", output_field=DecimalField()), Decimal(0.0)), ) quantities_per_currency = ( - payment_items.exclude(status=PaymentRecord.STATUS_FORCE_FAILED) + payment_items.exclude(status=Payment.STATUS_FORCE_FAILED) .exclude(currency="USD") .values("currency") .annotate( total_delivered_quantity=Coalesce(Sum("delivered_quantity", output_field=DecimalField()), Decimal(0.0)) ) - .merge_by( - "currency", - aggregated_fields=["total_delivered_quantity"], - regular_fields=["currency"], - ) ) result = [ diff --git a/src/hct_mis_api/apps/payment/admin.py b/src/hct_mis_api/apps/payment/admin.py index 0e4f060dc4..0bf599b48e 100644 --- a/src/hct_mis_api/apps/payment/admin.py +++ b/src/hct_mis_api/apps/payment/admin.py @@ -19,7 +19,6 @@ from advanced_filters.admin import AdminAdvancedFiltersMixin from smart_admin.mixins import LinkedObjectsMixin -from hct_mis_api.apps.payment.forms import ImportPaymentRecordsForm from hct_mis_api.apps.payment.models import ( CashPlan, DeliveryMechanism, @@ -37,9 +36,6 @@ PaymentVerificationPlan, ServiceProvider, ) -from hct_mis_api.apps.payment.services.create_cash_plan_from_reconciliation import ( - CreateCashPlanReconciliationService, -) from hct_mis_api.apps.payment.services.verification_plan_status_change_services import ( VerificationPlanStatusChangeServices, ) @@ -94,49 +90,10 @@ def cash_plan_name(self, obj: Any) -> str: def get_queryset(self, request: HttpRequest) -> QuerySet: return super().get_queryset(request).select_related("household", "parent", "target_population", "business_area") - @button() - def import_payment_records(self, request: HttpRequest) -> Any: - title = "Import Payment Records" - if request.method == "GET": - form = ImportPaymentRecordsForm() - context = self.get_common_context(request, title=title, form=form) - return TemplateResponse(request, "admin/payment/payment_record/import_payment_records.html", context) - - form = ImportPaymentRecordsForm(request.POST, request.FILES) - context = self.get_common_context(request, title=title, form=form) - if not form.is_valid(): - return TemplateResponse(request, "admin/payment/payment_record/import_payment_records.html", context) - cleaned_data = form.cleaned_data - column_mapping = { - CreateCashPlanReconciliationService.COLUMN_PAYMENT_ID: "Payment ID", - CreateCashPlanReconciliationService.COLUMN_PAYMENT_STATUS: "Reconciliation status", - CreateCashPlanReconciliationService.COLUMN_DELIVERED_AMOUNT: "Delivered Amount", - CreateCashPlanReconciliationService.COLUMN_ENTITLEMENT_QUANTITY: "Entitlement Quantity", - } - service = CreateCashPlanReconciliationService( - cleaned_data.pop("business_area"), - cleaned_data.pop("reconciliation_file"), - column_mapping, - cleaned_data, - cleaned_data.pop("currency"), - cleaned_data.pop("delivery_type"), - cleaned_data.pop("delivery_date"), - ) - - service.create_celery_task(request.user) - - self.message_user( - request, - "Background task created and Payment Records will imported soon. We will send an email after finishing import", - level=messages.SUCCESS, - ) - - return HttpResponseRedirect(reverse("admin:payment_paymentrecord_changelist")) - @admin.register(PaymentVerificationPlan) class PaymentVerificationPlanAdmin(LinkedObjectsMixin, HOPEModelAdminBase): - list_display = ("payment_plan_obj", "status", "verification_channel") + list_display = ("payment_plan", "status", "verification_channel") list_filter = ( ("status", ChoicesFieldComboFilter), ("verification_channel", ChoicesFieldComboFilter), @@ -200,11 +157,11 @@ class PaymentVerificationAdmin(HOPEModelAdminBase): raw_id_fields = ("payment_verification_plan", "payment_content_type") def payment_plan_name(self, obj: PaymentVerification) -> str: - payment_plan = obj.payment_verification_plan.payment_plan_obj + payment_plan = obj.payment_verification_plan.payment_plan return getattr(payment_plan, "name", "~no name~") def household(self, obj: PaymentVerification) -> str: - payment = obj.payment_obj + payment = obj.payment return payment.household.unicef_id if payment else "" def get_queryset(self, request: HttpRequest) -> QuerySet: @@ -213,10 +170,10 @@ def get_queryset(self, request: HttpRequest) -> QuerySet: .get_queryset(request) .select_related("payment_verification_plan") .prefetch_related( - "payment_obj", - "payment_obj__household", - "payment_verification_plan__payment_plan_obj", - "payment_verification_plan__payment_plan_obj__business_area", + "payment", + "payment__household", + "payment_verification_plan__payment_plan", + "payment_verification_plan__payment_plan__business_area", ) ) @@ -252,14 +209,14 @@ def payments(self, request: HttpRequest, pk: str) -> TemplateResponse: @admin.register(PaymentPlan) class PaymentPlanAdmin(HOPEModelAdminBase, PaymentPlanCeleryTasksMixin): - list_display = ("unicef_id", "program", "status", "target_population") + list_display = ("unicef_id", "program_cycle", "status", "target_population") list_filter = ( ("status", ChoicesFieldComboFilter), ("business_area", AutoCompleteFilter), - ("program__id", ValueFilter), + ("program_cycle__program__id", ValueFilter), ("target_population", AutoCompleteFilter), ) - raw_id_fields = ("business_area", "program", "target_population", "created_by", "program_cycle") + raw_id_fields = ("business_area", "target_population", "created_by", "program_cycle") search_fields = ("id", "unicef_id") def has_delete_permission(self, request: HttpRequest, obj: Optional[Any] = None) -> bool: diff --git a/src/hct_mis_api/apps/payment/api/serializers.py b/src/hct_mis_api/apps/payment/api/serializers.py index 57aa929915..7aaaf403b6 100644 --- a/src/hct_mis_api/apps/payment/api/serializers.py +++ b/src/hct_mis_api/apps/payment/api/serializers.py @@ -25,8 +25,8 @@ class PaymentPlanSerializer(serializers.ModelSerializer): target_population = serializers.CharField(source="target_population.name") currency = serializers.CharField(source="get_currency_display") follow_ups = FollowUpPaymentPlanSerializer(many=True, read_only=True) - program = serializers.CharField(source="program.name") - program_id = Base64ModelField(model_name="Program") + program = serializers.CharField(source="program_cycle.program.name") + program_id = Base64ModelField(model_name="Program", source="program_cycle.program.id") last_approval_process_by = serializers.SerializerMethodField() class Meta: diff --git a/src/hct_mis_api/apps/payment/api/views.py b/src/hct_mis_api/apps/payment/api/views.py index bc23941961..0980188aea 100644 --- a/src/hct_mis_api/apps/payment/api/views.py +++ b/src/hct_mis_api/apps/payment/api/views.py @@ -73,7 +73,7 @@ class PaymentPlanViewSet(BusinessAreaProgramMixin, PaymentPlanMixin, mixins.List def get_queryset(self) -> QuerySet: business_area = self.get_business_area() program = self.get_program() - return PaymentPlan.objects.filter(business_area=business_area, program=program) + return PaymentPlan.objects.filter(business_area=business_area, program_cycle__program=program) class PaymentPlanManagerialViewSet(BusinessAreaMixin, PaymentPlanMixin, mixins.ListModelMixin, GenericViewSet): @@ -93,7 +93,7 @@ def get_queryset(self) -> QuerySet: PaymentPlan.Status.IN_REVIEW, PaymentPlan.Status.ACCEPTED, ], - program__in=program_ids, + program_cycle__program__in=program_ids, ) @etag_decorator(PaymentPlanKeyConstructor) @@ -139,7 +139,7 @@ def _perform_payment_plan_status_action( if not self.request.user.has_permission( self._get_action_permission(input_data["action"]), business_area, - payment_plan.program_id, + payment_plan.program_cycle.program_id, ): raise PermissionDenied( f"You do not have permission to perform action {input_data['action']} " @@ -161,7 +161,7 @@ def _perform_payment_plan_status_action( mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=request.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program_cycle.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) diff --git a/src/hct_mis_api/apps/payment/celery_tasks.py b/src/hct_mis_api/apps/payment/celery_tasks.py index 5b4407312b..88ff1e95ec 100644 --- a/src/hct_mis_api/apps/payment/celery_tasks.py +++ b/src/hct_mis_api/apps/payment/celery_tasks.py @@ -1,6 +1,6 @@ import datetime import logging -from typing import Any, Dict, List, Optional +from typing import Any, List, Optional from django.contrib.admin.options import get_content_type_for_model from django.contrib.auth import get_user_model @@ -254,66 +254,6 @@ def import_payment_plan_payment_list_per_fsp_from_xlsx(self: Any, payment_plan_i return True -@app.task -@log_start_and_end -@sentry_tags -def create_cash_plan_reconciliation_xlsx( - reconciliation_xlsx_file_id: str, - column_mapping: Dict, - cash_plan_form_data: Dict, - currency: str, - delivery_type: str, - delivery_date: str, - program_id: str, - service_provider_id: str, -) -> None: - try: - from hct_mis_api.apps.core.models import StorageFile - from hct_mis_api.apps.payment.models import ServiceProvider - from hct_mis_api.apps.payment.services.create_cash_plan_from_reconciliation import ( - CreateCashPlanReconciliationService, - ) - from hct_mis_api.apps.program.models import Program - - reconciliation_xlsx_obj = StorageFile.objects.get(id=reconciliation_xlsx_file_id) - business_area = reconciliation_xlsx_obj.business_area - set_sentry_business_area_tag(business_area.name) - - cash_plan_form_data["program"] = Program.objects.get(id=program_id) - cash_plan_form_data["service_provider"] = ServiceProvider.objects.get(id=service_provider_id) - - service = CreateCashPlanReconciliationService( - business_area, - reconciliation_xlsx_obj.file, - column_mapping, - cash_plan_form_data, - currency, - delivery_type, - delivery_date, - ) - - try: - service.parse_xlsx() - error_msg = None - except Exception as e: - error_msg = f"Error parse xlsx: {e} \nFile name: {reconciliation_xlsx_obj.file_name}" - user = reconciliation_xlsx_obj.created_by - if reconciliation_xlsx_obj.business_area.enable_email_notification: - send_email_notification( - service, - user, - {"user": user, "file_name": reconciliation_xlsx_obj.file_name, "error_msg": error_msg}, - ) - - # remove file every time - reconciliation_xlsx_obj.file.delete() - reconciliation_xlsx_obj.delete() - - except Exception as e: - logger.exception(e) - raise - - @app.task(bind=True, default_retry_delay=60, max_retries=3) @log_start_and_end @sentry_tags @@ -449,9 +389,9 @@ def payment_plan_exclude_beneficiaries( from hct_mis_api.apps.payment.models import Payment, PaymentPlan - payment_plan = PaymentPlan.objects.select_related("program").get(id=payment_plan_id) + payment_plan = PaymentPlan.objects.select_related("program_cycle__program").get(id=payment_plan_id) # for social worker program exclude Individual unicef_id - is_social_worker_program = payment_plan.program.is_social_worker_program + is_social_worker_program = payment_plan.program_cycle.program.is_social_worker_program set_sentry_business_area_tag(payment_plan.business_area.name) pp_payment_items = payment_plan.payment_items.select_related("household") payment_plan_title = "Follow-up Payment Plan" if payment_plan.is_follow_up else "Payment Plan" diff --git a/src/hct_mis_api/apps/payment/filters.py b/src/hct_mis_api/apps/payment/filters.py index 70c5e13389..1c9b83d876 100644 --- a/src/hct_mis_api/apps/payment/filters.py +++ b/src/hct_mis_api/apps/payment/filters.py @@ -2,7 +2,6 @@ from typing import Any, List from uuid import UUID -from django.contrib.contenttypes.models import ContentType from django.db.models import Case, Count, IntegerField, Q, QuerySet, Value, When from django.db.models.functions import Lower from django.shortcuts import get_object_or_404 @@ -21,14 +20,11 @@ ) from hct_mis_api.apps.activity_log.schema import LogEntryFilter -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.core.utils import ( CustomOrderingFilter, decode_id_string, decode_id_string_required, - is_valid_uuid, ) -from hct_mis_api.apps.household.models import ROLE_NO_ROLE from hct_mis_api.apps.payment.models import ( CashPlan, DeliveryMechanism, @@ -36,7 +32,6 @@ FinancialServiceProviderXlsxTemplate, Payment, PaymentPlan, - PaymentRecord, PaymentVerification, PaymentVerificationPlan, PaymentVerificationSummary, @@ -54,46 +49,6 @@ def filter(self, qs: QuerySet, value: List[str]) -> QuerySet: return super().filter(qs, value) -class PaymentRecordFilter(FilterSet): - individual = CharFilter(method="individual_filter") - business_area = CharFilter(field_name="business_area__slug") - program_id = CharFilter(method="filter_by_program_id") - - class Meta: - fields = ( - "parent", - "household", - ) - model = PaymentRecord - - order_by = CustomOrderingFilter( - fields=( - "ca_id", - "status", - Lower("name"), - "status_date", - Lower("head_of_household__full_name"), - "total_person_covered", - "distribution_modality", - "household__unicef_id", - "household__size", - "household__admin2__name", - "entitlement_quantity", - "delivered_quantity", - "delivered_quantity_usd", - "delivery_date", - ) - ) - - def individual_filter(self, qs: "QuerySet", name: str, value: UUID) -> "QuerySet[PaymentRecord]": - if is_valid_uuid(str(value)): - return qs.exclude(household__individuals_and_roles__role=ROLE_NO_ROLE) - return qs - - def filter_by_program_id(self, qs: "QuerySet", name: str, value: str) -> "QuerySet[PaymentRecord]": - return qs.filter(parent__program_id=decode_id_string_required(value)) - - class PaymentVerificationFilter(FilterSet): payment_plan_id = CharFilter(method="payment_plan_filter") search = CharFilter(method="search_filter") @@ -107,7 +62,6 @@ class Meta: order_by = OrderingFilter( fields=( "payment__unicef_id", - "payment_record__ca_id", "payment_verification_plan__verification_channel", "payment_verification_plan__unicef_id", "status", @@ -126,7 +80,6 @@ def search_filter(self, qs: QuerySet, name: str, value: str) -> QuerySet: q_obj = Q() for value in values: q_obj |= Q(payment__unicef_id__istartswith=value) - q_obj |= Q(payment_record__ca_id__istartswith=value) q_obj |= Q(payment_verification_plan__unicef_id__istartswith=value) q_obj |= Q(received_amount__istartswith=value) q_obj |= Q(payment__household__unicef_id__istartswith=value) @@ -136,23 +89,13 @@ def search_filter(self, qs: QuerySet, name: str, value: str) -> QuerySet: q_obj |= Q(payment__head_of_household__family_name__istartswith=value) q_obj |= Q(payment__head_of_household__phone_no__istartswith=value) q_obj |= Q(payment__head_of_household__phone_no_alternative__istartswith=value) - q_obj |= Q(payment_record__household__unicef_id__istartswith=value) - q_obj |= Q(payment_record__head_of_household__full_name__istartswith=value) - q_obj |= Q(payment_record__head_of_household__given_name__istartswith=value) - q_obj |= Q(payment_record__head_of_household__middle_name__istartswith=value) - q_obj |= Q(payment_record__head_of_household__family_name__istartswith=value) - q_obj |= Q(payment_record__head_of_household__phone_no__istartswith=value) - q_obj |= Q(payment_record__head_of_household__phone_no_alternative__istartswith=value) return qs.filter(q_obj) def payment_plan_filter(self, qs: QuerySet, name: str, value: str) -> QuerySet: node_name, obj_id = b64decode(value).decode().split(":") - # content type for PaymentPlan or CashPlan - ct_id = ContentType.objects.filter(app_label="payment", model=node_name[:-4].lower()).first().pk return qs.filter( - payment_verification_plan__payment_plan_object_id=obj_id, - payment_verification_plan__payment_plan_content_type_id=ct_id, + payment_verification_plan__payment_plan_id=obj_id, ) def business_area_filter(self, qs: QuerySet, name: str, value: str) -> QuerySet: @@ -195,7 +138,7 @@ def filter_queryset(self, queryset: QuerySet) -> QuerySet: object_type = cleaned_data.get("object_type") object_id = cleaned_data.get("object_id") plan_object = (PaymentPlan if object_type == self.PLAN_TYPE_PAYMENT else CashPlan).objects.get(pk=object_id) - verifications_ids = plan_object.payment_verification_plan.all().values_list("pk", flat=True) + verifications_ids = plan_object.payment_verification_plans.all().values_list("pk", flat=True) return queryset.filter(object_id__in=verifications_ids) def object_id_filter(self, qs: QuerySet, name: str, value: UUID) -> QuerySet: @@ -249,62 +192,6 @@ class Meta: ) -class CashPlanFilter(FilterSet): - search = CharFilter(method="search_filter") - delivery_type = MultipleChoiceFilter(field_name="delivery_type", choices=DeliveryMechanism.get_choices()) - verification_status = MultipleChoiceFilter( - field_name="payment_verification_summary__status", choices=PaymentVerificationPlan.STATUS_CHOICES - ) - business_area = CharFilter( - field_name="business_area__slug", - ) - - class Meta: - fields = { - "program": ["exact"], - "assistance_through": ["exact", "startswith"], - "service_provider__full_name": ["exact", "startswith"], - "start_date": ["exact", "lte", "gte"], - "end_date": ["exact", "lte", "gte"], - "business_area": ["exact"], - } - model = CashPlan - - order_by = OrderingFilter( - fields=( - "ca_id", - "status", - "total_number_of_hh", - "total_entitled_quantity", - ("payment_verification_summary__status", "verification_status"), - "total_persons_covered", - "total_delivered_quantity", - "total_undelivered_quantity", - "dispersion_date", - "assistance_measurement", - "assistance_through", - "delivery_type", - "start_date", - "end_date", - "program__name", - "id", - "updated_at", - "service_provider__full_name", - ) - ) - - def filter_queryset(self, queryset: QuerySet) -> QuerySet: - queryset = queryset.annotate(total_number_of_hh=Count("payment_items")) - return super().filter_queryset(queryset) - - def search_filter(self, qs: QuerySet, name: str, value: str) -> QuerySet: - values = value.split(" ") - q_obj = Q() - for value in values: - q_obj |= Q(ca_id__istartswith=value) - return qs.filter(q_obj) - - class PaymentPlanFilter(FilterSet): business_area = CharFilter(field_name="business_area__slug", required=True) search = CharFilter(method="search_filter") @@ -351,7 +238,7 @@ def source_payment_plan_filter(self, qs: QuerySet, name: str, value: str) -> "Qu return PaymentPlan.objects.filter(source_payment_plan_id=decode_id_string(value)) def filter_by_program(self, qs: "QuerySet", name: str, value: str) -> "QuerySet[PaymentPlan]": - return qs.filter(program_id=decode_id_string_required(value)) + return qs.filter(program_cycle__program_id=decode_id_string_required(value)) def filter_by_program_cycle(self, qs: "QuerySet", name: str, value: str) -> "QuerySet[PaymentPlan]": return qs.filter(program_cycle_id=decode_id_string_required(value)) @@ -417,7 +304,7 @@ def filter_by_program_id(self, qs: "QuerySet", name: str, value: str) -> "QueryS return qs.filter(parent__program_cycle__program_id=decode_id_string_required(value)) -def cash_plan_and_payment_plan_filter(queryset: ExtendedQuerySetSequence, **kwargs: Any) -> ExtendedQuerySetSequence: +def payment_plan_filter(queryset: QuerySet[PaymentPlan], **kwargs: Any) -> QuerySet[PaymentPlan]: business_area = kwargs.get("business_area") program = kwargs.get("program") service_provider = kwargs.get("service_provider") @@ -430,7 +317,7 @@ def cash_plan_and_payment_plan_filter(queryset: ExtendedQuerySetSequence, **kwar queryset = queryset.filter(business_area__slug=business_area) if program: - queryset = queryset.filter(program=decode_id_string(program)) + queryset = queryset.filter(program_cycle__program=decode_id_string(program)) if start_date_gte: queryset = queryset.filter(start_date__gte=start_date_gte) @@ -459,14 +346,14 @@ def cash_plan_and_payment_plan_filter(queryset: ExtendedQuerySetSequence, **kwar return queryset -def cash_plan_and_payment_plan_ordering(queryset: ExtendedQuerySetSequence, order_by: str) -> List[Any]: +def payment_plan_ordering(queryset: QuerySet[PaymentPlan], order_by: str) -> QuerySet[PaymentPlan]: reverse = "-" if order_by.startswith("-") else "" order_by = order_by[1:] if reverse else order_by if order_by == "verification_status": qs = queryset.order_by(reverse + "custom_order") elif order_by == "unicef_id": - qs = sorted(queryset, key=lambda o: o.get_unicef_id, reverse=bool(reverse)) + qs = queryset.order_by(reverse + "unicef_id") elif order_by == "dispersion_date": # TODO this field is empty at the moment qs = queryset @@ -475,10 +362,10 @@ def cash_plan_and_payment_plan_ordering(queryset: ExtendedQuerySetSequence, orde else: qs = queryset.order_by(reverse + order_by) - return list(qs) + return qs -def payment_record_and_payment_filter(queryset: ExtendedQuerySetSequence, **kwargs: Any) -> ExtendedQuerySetSequence: +def payment_filter(queryset: QuerySet[Payment], **kwargs: Any) -> QuerySet[Payment]: business_area = kwargs.get("business_area") household = kwargs.get("household") program = kwargs.get("program") @@ -490,25 +377,27 @@ def payment_record_and_payment_filter(queryset: ExtendedQuerySetSequence, **kwar queryset = queryset.filter(household__id=decode_id_string(household)) if program: - queryset = queryset.filter(parent__program=decode_id_string(program)) + queryset = queryset.filter(parent__program_cycle__program=decode_id_string(program)) return queryset -def payment_record_and_payment_ordering(queryset: ExtendedQuerySetSequence, order_by: str) -> List[Any]: +def payment_ordering(queryset: QuerySet[Payment], order_by: str) -> QuerySet[Payment]: reverse = "-" if order_by.startswith("-") else "" order_by = order_by[1:] if reverse else order_by if order_by == "ca_id": - qs = sorted(queryset, key=lambda o: o.get_unicef_id, reverse=bool(reverse)) + qs = queryset.order_by(reverse + "unicef_id") elif order_by in ("head_of_household", "entitlement_quantity", "delivered_quantity", "delivery_date"): order_by_dict = {f"{order_by}__isnull": True} - qs_null = list(queryset.filter(**order_by_dict)) + qs_null = queryset.filter(**order_by_dict) + qs_non_null = queryset.exclude(**order_by_dict) + if reverse: - qs = list(queryset.exclude(**order_by_dict).order_by(f"-{order_by}")) + qs_null + qs = qs_non_null.order_by(f"-{order_by}").union(qs_null) else: - qs = qs_null + list(queryset.exclude(**order_by_dict).order_by(order_by)) + qs = qs_null.union(qs_non_null.order_by(order_by)) else: qs = queryset.order_by(reverse + order_by) - return list(qs) + return qs diff --git a/src/hct_mis_api/apps/payment/fixtures.py b/src/hct_mis_api/apps/payment/fixtures.py index 123df63ea3..c14dc3c465 100644 --- a/src/hct_mis_api/apps/payment/fixtures.py +++ b/src/hct_mis_api/apps/payment/fixtures.py @@ -2,8 +2,8 @@ import string from datetime import timedelta from decimal import Decimal -from random import choice, randint -from typing import Any, Optional, Union +from random import randint +from typing import Any, Optional from uuid import UUID from django.utils import timezone @@ -28,18 +28,10 @@ IndividualRoleInHouseholdFactory, create_household, ) -from hct_mis_api.apps.household.models import ( - MALE, - REFUGEE, - ROLE_PRIMARY, - Household, - Individual, -) -from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices +from hct_mis_api.apps.household.models import MALE, ROLE_PRIMARY, Household, Individual from hct_mis_api.apps.payment.models import ( Approval, ApprovalProcess, - CashPlan, DeliveryMechanism, DeliveryMechanismData, DeliveryMechanismPerPaymentPlan, @@ -50,20 +42,15 @@ Payment, PaymentPlan, PaymentPlanSplit, - PaymentRecord, PaymentVerification, PaymentVerificationPlan, PaymentVerificationSummary, - ServiceProvider, ) from hct_mis_api.apps.payment.utils import to_decimal -from hct_mis_api.apps.program.fixtures import ProgramCycleFactory, ProgramFactory +from hct_mis_api.apps.program.fixtures import ProgramCycleFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) +from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory from hct_mis_api.apps.targeting.models import ( TargetingCriteria, TargetingCriteriaRule, @@ -83,101 +70,14 @@ def update_kwargs_with_usd_currency(kwargs: Any) -> Any: class PaymentVerificationSummaryFactory(DjangoModelFactory): - payment_plan_obj = factory.SubFactory("payment.fixtures.CashPlanFactory") - class Meta: model = PaymentVerificationSummary -class CashPlanFactory(DjangoModelFactory): - class Meta: - model = CashPlan - - ca_id = factory.Sequence(lambda n: f"PP-0000-00-1122334{n}") - business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) - program = factory.SubFactory(ProgramFactory) - status_date = factory.Faker( - "date_time_this_decade", - before_now=False, - after_now=True, - tzinfo=utc, - ) - status = factory.fuzzy.FuzzyChoice( - CashPlan.STATUS_CHOICE, - getter=lambda c: c[0], - ) - name = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - distribution_level = "Registration Group" - dispersion_date = factory.Faker( - "date_time_this_decade", - before_now=False, - after_now=True, - tzinfo=utc, - ) - coverage_duration = factory.fuzzy.FuzzyInteger(1, 4) - coverage_unit = factory.Faker( - "random_element", - elements=["Day(s)", "Week(s)", "Month(s)", "Year(s)"], - ) - comments = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - delivery_type = factory.fuzzy.FuzzyChoice( - DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, - getter=lambda c: c[0], - ) - assistance_measurement = factory.Faker("currency_name") - assistance_through = factory.Faker("random_element", elements=["ING", "Bank of America", "mBank"]) - vision_id = factory.Faker("uuid4") - funds_commitment = factory.fuzzy.FuzzyInteger(1000, 99999999) - exchange_rate = factory.fuzzy.FuzzyDecimal(0.1, 9.9) - down_payment = factory.fuzzy.FuzzyInteger(1000, 99999999) - validation_alerts_count = factory.fuzzy.FuzzyInteger(1, 3) - total_persons_covered = factory.fuzzy.FuzzyInteger(1, 4) - total_persons_covered_revised = factory.fuzzy.FuzzyInteger(1, 4) - - total_entitled_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_entitled_quantity_revised = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_delivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_undelivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - - total_entitled_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_entitled_quantity_revised_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_delivered_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_undelivered_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - - @factory.post_generation - def payment_verification_summary(self, create: bool, extracted: bool, **kwargs: Any) -> None: - if not create: - return - - PaymentVerificationSummaryFactory(payment_plan_obj=self) - - -class ServiceProviderFactory(DjangoModelFactory): - class Meta: - model = ServiceProvider - - business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) - ca_id = factory.Iterator(CaIdIterator("SRV")) - full_name = factory.Faker("company") - short_name = factory.LazyAttribute(lambda o: o.full_name[0:3]) - country = factory.Faker("country_code") - vision_id = factory.fuzzy.FuzzyInteger(1342342, 9999999932) - - class DeliveryMechanismFactory(DjangoModelFactory): payment_gateway_id = factory.Faker("uuid4") code = factory.Faker("uuid4") - name = factory.Faker("sentence", nb_words=3, variable_nb_words=True, ext_word_list=None) + name = factory.Faker("sentence", nb_words=4, variable_nb_words=True, ext_word_list=None) transfer_type = factory.fuzzy.FuzzyChoice(DeliveryMechanism.TransferType.choices, getter=lambda c: c[0]) class Meta: @@ -215,68 +115,8 @@ class Meta: xlsx_template = factory.SubFactory(FinancialServiceProviderXlsxTemplateFactory) -class PaymentRecordFactory(DjangoModelFactory): - class Meta: - model = PaymentRecord - - business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) - status = factory.fuzzy.FuzzyChoice( - PaymentRecord.STATUS_CHOICE, - getter=lambda c: c[0], - ) - full_name = factory.Faker("name") - status_date = factory.Faker( - "date_time_this_decade", - before_now=False, - after_now=True, - tzinfo=utc, - ) - ca_id = factory.Iterator(CaIdIterator("PR")) - ca_hash_id = factory.Faker("uuid4") - parent = factory.SubFactory(CashPlanFactory) - household = factory.SubFactory(HouseholdFactory) - total_persons_covered = factory.fuzzy.FuzzyInteger(1, 7) - distribution_modality = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - target_population = factory.SubFactory(TargetPopulationFactory) - entitlement_card_number = factory.Faker("ssn") - entitlement_card_status = factory.fuzzy.FuzzyChoice( - PaymentRecord.ENTITLEMENT_CARD_STATUS_CHOICE, - getter=lambda c: c[0], - ) - entitlement_card_issue_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - currency = factory.Faker("currency_code") - entitlement_quantity = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) - entitlement_quantity_usd = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) - delivered_quantity = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) - delivered_quantity_usd = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) - delivery_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - service_provider = factory.SubFactory(ServiceProviderFactory) - registration_ca_id = factory.Faker("uuid4") - - @classmethod - def _create(cls, model_class: Any, *args: Any, **kwargs: Any) -> "PaymentRecord": - instance = model_class(**update_kwargs_with_usd_currency(kwargs)) - instance.save() - return instance - - class PaymentVerificationPlanFactory(DjangoModelFactory): - payment_plan_obj = factory.SubFactory(CashPlanFactory) + payment_plan = factory.SubFactory("hct_mis_api.apps.payment.fixtures.PaymentPlanFactory") status = factory.fuzzy.FuzzyChoice( ((PaymentVerificationPlan.STATUS_PENDING, "pending"),), getter=lambda c: c[0], @@ -301,7 +141,7 @@ class Meta: class PaymentVerificationFactory(DjangoModelFactory): - payment_obj = factory.SubFactory(PaymentRecordFactory) + payment = factory.SubFactory("hct_mis_api.apps.payment.fixtures.PaymentFactory") payment_verification_plan = factory.Iterator(PaymentVerificationPlan.objects.all()) status = factory.fuzzy.FuzzyChoice( PaymentVerification.STATUS_CHOICES, @@ -375,137 +215,6 @@ def cycle(self, create: bool, extracted: bool, **kwargs: Any) -> None: ProgramCycleFactory(program=self, **kwargs) -class RealCashPlanFactory(DjangoModelFactory): - class Meta: - model = CashPlan - - business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) - ca_id = factory.Iterator(CaIdIterator("CSH")) - ca_hash_id = factory.Faker("uuid4") - program = factory.SubFactory(RealProgramFactory) - status_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - status = factory.fuzzy.FuzzyChoice( - CashPlan.STATUS_CHOICE, - getter=lambda c: c[0], - ) - name = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - distribution_level = "Registration Group" - dispersion_date = factory.Faker( - "date_time_this_decade", - before_now=False, - after_now=True, - tzinfo=utc, - ) - coverage_duration = factory.fuzzy.FuzzyInteger(1, 4) - coverage_unit = factory.Faker( - "random_element", - elements=["Day(s)", "Week(s)", "Month(s)", "Year(s)"], - ) - comments = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - delivery_type = factory.fuzzy.FuzzyChoice( - DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, - getter=lambda c: c[0], - ) - assistance_measurement = factory.Faker("currency_name") - assistance_through = factory.LazyAttribute(lambda o: ServiceProvider.objects.order_by("?").first().ca_id) - vision_id = factory.fuzzy.FuzzyInteger(123534, 12353435234) - funds_commitment = factory.fuzzy.FuzzyInteger(1000, 99999999) - exchange_rate = factory.fuzzy.FuzzyDecimal(0.1, 9.9) - down_payment = factory.fuzzy.FuzzyInteger(1000, 99999999) - validation_alerts_count = factory.fuzzy.FuzzyInteger(1, 3) - total_persons_covered = factory.fuzzy.FuzzyInteger(1, 4) - total_persons_covered_revised = factory.fuzzy.FuzzyInteger(1, 4) - - total_entitled_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_entitled_quantity_revised = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_delivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - total_undelivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) - - service_provider = factory.LazyAttribute(lambda o: ServiceProvider.objects.order_by("?").first()) - - @factory.post_generation - def payment_verification_summary(self, create: bool, extracted: bool, **kwargs: Any) -> None: - if not create: - return - - PaymentVerificationSummaryFactory(payment_plan_obj=self) - - @factory.post_generation - def cycle(self, create: bool, extracted: bool, **kwargs: Any) -> None: - if not create: - return - ProgramCycleFactory(program=self.program, **kwargs) - - -class RealPaymentRecordFactory(DjangoModelFactory): - class Meta: - model = PaymentRecord - - business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) - status = factory.fuzzy.FuzzyChoice( - PaymentRecord.STATUS_CHOICE, - getter=lambda c: c[0], - ) - full_name = factory.Faker("name") - status_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - ca_id = factory.Iterator(CaIdIterator("PR")) - ca_hash_id = factory.Faker("uuid4") - household = factory.LazyAttribute(lambda o: Household.objects.order_by("?").first()) - head_of_household = factory.LazyAttribute(lambda o: o.household.head_of_household) - total_persons_covered = factory.fuzzy.FuzzyInteger(1, 7) - distribution_modality = factory.Faker( - "sentence", - nb_words=6, - variable_nb_words=True, - ext_word_list=None, - ) - target_population = factory.SubFactory(TargetPopulationFactory) - entitlement_card_number = factory.Faker("ssn") - entitlement_card_status = factory.fuzzy.FuzzyChoice( - PaymentRecord.ENTITLEMENT_CARD_STATUS_CHOICE, - getter=lambda c: c[0], - ) - entitlement_card_issue_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - delivery_type = factory.LazyAttribute(lambda o: DeliveryMechanism.objects.order_by("?").first()) - currency = factory.Faker("currency_code") - entitlement_quantity = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) - delivered_quantity = factory.LazyAttribute(lambda o: Decimal(randint(10, int(o.entitlement_quantity)))) - delivered_quantity_usd = factory.LazyAttribute(lambda o: Decimal(randint(10, int(o.entitlement_quantity)))) - delivery_date = factory.Faker( - "date_time_this_decade", - before_now=True, - after_now=False, - tzinfo=utc, - ) - service_provider = factory.LazyAttribute(lambda o: ServiceProvider.objects.order_by("?").first()) - registration_ca_id = factory.Faker("uuid4") - - class PaymentPlanFactory(DjangoModelFactory): class Meta: model = PaymentPlan @@ -532,8 +241,7 @@ class Meta: created_by = factory.SubFactory(UserFactory) unicef_id = factory.Faker("uuid4") target_population = factory.SubFactory(TargetPopulationFactory) - program = factory.SubFactory(RealProgramFactory) - program_cycle = factory.LazyAttribute(lambda o: o.program.cycles.first()) + program_cycle = factory.SubFactory(ProgramCycleFactory) currency = factory.fuzzy.FuzzyChoice(CURRENCY_CHOICES, getter=lambda c: c[0]) dispersion_start_date = factory.Faker( @@ -549,6 +257,7 @@ class Meta: male_adults_count = factory.fuzzy.FuzzyInteger(2, 4) total_households_count = factory.fuzzy.FuzzyInteger(2, 4) total_individuals_count = factory.fuzzy.FuzzyInteger(8, 16) + name = factory.Faker("sentence", nb_words=6, variable_nb_words=True, ext_word_list=None) class PaymentPlanSplitFactory(DjangoModelFactory): @@ -662,7 +371,7 @@ class Meta: def create_payment_verification_plan_with_status( - cash_plan: Union[CashPlan, PaymentPlan], + payment_plan: PaymentPlan, user: "User", business_area: BusinessArea, program: Program, @@ -671,11 +380,10 @@ def create_payment_verification_plan_with_status( verification_channel: Optional[str] = None, create_failed_payments: bool = False, ) -> PaymentVerificationPlan: - if not cash_plan.payment_verification_summary.exists(): - PaymentVerificationSummary.objects.create( - payment_plan_obj=cash_plan, - ) - payment_verification_plan = PaymentVerificationPlanFactory(payment_plan_obj=cash_plan) + if not hasattr(payment_plan, "payment_verification_summary"): + PaymentVerificationSummary.objects.create(payment_plan=payment_plan) + + payment_verification_plan = PaymentVerificationPlanFactory(payment_plan=payment_plan) payment_verification_plan.status = status if verification_channel: payment_verification_plan.verification_channel = verification_channel @@ -695,39 +403,34 @@ def create_payment_verification_plan_with_status( household.programs.add(program) - currency = getattr(cash_plan, "currency", None) + currency = getattr(payment_plan, "currency", None) if currency is None: currency = "PLN" - if isinstance(cash_plan, CashPlan): - payment_record = PaymentRecordFactory( - parent=cash_plan, household=household, target_population=target_population, currency=currency - ) - else: - additional_args = {} - if create_failed_payments: # create only two failed Payments - if n == 2: - additional_args = { - "delivered_quantity": to_decimal(0), - "delivered_quantity_usd": to_decimal(0), - "status": Payment.STATUS_NOT_DISTRIBUTED, - } - if n == 3: - additional_args = { - "delivered_quantity": None, - "delivered_quantity_usd": None, - "status": Payment.STATUS_ERROR, - } - payment_record = PaymentFactory( - parent=cash_plan, - household=household, - currency=currency, - **additional_args, - ) + additional_args = {} + if create_failed_payments: # create only two failed Payments + if n == 2: + additional_args = { + "delivered_quantity": to_decimal(0), + "delivered_quantity_usd": to_decimal(0), + "status": Payment.STATUS_NOT_DISTRIBUTED, + } + if n == 3: + additional_args = { + "delivered_quantity": None, + "delivered_quantity_usd": None, + "status": Payment.STATUS_ERROR, + } + payment_record = PaymentFactory( + parent=payment_plan, + household=household, + currency=currency, + **additional_args, + ) pv = PaymentVerificationFactory( payment_verification_plan=payment_verification_plan, - payment_obj=payment_record, + payment=payment_record, status=PaymentVerification.STATUS_PENDING, ) pv.set_pending() @@ -736,51 +439,6 @@ def create_payment_verification_plan_with_status( return payment_verification_plan -def generate_real_cash_plans() -> None: - if ServiceProvider.objects.count() < 3: - ServiceProviderFactory.create_batch(3) - program = Program.objects.filter(name="Test Program").first() or RealProgramFactory(status=Program.ACTIVE) - cash_plans = RealCashPlanFactory.create_batch(3, program=program) - for cash_plan in cash_plans: - generate_payment_verification_plan_with_status = choice([True, False, False]) - targeting_criteria = TargetingCriteriaFactory() - - rule = TargetingCriteriaRule.objects.create(targeting_criteria=targeting_criteria) - TargetingCriteriaRuleFilter.objects.create( - targeting_criteria_rule=rule, comparison_method="EQUALS", field_name="residence_status", arguments=[REFUGEE] - ) - target_population = TargetPopulationFactory( - program=program, - status=TargetPopulation.STATUS_OPEN, - targeting_criteria=targeting_criteria, - ) - full_rebuild(target_population) - target_population.status = TargetPopulation.STATUS_READY_FOR_CASH_ASSIST - target_population.save() - RealPaymentRecordFactory.create_batch( - 5, - target_population=target_population, - parent=cash_plan, - ) - - if generate_payment_verification_plan_with_status: - root = User.objects.get(username="root") - create_payment_verification_plan_with_status( - cash_plan, - root, - cash_plan.business_area, - target_population.program, - target_population, - PaymentVerificationPlan.STATUS_ACTIVE, - ) - - program.households.set( - PaymentRecord.objects.exclude(status=PaymentRecord.STATUS_ERROR) - .filter(parent__in=cash_plans) - .values_list("household__id", flat=True) - ) - - def generate_reconciled_payment_plan() -> None: afghanistan = BusinessArea.objects.get(slug="afghanistan") root = User.objects.get(username="root") @@ -788,6 +446,7 @@ def generate_reconciled_payment_plan() -> None: tp: TargetPopulation = TargetPopulation.objects.all()[0] payment_plan = PaymentPlan.objects.update_or_create( + name="Reconciled Payment Plan", unicef_id="PP-0060-22-11223344", business_area=afghanistan, target_population=tp, @@ -797,7 +456,6 @@ def generate_reconciled_payment_plan() -> None: status_date=now, status=PaymentPlan.Status.ACCEPTED, created_by=root, - program=tp.program, program_cycle=tp.program.cycles.first(), total_delivered_quantity=999, total_entitled_quantity=2999, @@ -966,6 +624,7 @@ def generate_payment_plan() -> None: payment_plan_pk = UUID("00000000-feed-beef-0000-00000badf00d") payment_plan = PaymentPlan.objects.update_or_create( + name="Test Payment Plan", pk=payment_plan_pk, business_area=afghanistan, target_population=target_population, @@ -974,7 +633,6 @@ def generate_payment_plan() -> None: dispersion_end_date=now + timedelta(days=14), status_date=now, created_by=root, - program=program, program_cycle=program_cycle, )[0] diff --git a/src/hct_mis_api/apps/payment/forms.py b/src/hct_mis_api/apps/payment/forms.py index 4191e4193e..113b21231b 100644 --- a/src/hct_mis_api/apps/payment/forms.py +++ b/src/hct_mis_api/apps/payment/forms.py @@ -1,43 +1,7 @@ from django import forms -from django.contrib.admin.widgets import AdminSplitDateTime from django.contrib.postgres.forms import DecimalRangeField -from django.templatetags.static import static -from hct_mis_api.apps.payment.models import ( - AcceptanceProcessThreshold, - CashPlan, - DeliveryMechanism, -) - - -class ImportPaymentRecordsForm(forms.ModelForm): - currency = forms.ChoiceField(choices=(("UAH", "Hryvnia"),)) - delivery_type = forms.ModelChoiceField(queryset=DeliveryMechanism.objects.filter(is_active=True)) - reconciliation_file = forms.FileField() - start_date = forms.SplitDateTimeField(widget=AdminSplitDateTime) - end_date = forms.SplitDateTimeField(widget=AdminSplitDateTime) - dispersion_date = forms.SplitDateTimeField(widget=AdminSplitDateTime) - delivery_date = forms.SplitDateTimeField(widget=AdminSplitDateTime) - status_date = forms.SplitDateTimeField(widget=AdminSplitDateTime) - - class Meta: - model = CashPlan - exclude = ( - "ca_id", - "ca_hash_id", - "id", - "total_persons_covered", - "total_entitled_quantity", - "total_entitled_quantity_revised", - "total_persons_covered_revised", - "total_delivered_quantity", - "total_undelivered_quantity", - "exchange_rate", - "session", - ) - - class Media: - js = (static("admin/js/core.js"),) +from hct_mis_api.apps.payment.models import AcceptanceProcessThreshold class AcceptanceProcessThresholdForm(forms.ModelForm): diff --git a/src/hct_mis_api/apps/payment/management/commands/fix_payment_records.py b/src/hct_mis_api/apps/payment/management/commands/fix_payment_records.py deleted file mode 100644 index 7c1187fc7c..0000000000 --- a/src/hct_mis_api/apps/payment/management/commands/fix_payment_records.py +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any - -from django.core.management import BaseCommand - -from hct_mis_api.apps.payment.models import PaymentRecord - - -class Command(BaseCommand): - help = "Fix payment records delivered amount" - - def handle(self, *args: Any, **options: Any) -> None: - self.stdout.write("Updating payment records") - updated = PaymentRecord.objects.filter(status=PaymentRecord.STATUS_FORCE_FAILED).update( - delivered_quantity=0, - delivered_quantity_usd=0, - delivery_date=None, - ) - self.stdout.write(f"Updated {updated} payment records") diff --git a/src/hct_mis_api/apps/payment/migrations/0002_migration.py b/src/hct_mis_api/apps/payment/migrations/0002_migration.py new file mode 100644 index 0000000000..c5ed085711 --- /dev/null +++ b/src/hct_mis_api/apps/payment/migrations/0002_migration.py @@ -0,0 +1,36 @@ +# Generated by Django 3.2.25 on 2024-09-30 09:00 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0001_migration'), + ('payment', '0001_migration'), + ] + + operations = [ + migrations.RemoveField( + model_name='financialserviceprovider', + name='delivery_mechanisms_choices', + ), + migrations.RemoveField( + model_name='payment', + name='delivery_type_choice', + ), + migrations.RemoveField( + model_name='paymentplan', + name='program', + ), + migrations.RemoveField( + model_name='paymentrecord', + name='delivery_type_choice', + ), + migrations.AlterField( + model_name='paymentplan', + name='program_cycle', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_plans', to='program.programcycle'), + ), + ] diff --git a/src/hct_mis_api/apps/payment/migrations/0003_migration.py b/src/hct_mis_api/apps/payment/migrations/0003_migration.py new file mode 100644 index 0000000000..4dbc1594d0 --- /dev/null +++ b/src/hct_mis_api/apps/payment/migrations/0003_migration.py @@ -0,0 +1,118 @@ +# Generated by Django 3.2.25 on 2024-10-23 23:15 +from django.db import migrations, models, utils, transaction + + +class Migration(migrations.Migration): + + dependencies = [ + ("payment", "0002_migration"), + ("household", "0003_migration"), + ] + + operations = [ + migrations.AddField( + model_name="cashplan", + name="is_migrated_to_payment_plan", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="paymentplan", + name="internal_data", + field=models.JSONField(default=dict), + ), + migrations.AddField( + model_name="paymentplan", + name="is_cash_assist", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="payment", + name="is_cash_assist", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="payment", + name="internal_data", + field=models.JSONField(default=dict), + ), + migrations.RemoveConstraint( + model_name="payment", + name="payment_plan_and_household", + ), + migrations.AddConstraint( + model_name="payment", + constraint=models.UniqueConstraint( + condition=models.Q(("is_cash_assist", False)), + fields=("parent", "household"), + name="payment_plan_and_household", + ), + ), + migrations.AddField( + model_name="financialserviceprovider", + name="internal_data", + field=models.JSONField(default=dict), + ), + migrations.AddField( + model_name="paymentverificationplan", + name="payment_plan", + field=models.ForeignKey( + to="payment.PaymentPlan", + null=True, # Temporarily allow nulls for migration purposes + on_delete=models.CASCADE, + related_name="payment_verification_plans", + ), + ), + migrations.AddField( + model_name="paymentverificationsummary", + name="payment_plan", + field=models.OneToOneField( + to="payment.PaymentPlan", + null=True, # Temporarily allow nulls for migration purposes + on_delete=models.CASCADE, + related_name="payment_verification_summary", + ), + ), + migrations.AddField( + model_name="paymentverification", + name="payment", + field=models.OneToOneField( + to="payment.Payment", + null=True, # Temporarily allow nulls for migration purposes + on_delete=models.CASCADE, + related_name="payment_verification", + ), + ), + migrations.AlterField( + model_name='paymentverification', + name='payment_content_type', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, + to='contenttypes.contenttype'), + ), + migrations.AlterField( + model_name='paymentverification', + name='payment_object_id', + field=models.UUIDField(null=True), + ), + migrations.AlterField( + model_name='paymentverificationplan', + name='payment_plan_content_type', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, + to='contenttypes.contenttype'), + ), + migrations.AlterField( + model_name='paymentverificationplan', + name='payment_plan_object_id', + field=models.UUIDField(null=True), + ), + migrations.AlterField( + model_name='paymentverificationsummary', + name='payment_plan_content_type', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, + to='contenttypes.contenttype'), + ), + migrations.AlterField( + model_name='paymentverificationsummary', + name='payment_plan_object_id', + field=models.UUIDField(null=True), + ), + ] diff --git a/src/hct_mis_api/apps/payment/models.py b/src/hct_mis_api/apps/payment/models.py index a24e3207c4..baa7662171 100644 --- a/src/hct_mis_api/apps/payment/models.py +++ b/src/hct_mis_api/apps/payment/models.py @@ -17,7 +17,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import ArrayField, IntegerRangeField from django.contrib.postgres.validators import RangeMinValueValidator -from django.core.exceptions import ObjectDoesNotExist, ValidationError +from django.core.exceptions import ValidationError from django.core.validators import ( MaxLengthValidator, MaxValueValidator, @@ -48,7 +48,6 @@ from multiselectfield import MultiSelectField from psycopg2._range import NumericRange -from hct_mis_api.apps.account.models import HorizontalChoiceArrayField from hct_mis_api.apps.activity_log.utils import create_mapping_dict from hct_mis_api.apps.core.currencies import CURRENCY_CHOICES, USDC from hct_mis_api.apps.core.exchange_rates import ExchangeRates @@ -76,6 +75,7 @@ from hct_mis_api.apps.utils.models import ( AdminUrlMixin, ConcurrencyModel, + InternalDataFieldModel, MergedManager, MergeStatusModel, PendingManager, @@ -184,12 +184,10 @@ class Meta: @property def get_unicef_id(self) -> str: - # TODO: maybe 'ca_id' rename to 'unicef_id'? return self.ca_id if isinstance(self, CashPlan) else self.unicef_id def get_exchange_rate(self, exchange_rates_client: Optional["ExchangeRateClient"] = None) -> float: if self.currency == USDC: - # TODO: is it good place for that? # exchange rate for Digital currency return 1.0 @@ -296,9 +294,6 @@ class GenericPayment(TimeStampedUUIDModel): status_date = models.DateTimeField() household = models.ForeignKey("household.Household", on_delete=models.CASCADE) head_of_household = models.ForeignKey("household.Individual", on_delete=models.CASCADE, null=True) - delivery_type_choice = models.CharField( - choices=DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, max_length=32, null=True - ) # TODO MB drop later delivery_type = models.ForeignKey("payment.DeliveryMechanism", on_delete=models.SET_NULL, null=True) currency = models.CharField( max_length=4, @@ -431,7 +426,14 @@ def delivery_mechanism(self) -> Optional[str]: return self.payment_plan.delivery_mechanisms.first().delivery_mechanism -class PaymentPlan(ConcurrencyModel, SoftDeletableModel, GenericPaymentPlan, UnicefIdentifiedModel, AdminUrlMixin): +class PaymentPlan( + TimeStampedUUIDModel, + InternalDataFieldModel, + ConcurrencyModel, + SoftDeletableModel, + UnicefIdentifiedModel, + AdminUrlMixin, +): ACTIVITY_LOG_MAPPING = create_mapping_dict( [ "status", @@ -498,9 +500,72 @@ class Action(models.TextChoices): FINISH = "FINISH", "Finish" SEND_TO_PAYMENT_GATEWAY = "SEND_TO_PAYMENT_GATEWAY", "Send to Payment Gateway" - program_cycle = models.ForeignKey( - "program.ProgramCycle", related_name="payment_plans", null=True, blank=True, on_delete=models.CASCADE + usd_fields = [ + "total_entitled_quantity_usd", + "total_entitled_quantity_revised_usd", + "total_delivered_quantity_usd", + "total_undelivered_quantity_usd", + ] + + business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) + status_date = models.DateTimeField() + start_date = models.DateTimeField( + db_index=True, + blank=True, + null=True, ) + end_date = models.DateTimeField( + db_index=True, + blank=True, + null=True, + ) + exchange_rate = models.DecimalField(decimal_places=8, blank=True, null=True, max_digits=14) + + total_entitled_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + ) + total_entitled_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_entitled_quantity_revised = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_entitled_quantity_revised_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_delivered_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_delivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_undelivered_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_undelivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + + program_cycle = models.ForeignKey("program.ProgramCycle", related_name="payment_plans", on_delete=models.CASCADE) created_by = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, @@ -548,18 +613,7 @@ class Action(models.TextChoices): blank=True, ) steficon_applied_date = models.DateTimeField(blank=True, null=True) - payment_verification_summary = GenericRelation( - "payment.PaymentVerificationSummary", - content_type_field="payment_plan_content_type", - object_id_field="payment_plan_object_id", - related_query_name="payment_plan", - ) - payment_verification_plan = GenericRelation( - "payment.PaymentVerificationPlan", - content_type_field="payment_plan_content_type", - object_id_field="payment_plan_object_id", - related_query_name="payment_plan", - ) + source_payment_plan = models.ForeignKey( "self", null=True, blank=True, on_delete=models.CASCADE, related_name="follow_ups" ) @@ -575,6 +629,7 @@ class Action(models.TextChoices): null=True, blank=True, ) + is_cash_assist = models.BooleanField(default=False) class Meta: verbose_name = "Payment Plan" @@ -811,10 +866,8 @@ def status_mark_as_reviewed(self) -> None: def status_finished(self) -> None: self.status_date = timezone.now() - if not self.payment_verification_summary.exists(): - PaymentVerificationSummary.objects.create( - payment_plan_obj=self, - ) + if not hasattr(self, "payment_verification_summary"): + PaymentVerificationSummary.objects.create(payment_plan=self) @transition( field=status, @@ -944,7 +997,6 @@ def imported_file_name(self) -> str: @property def is_reconciled(self) -> bool: - # TODO what in case of active grievance tickets? if not self.eligible_payments.exists(): return False @@ -1014,7 +1066,7 @@ def unsuccessful_payments(self) -> "QuerySet": status__in=[ Payment.STATUS_ERROR, # delivered_quantity < 0 (-1) Payment.STATUS_NOT_DISTRIBUTED, # delivered_quantity == 0 - Payment.STATUS_FORCE_FAILED, # TODO remove force failed? + Payment.STATUS_FORCE_FAILED, ] ) @@ -1045,9 +1097,8 @@ def payments_used_in_follow_payment_plans(self) -> "QuerySet": return Payment.objects.filter(parent__source_payment_plan_id=self.id, excluded=False) @property - def get_program(self) -> "Program": - # TODO will update after add feature with 'program_cycle' and migrate all data - return self.program_cycle.program if self.program_cycle else self.program + def program(self) -> "Program": + return self.program_cycle.program def _get_last_approval_process_data(self) -> ModifiedData: approval_process = hasattr(self, "approval_process") and self.approval_process.first() @@ -1103,6 +1154,45 @@ def can_send_to_payment_gateway(self) -> bool: ).exists() ) + # from generic pp + def get_exchange_rate(self, exchange_rates_client: Optional["ExchangeRateClient"] = None) -> float: + if self.currency == USDC: + # exchange rate for Digital currency USDC to USD + return 1.0 + + if exchange_rates_client is None: + exchange_rates_client = ExchangeRates() + + return exchange_rates_client.get_exchange_rate_for_currency_code(self.currency, self.currency_exchange_date) + + def available_payment_records( + self, + payment_verification_plan: Optional["PaymentVerificationPlan"] = None, + extra_validation: Optional[Callable] = None, + ) -> QuerySet: + params = Q(status__in=GenericPayment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0) + + if payment_verification_plan: + params &= Q( + Q(payment_verification__isnull=True) + | Q(payment_verification__payment_verification_plan=payment_verification_plan) + ) + else: + params &= Q(payment_verification__isnull=True) + + payment_records = self.payment_items.select_related("head_of_household").filter(params).distinct() + + if extra_validation: + payment_records = list(map(lambda pr: pr.pk, filter(extra_validation, payment_records))) + + qs = Payment.objects.filter(pk__in=payment_records) + + return qs + + @property + def can_create_payment_verification_plan(self) -> int: + return self.available_payment_records().count() > 0 + class FlexFieldArrayField(ArrayField): def formfield(self, form_class: Optional[Any] = ..., choices_form_class: Optional[Any] = ..., **kwargs: Any) -> Any: @@ -1402,7 +1492,7 @@ def __str__(self) -> str: return f"{self.financial_service_provider.name} - {self.xlsx_template} - {self.delivery_mechanism}" # pragma: no cover -class FinancialServiceProvider(LimitBusinessAreaModelMixin, TimeStampedUUIDModel): +class FinancialServiceProvider(InternalDataFieldModel, LimitBusinessAreaModelMixin, TimeStampedUUIDModel): COMMUNICATION_CHANNEL_API = "API" COMMUNICATION_CHANNEL_SFTP = "SFTP" COMMUNICATION_CHANNEL_XLSX = "XLSX" @@ -1422,9 +1512,6 @@ class FinancialServiceProvider(LimitBusinessAreaModelMixin, TimeStampedUUIDModel ) name = models.CharField(max_length=100, unique=True) vision_vendor_number = models.CharField(max_length=100, unique=True) - delivery_mechanisms_choices = HorizontalChoiceArrayField( - models.CharField(choices=DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, max_length=32), null=True - ) # TODO MB drop later delivery_mechanisms = models.ManyToManyField("payment.DeliveryMechanism") distribution_limit = models.DecimalField( decimal_places=2, @@ -1613,6 +1700,7 @@ class CashPlan(ConcurrencyModel, AdminUrlMixin, GenericPaymentPlan): object_id_field="payment_plan_object_id", related_query_name="cash_plan", ) + is_migrated_to_payment_plan = models.BooleanField(default=False) def __str__(self) -> str: return self.name or "" @@ -1644,7 +1732,6 @@ def currency_exchange_date(self) -> datetime: return self.dispersion_date def unicef_id(self) -> str: - # TODO: maybe 'ca_id' rename to 'unicef_id'? return self.ca_id @property @@ -1708,7 +1795,6 @@ class PaymentRecord(ConcurrencyModel, AdminUrlMixin, GenericPayment): object_id_field="payment_object_id", related_query_name="payment_record", ) - ticket_sensitive_details = GenericRelation( "grievance.TicketSensitiveDetails", content_type_field="payment_content_type", @@ -1724,7 +1810,125 @@ def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: return self.STATUS_SUCCESS -class Payment(SoftDeletableModel, GenericPayment, UnicefIdentifiedModel, AdminUrlMixin, SignatureMixin): +class Payment( + TimeStampedUUIDModel, + InternalDataFieldModel, + SoftDeletableModel, + UnicefIdentifiedModel, + AdminUrlMixin, + SignatureMixin, +): + # GenericPayment fields + + usd_fields = ["delivered_quantity_usd", "entitlement_quantity_usd"] + + STATUS_SUCCESS = "Transaction Successful" + STATUS_ERROR = "Transaction Erroneous" + STATUS_DISTRIBUTION_SUCCESS = "Distribution Successful" + STATUS_NOT_DISTRIBUTED = "Not Distributed" + STATUS_FORCE_FAILED = "Force failed" + STATUS_DISTRIBUTION_PARTIAL = "Partially Distributed" + STATUS_PENDING = "Pending" + # Payment Gateway statuses + STATUS_SENT_TO_PG = "Sent to Payment Gateway" + STATUS_SENT_TO_FSP = "Sent to FSP" + STATUS_MANUALLY_CANCELLED = "Manually Cancelled" + + STATUS_CHOICE = ( + (STATUS_DISTRIBUTION_SUCCESS, _("Distribution Successful")), # Delivered Fully + (STATUS_NOT_DISTRIBUTED, _("Not Distributed")), # Not Delivered + (STATUS_SUCCESS, _("Transaction Successful")), # Delivered Fully + (STATUS_ERROR, _("Transaction Erroneous")), # Unsuccessful + (STATUS_FORCE_FAILED, _("Force failed")), # Force Failed + (STATUS_DISTRIBUTION_PARTIAL, _("Partially Distributed")), # Delivered Partially + (STATUS_PENDING, _("Pending")), # Pending + (STATUS_SENT_TO_PG, _("Sent to Payment Gateway")), + (STATUS_SENT_TO_FSP, _("Sent to FSP")), + (STATUS_MANUALLY_CANCELLED, _("Manually Cancelled")), + ) + + ALLOW_CREATE_VERIFICATION = (STATUS_SUCCESS, STATUS_DISTRIBUTION_SUCCESS, STATUS_DISTRIBUTION_PARTIAL) + PENDING_STATUSES = (STATUS_PENDING, STATUS_SENT_TO_PG, STATUS_SENT_TO_FSP) + + ENTITLEMENT_CARD_STATUS_ACTIVE = "ACTIVE" + ENTITLEMENT_CARD_STATUS_INACTIVE = "INACTIVE" + ENTITLEMENT_CARD_STATUS_CHOICE = Choices( + (ENTITLEMENT_CARD_STATUS_ACTIVE, _("Active")), + (ENTITLEMENT_CARD_STATUS_INACTIVE, _("Inactive")), + ) + + business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) + status = models.CharField( + max_length=255, + choices=STATUS_CHOICE, + default=STATUS_PENDING, + ) + status_date = models.DateTimeField() + household = models.ForeignKey("household.Household", on_delete=models.CASCADE) + head_of_household = models.ForeignKey("household.Individual", on_delete=models.CASCADE, null=True) + delivery_type = models.ForeignKey("payment.DeliveryMechanism", on_delete=models.SET_NULL, null=True) + currency = models.CharField( + max_length=4, + ) + entitlement_quantity = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + entitlement_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivered_quantity = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivery_date = models.DateTimeField(null=True, blank=True) + transaction_reference_id = models.CharField(max_length=255, null=True, blank=True) # transaction_id + transaction_status_blockchain_link = models.CharField(max_length=255, null=True, blank=True) + + def mark_as_failed(self) -> None: + if self.status is self.STATUS_FORCE_FAILED: + raise ValidationError("Status shouldn't be failed") + self.status = self.STATUS_FORCE_FAILED + self.status_date = timezone.now() + self.delivered_quantity = 0 + self.delivered_quantity_usd = 0 + self.delivery_date = None + + def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: datetime) -> None: + if self.status != self.STATUS_FORCE_FAILED: + raise ValidationError("Only payment marked as force failed can be reverted") + if self.entitlement_quantity is None: + raise ValidationError("Entitlement quantity need to be set in order to revert") + + self.status = self.get_revert_mark_as_failed_status(delivered_quantity) + self.status_date = timezone.now() + self.delivered_quantity = delivered_quantity + self.delivery_date = delivery_date + + @property + def payment_status(self) -> str: + status = "-" + if self.status == GenericPayment.STATUS_PENDING: + status = "Pending" + + elif self.status in (GenericPayment.STATUS_DISTRIBUTION_SUCCESS, GenericPayment.STATUS_SUCCESS): + status = "Delivered Fully" + + elif self.status == GenericPayment.STATUS_DISTRIBUTION_PARTIAL: + status = "Delivered Partially" + + elif self.status == GenericPayment.STATUS_NOT_DISTRIBUTED: + status = "Not Delivered" + + elif self.status == GenericPayment.STATUS_ERROR: + status = "Unsuccessful" + + elif self.status == GenericPayment.STATUS_FORCE_FAILED: + status = "Force Failed" + + return status + parent = models.ForeignKey( "payment.PaymentPlan", on_delete=models.CASCADE, @@ -1737,13 +1941,6 @@ class Payment(SoftDeletableModel, GenericPayment, UnicefIdentifiedModel, AdminUr "payment.FinancialServiceProvider", on_delete=models.PROTECT, null=True ) collector = models.ForeignKey("household.Individual", on_delete=models.CASCADE, related_name="collector_payments") - payment_verification = GenericRelation( - "payment.PaymentVerification", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment", - ) - source_payment = models.ForeignKey( "self", null=True, blank=True, on_delete=models.CASCADE, related_name="follow_ups" ) @@ -1765,19 +1962,7 @@ class Payment(SoftDeletableModel, GenericPayment, UnicefIdentifiedModel, AdminUr null=True, validators=[MinValueValidator(1000000), MaxValueValidator(9999999), payment_token_and_order_number_validator], ) # 7 digits - ticket_complaint_details = GenericRelation( - "grievance.TicketComplaintDetails", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment", - ) - ticket_sensitive_details = GenericRelation( - "grievance.TicketSensitiveDetails", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment", - ) additional_collector_name = models.CharField( max_length=64, blank=True, @@ -1791,6 +1976,7 @@ class Payment(SoftDeletableModel, GenericPayment, UnicefIdentifiedModel, AdminUr max_length=128, blank=True, null=True, help_text="Use this field for reconciliation data" ) fsp_auth_code = models.CharField(max_length=128, blank=True, null=True, help_text="FSP Auth Code") + is_cash_assist = models.BooleanField(default=False) @property def full_name(self) -> str: @@ -1817,7 +2003,7 @@ class Meta: constraints = [ UniqueConstraint( fields=["parent", "household"], - condition=Q(is_removed=False), + condition=Q(is_removed=False) & Q(is_cash_assist=False), name="payment_plan_and_household", ), UniqueConstraint( @@ -1924,11 +2110,18 @@ class PaymentVerificationPlan(TimeStampedUUIDModel, ConcurrencyModel, UnicefIden (VERIFICATION_CHANNEL_XLSX, "XLSX"), ) status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, db_index=True) - payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) - payment_plan_object_id = UUIDField() + + # TODO TP DROP + payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_plan_object_id = UUIDField(null=True) payment_plan_obj: "Union[PaymentPlan, CashPlan]" = GenericForeignKey( "payment_plan_content_type", "payment_plan_object_id" ) # type: ignore + + payment_plan = models.ForeignKey( + "payment.PaymentPlan", on_delete=models.CASCADE, related_name="payment_verification_plans", null=True + ) + sampling = models.CharField(max_length=50, choices=SAMPLING_CHOICES) verification_channel = models.CharField(max_length=50, choices=VERIFICATION_CHANNEL_CHOICES) sample_size = models.PositiveIntegerField(null=True, blank=True) @@ -1951,13 +2144,14 @@ class PaymentVerificationPlan(TimeStampedUUIDModel, ConcurrencyModel, UnicefIden class Meta: ordering = ("created_at",) + # TODO TP DROP indexes = [ models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), ] @property def business_area(self) -> BusinessArea: - return self.payment_plan_obj.business_area + return self.payment_plan.business_area @property def get_xlsx_verification_file(self) -> FileTemp: @@ -2006,33 +2200,18 @@ def can_activate(self) -> bool: PaymentVerificationPlan.STATUS_RAPID_PRO_ERROR, ) - @property - def get_payment_plan(self) -> Union["PaymentPlan", "CashPlan", None]: - try: - # use GFK instead of self.payment_plan_content_type.model_class().objects.get(pk=self.payment_plan_object_id) - return self.payment_plan_obj - except ObjectDoesNotExist: - return None - @property def get_program(self) -> Optional["Program"]: - if payment_plan := self.get_payment_plan: - program = ( - payment_plan.program_cycle.program - if isinstance(payment_plan, PaymentPlan) and payment_plan.program_cycle - else payment_plan.program - ) - return program - return None + return self.payment_plan.program_cycle.program def build_summary(payment_plan: Optional[Any]) -> None: - statuses_count = payment_plan.get_payment_verification_plans.aggregate( + statuses_count = payment_plan.payment_verification_plans.aggregate( active=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_ACTIVE)), pending=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_PENDING)), finished=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_FINISHED)), ) - summary = payment_plan.get_payment_verification_summary + summary = payment_plan.payment_verification_summary if statuses_count["active"] >= 1: summary.mark_as_active() elif statuses_count["finished"] >= 1 and statuses_count["active"] == 0 and statuses_count["pending"] == 0: @@ -2051,7 +2230,7 @@ def build_summary(payment_plan: Optional[Any]) -> None: dispatch_uid="update_verification_status_in_cash_plan", ) def update_verification_status_in_cash_plan(sender: Any, instance: PaymentVerificationPlan, **kwargs: Any) -> None: - build_summary(instance.payment_plan_obj) + build_summary(instance.payment_plan) @receiver( @@ -2062,7 +2241,7 @@ def update_verification_status_in_cash_plan(sender: Any, instance: PaymentVerifi def update_verification_status_in_cash_plan_on_delete( sender: Any, instance: PaymentVerificationPlan, **kwargs: Any ) -> None: - build_summary(instance.payment_plan_obj) + build_summary(instance.payment_plan) class PaymentVerification(TimeStampedUUIDModel, ConcurrencyModel, AdminUrlMixin): @@ -2089,9 +2268,19 @@ class PaymentVerification(TimeStampedUUIDModel, ConcurrencyModel, AdminUrlMixin) on_delete=models.CASCADE, related_name="payment_record_verifications", ) - payment_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) - payment_object_id = UUIDField() + + # TODO TP DROP + payment_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_object_id = UUIDField(null=True) payment_obj = GenericForeignKey("payment_content_type", "payment_object_id") + + payment = models.OneToOneField( + "payment.Payment", + on_delete=models.CASCADE, + related_name="payment_verification", + null=True, + ) + status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING) status_date = models.DateTimeField(null=True) received_amount = models.DecimalField( @@ -2113,13 +2302,6 @@ class Meta: ) ] - @property - def get_payment(self) -> Union[Payment, PaymentRecord, None]: - try: - return self.payment_content_type.model_class().objects.get(pk=self.payment_object_id) - except ObjectDoesNotExist: - return None - @property def is_manually_editable(self) -> bool: if self.payment_verification_plan.verification_channel != PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL: @@ -2129,7 +2311,7 @@ def is_manually_editable(self) -> bool: @property def business_area(self) -> BusinessArea: - return self.payment_verification_plan.payment_plan_obj.business_area + return self.payment_verification_plan.payment_plan.business_area def set_pending(self) -> None: self.status_date = timezone.now() @@ -2151,11 +2333,21 @@ class PaymentVerificationSummary(TimeStampedUUIDModel): ) activation_date = models.DateTimeField(null=True) completion_date = models.DateTimeField(null=True) - payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) - payment_plan_object_id = UUIDField() + + payment_plan = models.OneToOneField( + "payment.PaymentPlan", + on_delete=models.CASCADE, + related_name="payment_verification_summary", + null=True, + ) + + # TODO TP drop + payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_plan_object_id = UUIDField(null=True) payment_plan_obj = GenericForeignKey("payment_plan_content_type", "payment_plan_object_id") class Meta: + # TODO TP DROP indexes = [ models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), ] diff --git a/src/hct_mis_api/apps/payment/mutations.py b/src/hct_mis_api/apps/payment/mutations.py index 0d21fd131d..a286b63b9a 100644 --- a/src/hct_mis_api/apps/payment/mutations.py +++ b/src/hct_mis_api/apps/payment/mutations.py @@ -2,7 +2,7 @@ import logging from datetime import date, datetime from decimal import Decimal -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional from zipfile import BadZipFile from django.db import transaction @@ -42,14 +42,12 @@ UpdatePaymentPlanInput, ) from hct_mis_api.apps.payment.models import ( - CashPlan, DeliveryMechanism, DeliveryMechanismPerPaymentPlan, FinancialServiceProvider, Payment, PaymentPlan, PaymentPlanSplit, - PaymentRecord, PaymentVerification, PaymentVerificationPlan, ) @@ -57,7 +55,6 @@ GenericPaymentPlanNode, PaymentNode, PaymentPlanNode, - PaymentRecordNode, PaymentVerificationNode, ) from hct_mis_api.apps.payment.services.mark_as_failed import ( @@ -111,9 +108,7 @@ class Arguments: @transaction.atomic @raise_program_status_is(Program.FINISHED) def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "CreateVerificationPlanMutation": - payment_plan_object: Union["CashPlan", "PaymentPlan"] = get_payment_plan_object( - input["cash_or_payment_plan_id"] - ) + payment_plan_object: "PaymentPlan" = get_payment_plan_object(input["cash_or_payment_plan_id"]) check_concurrency_version_in_mutation(kwargs.get("version"), payment_plan_object) @@ -158,7 +153,7 @@ def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "EditPaymen payment_verification_plan = VerificationPlanCrudServices.update(payment_verification_plan, input) - payment_verification_plan.payment_plan_obj.refresh_from_db() + payment_verification_plan.payment_plan.refresh_from_db() log_create( PaymentVerificationPlan.ACTIVITY_LOG_MAPPING, "business_area", @@ -167,7 +162,7 @@ def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "EditPaymen old_payment_verification_plan, payment_verification_plan, ) - return cls(payment_plan=payment_verification_plan.payment_plan_obj) + return cls(payment_plan=payment_verification_plan.payment_plan) class ActivatePaymentVerificationPlan(PermissionMutation, ValidationErrorMutationMixin): @@ -200,7 +195,7 @@ def processed_mutate( old_payment_verification_plan, payment_verification_plan, ) - return ActivatePaymentVerificationPlan(payment_plan=payment_verification_plan.payment_plan_obj) + return ActivatePaymentVerificationPlan(payment_plan=payment_verification_plan.payment_plan) class FinishPaymentVerificationPlan(PermissionMutation): @@ -234,7 +229,7 @@ def mutate( old_payment_verification_plan, payment_verification_plan, ) - return FinishPaymentVerificationPlan(payment_plan=payment_verification_plan.payment_plan_obj) + return FinishPaymentVerificationPlan(payment_plan=payment_verification_plan.payment_plan) class DiscardPaymentVerificationPlan(PermissionMutation): @@ -269,7 +264,7 @@ def mutate( old_payment_verification_plan, payment_verification_plan, ) - return cls(payment_plan=payment_verification_plan.payment_plan_obj) + return cls(payment_plan=payment_verification_plan.payment_plan) class InvalidPaymentVerificationPlan(PermissionMutation): @@ -303,7 +298,7 @@ def mutate( old_payment_verification_plan, payment_verification_plan, ) - return cls(payment_plan=payment_verification_plan.payment_plan_obj) + return cls(payment_plan=payment_verification_plan.payment_plan) class DeletePaymentVerificationPlan(PermissionMutation): @@ -321,7 +316,7 @@ def mutate( ) -> "DeletePaymentVerificationPlan": payment_verification_plan_id = decode_id_string(payment_verification_plan_id) payment_verification_plan = get_object_or_404(PaymentVerificationPlan, id=payment_verification_plan_id) - payment_plan = payment_verification_plan.payment_plan_obj + payment_plan = payment_verification_plan.payment_plan program_id = getattr(payment_verification_plan.get_program, "pk", None) check_concurrency_version_in_mutation(kwargs.get("version"), payment_verification_plan) @@ -384,7 +379,7 @@ def mutate( raise GraphQLError( f"You can only update status of payment verification for {PaymentVerificationPlan.STATUS_ACTIVE} cash plan verification" ) - delivered_amount = payment_verification.payment_obj.delivered_quantity + delivered_amount = payment_verification.payment.delivered_quantity if status == PaymentVerification.STATUS_PENDING and received_amount is not None: logger.error( f"Wrong status {PaymentVerification.STATUS_PENDING} when received_amount ({received_amount}) is not empty", @@ -486,7 +481,7 @@ def mutate( ) if not payment_verification.is_manually_editable: log_and_raise("You can only edit payment verification in first 10 minutes") - delivered_amount = payment_verification.payment_obj.delivered_quantity + delivered_amount = payment_verification.payment.delivered_quantity if received is None and received_amount is not None and received_amount == 0: log_and_raise("You can't set received_amount {received_amount} and not set received to NO") @@ -560,7 +555,7 @@ def mutate(cls, root: Any, info: Any, payment_verification_plan_id: str) -> "Exp payment_verification_plan.xlsx_file_exporting = True payment_verification_plan.save() create_payment_verification_plan_xlsx.delay(payment_verification_plan_id, info.context.user.pk) - return cls(payment_plan=payment_verification_plan.payment_plan_obj) + return cls(payment_plan=payment_verification_plan.payment_plan) class ImportXlsxPaymentVerificationPlanFile(PermissionMutation): @@ -596,29 +591,7 @@ def mutate( calculate_counts(payment_verification_plan) payment_verification_plan.xlsx_file_imported = True payment_verification_plan.save() - return ImportXlsxPaymentVerificationPlanFile(payment_verification_plan.payment_plan_obj, import_service.errors) - - -class MarkPaymentRecordAsFailedMutation(PermissionMutation): - payment_record = graphene.Field(PaymentRecordNode) - - class Arguments: - payment_record_id = graphene.ID(required=True) - - @classmethod - @is_authenticated - @transaction.atomic - def mutate( - cls, - root: Any, - info: Any, - payment_record_id: str, - **kwargs: Any, - ) -> "MarkPaymentRecordAsFailedMutation": - payment_record = get_object_or_404(PaymentRecord, id=decode_id_string(payment_record_id)) - cls.has_permission(info, Permissions.PAYMENT_VERIFICATION_MARK_AS_FAILED, payment_record.business_area) - mark_as_failed(payment_record) - return cls(payment_record) + return ImportXlsxPaymentVerificationPlanFile(payment_verification_plan.payment_plan, import_service.errors) class MarkPaymentAsFailedMutation(PermissionMutation): @@ -643,33 +616,6 @@ def mutate( return cls(payment) -class RevertMarkPaymentRecordAsFailedMutation(PermissionMutation): - payment_record = graphene.Field(PaymentRecordNode) - - class Arguments: - payment_record_id = graphene.ID(required=True) - delivered_quantity = graphene.Decimal(required=True) - delivery_date = graphene.Date(required=True) - - @classmethod - @is_authenticated - @transaction.atomic - def mutate( - cls, - root: Any, - info: Any, - payment_record_id: str, - delivered_quantity: Decimal, - delivery_date: date, - **kwargs: Any, - ) -> "RevertMarkPaymentRecordAsFailedMutation": - payment_record = get_object_or_404(PaymentRecord, id=decode_id_string(payment_record_id)) - cls.has_permission(info, Permissions.PAYMENT_VERIFICATION_MARK_AS_FAILED, payment_record.business_area) - delivery_date = datetime.combine(delivery_date, datetime.min.time()) - revert_mark_as_failed(payment_record, delivered_quantity, delivery_date) - return cls(payment_record) - - class RevertMarkPaymentAsFailedMutation(PermissionMutation): payment = graphene.Field(PaymentNode) @@ -727,7 +673,7 @@ def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "ActionPaym mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -776,7 +722,7 @@ def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "CreatePaym mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, new_object=payment_plan, ) return cls(payment_plan=payment_plan) @@ -803,7 +749,7 @@ def mutate(cls, root: Any, info: Any, input: Dict, **kwargs: Any) -> "UpdatePaym mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -832,7 +778,7 @@ def mutate(cls, root: Any, info: Any, payment_plan_id: str, **kwargs: Any) -> "D mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -871,7 +817,7 @@ def mutate( mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -1049,7 +995,7 @@ def mutate( mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -1102,7 +1048,7 @@ def mutate( mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -1152,7 +1098,7 @@ def mutate( mapping=PaymentPlan.ACTIVITY_LOG_MAPPING, business_area_field="business_area", user=info.context.user, - programs=payment_plan.get_program.pk, + programs=payment_plan.program.pk, old_object=old_payment_plan, new_object=payment_plan, ) @@ -1306,8 +1252,6 @@ class Mutations(graphene.ObjectType): invalid_payment_verification_plan = InvalidPaymentVerificationPlan.Field() delete_payment_verification_plan = DeletePaymentVerificationPlan.Field() update_payment_verification_status_and_received_amount = UpdatePaymentVerificationStatusAndReceivedAmount.Field() - mark_payment_record_as_failed = MarkPaymentRecordAsFailedMutation.Field() - revert_mark_payment_record_as_failed = RevertMarkPaymentRecordAsFailedMutation.Field() mark_payment_as_failed = MarkPaymentAsFailedMutation.Field() revert_mark_payment_as_failed = RevertMarkPaymentAsFailedMutation.Field() update_payment_verification_received_and_received_amount = ( diff --git a/src/hct_mis_api/apps/payment/schema.py b/src/hct_mis_api/apps/payment/schema.py index 556220dbda..ade4033e12 100644 --- a/src/hct_mis_api/apps/payment/schema.py +++ b/src/hct_mis_api/apps/payment/schema.py @@ -1,8 +1,7 @@ import json from decimal import Decimal -from typing import Any, Dict, Iterable, List, Optional, Union +from typing import Any, Dict, List, Optional, Union -from django.contrib.postgres.fields import ArrayField from django.db import models from django.db.models import ( Case, @@ -10,7 +9,6 @@ Count, Exists, F, - Func, IntegerField, OuterRef, Q, @@ -45,7 +43,6 @@ get_debit_card_issuer, get_debit_card_number, ) -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.core.schema import ChoiceObject from hct_mis_api.apps.core.services.rapid_pro.api import RapidProAPI from hct_mis_api.apps.core.utils import ( @@ -67,14 +64,13 @@ FinancialServiceProviderXlsxTemplateFilter, PaymentFilter, PaymentPlanFilter, - PaymentRecordFilter, PaymentVerificationFilter, PaymentVerificationLogEntryFilter, PaymentVerificationPlanFilter, - cash_plan_and_payment_plan_filter, - cash_plan_and_payment_plan_ordering, - payment_record_and_payment_filter, - payment_record_and_payment_ordering, + payment_filter, + payment_ordering, + payment_plan_filter, + payment_plan_ordering, ) from hct_mis_api.apps.payment.inputs import ( AvailableFspsForDeliveryMechanismsInput, @@ -84,7 +80,6 @@ from hct_mis_api.apps.payment.models import ( Approval, ApprovalProcess, - CashPlan, DeliveryMechanism, DeliveryMechanismPerPaymentPlan, FinancialServiceProvider, @@ -95,11 +90,9 @@ PaymentPlan, PaymentPlanSplit, PaymentPlanSupportingDocument, - PaymentRecord, PaymentVerification, PaymentVerificationPlan, PaymentVerificationSummary, - ServiceProvider, ) from hct_mis_api.apps.payment.services.dashboard_service import ( payment_verification_chart_query, @@ -113,6 +106,7 @@ get_payment_items_for_dashboard, get_payment_plan_object, ) +from hct_mis_api.apps.program.schema import ProgramNode from hct_mis_api.apps.targeting.graphql_types import TargetPopulationNode from hct_mis_api.apps.targeting.models import TargetPopulation from hct_mis_api.apps.utils.schema import ( @@ -195,13 +189,6 @@ def get_queryset(cls, queryset: QuerySet, info: Any) -> QuerySet: return queryset.all().allowed_to(business_area_slug) -class ServiceProviderNode(DjangoObjectType): - class Meta: - model = ServiceProvider - interfaces = (relay.Node,) - connection_class = ExtendedConnection - - class AgeFilterObject(graphene.ObjectType): min = graphene.Int() max = graphene.Int() @@ -381,8 +368,8 @@ def resolve_target_population(self, info: Any) -> TargetPopulation: def resolve_full_name(self, info: Any) -> str: return self.head_of_household.full_name if self.head_of_household else "" - def resolve_verification(self, info: Any) -> graphene.Field: - return self.verification + def resolve_verification(self, info: Any) -> Optional[Any]: + return getattr(self, "payment_verification", None) def resolve_distribution_modality(self, info: Any) -> str: return self.parent.unicef_id @@ -564,6 +551,7 @@ class PaymentPlanNode(BaseNodePermissionMixin, AdminUrlNodeMixin, DjangoObjectTy dispersion_end_date = graphene.Date() start_date = graphene.Date() end_date = graphene.Date() + currency = graphene.String() currency_name = graphene.String() has_payment_list_export_file = graphene.Boolean() has_fsp_delivery_mechanism_xlsx_template = graphene.Boolean() @@ -573,12 +561,11 @@ class PaymentPlanNode(BaseNodePermissionMixin, AdminUrlNodeMixin, DjangoObjectTy volume_by_delivery_mechanism = graphene.List(VolumeByDeliveryMechanismNode) split_choices = graphene.List(ChoiceObject) verification_plans = DjangoPermissionFilterConnectionField( - "hct_mis_api.apps.program.schema.PaymentVerificationPlanNode", # type: ignore + "hct_mis_api.apps.payment.schema.PaymentVerificationPlanNode", # type: ignore filterset_class=PaymentVerificationPlanFilter, ) payment_verification_summary = graphene.Field( PaymentVerificationSummaryNode, - source="get_payment_verification_summary", ) bank_reconciliation_success = graphene.Int() bank_reconciliation_error = graphene.Int() @@ -594,17 +581,21 @@ class PaymentPlanNode(BaseNodePermissionMixin, AdminUrlNodeMixin, DjangoObjectTy can_send_to_payment_gateway = graphene.Boolean() can_split = graphene.Boolean() supporting_documents = graphene.List(PaymentPlanSupportingDocumentNode) + program = graphene.Field(ProgramNode) class Meta: model = PaymentPlan interfaces = (relay.Node,) connection_class = ExtendedConnection + def resolve_program(self, info: Any) -> ProgramNode: + return self.program_cycle.program + def resolve_split_choices(self, info: Any, **kwargs: Any) -> List[Dict[str, Any]]: return to_choice_object(PaymentPlanSplit.SplitType.choices) def resolve_verification_plans(self, info: Any) -> graphene.List: - return self.get_payment_verification_plans + return self.payment_verification_plans.all() def resolve_payments_conflicts_count(self, info: Any) -> graphene.Int: return self.payment_items.filter(excluded=False, payment_plan_hard_conflicted=True).count() @@ -740,9 +731,6 @@ class Meta: interfaces = (relay.Node,) connection_class = ExtendedConnection - def resolve_payment(self, info: Any) -> graphene.Field: - return self.get_payment - class PaymentVerificationPlanNode(AdminUrlNodeMixin, DjangoObjectType): excluded_admin_areas_filter = graphene.List(graphene.String) @@ -763,17 +751,6 @@ def resolve_has_xlsx_file(self, info: Any) -> bool: return self.has_xlsx_payment_verification_plan_file -class PaymentRecordNode(BaseNodePermissionMixin, AdminUrlNodeMixin, DjangoObjectType): - permission_classes = (hopePermissionClass(Permissions.PROGRAMME_VIEW_PAYMENT_RECORD_DETAILS),) - verification = graphene.Field(PaymentVerificationNode) - unicef_id = graphene.String(source="ca_id") - - class Meta: - model = PaymentRecord - interfaces = (relay.Node,) - connection_class = ExtendedConnection - - class PaymentVerificationLogEntryNode(LogEntryNode): content_object = graphene.Field(PaymentVerificationPlanNode) @@ -795,7 +772,7 @@ class CashPlanAndPaymentPlanNode(BaseNodePermissionMixin, AdminUrlNodeMixin, gra obj_type = graphene.String() id = graphene.String() - unicef_id = graphene.String(source="get_unicef_id") + unicef_id = graphene.String() verification_status = graphene.String() status = graphene.String() currency = graphene.String() @@ -824,7 +801,7 @@ def resolve_total_number_of_households(self, info: Any, **kwargs: Any) -> int: return self.payment_items.count() def resolve_verification_status(self, info: Any, **kwargs: Any) -> Optional[graphene.String]: - return self.get_payment_verification_summary.status if self.get_payment_verification_summary else None + return self.payment_verification_summary.status if self.payment_verification_summary else None def resolve_status(self, info: Any, **kwargs: Any) -> Optional[graphene.String]: return self.status @@ -833,7 +810,7 @@ def resolve_program_name(self, info: Any, **kwargs: Any) -> graphene.String: return self.program.name def resolve_verification_plans(self, info: Any, **kwargs: Any) -> graphene.List: - return self.payment_verification_plan.all() + return self.payment_verification_plans.all() # TODO: do we need this empty fields ?? def resolve_assistance_measurement(self, info: Any, **kwargs: Any) -> str: @@ -863,7 +840,7 @@ class PaymentRecordAndPaymentNode(BaseNodePermissionMixin, graphene.ObjectType): delivered_quantity_usd = graphene.Float(source="delivered_quantity_usd") currency = graphene.String(source="currency") delivery_date = graphene.String(source="delivery_date") - verification = graphene.Field(PaymentVerificationNode, source="verification") + verification = graphene.Field(PaymentVerificationNode) def resolve_obj_type(self, info: Any, **kwargs: Any) -> str: return self.__class__.__name__ @@ -874,6 +851,9 @@ def resolve_id(self, info: Any, **kwargs: Any) -> str: def resolve_status(self, info: Any, **kwargs: Any) -> str: return self.status.replace(" ", "_").upper() + def resolve_verification(self, info: Any, **kwargs: Any) -> Any: + return getattr(self, "payment_verification", None) + class PageInfoNode(graphene.ObjectType): start_cursor = graphene.String() @@ -937,16 +917,11 @@ def resolve_id(self, info: Any, **kwargs: Any) -> graphene.String: def resolve_obj_type(self, info: Any, **kwargs: Any) -> str: return self.__class__.__name__ - def resolve_payment_verification_summary(self, info: Any, **kwargs: Any) -> graphene.Field: - return self.get_payment_verification_summary - def resolve_available_payment_records_count(self, info: Any, **kwargs: Any) -> graphene.Int: - return self.payment_items.filter( - status__in=PaymentRecord.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0 - ).count() + return self.payment_items.filter(status__in=Payment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0).count() def resolve_verification_plans(self, info: Any, **kwargs: Any) -> DjangoPermissionFilterConnectionField: - return self.get_payment_verification_plans + return self.payment_verification_plans.all() def resolve_total_entitled_quantity(self, info: Any, **kwargs: Any) -> graphene.Float: return self.total_entitled_quantity @@ -974,13 +949,6 @@ class Query(graphene.ObjectType): filterset_class=PaymentFilter, permission_classes=(hopePermissionClass(Permissions.PM_VIEW_LIST),), ) - payment_record = relay.Node.Field(PaymentRecordNode) - all_payment_records = DjangoPermissionFilterConnectionField( - PaymentRecordNode, - filterset_class=PaymentRecordFilter, - permission_classes=(hopePermissionClass(Permissions.PROGRAMME_VIEW_LIST_AND_DETAILS),), - ) - all_payment_records_and_payments = graphene.Field( PaginatedPaymentRecordsAndPaymentsNode, business_area=graphene.String(required=True), @@ -1165,8 +1133,7 @@ def get_fsps_for_delivery_mechanism(mechanism_name: str) -> List: ] def resolve_all_payment_verifications(self, info: Any, **kwargs: Any) -> QuerySet: - payment_qs = Payment.objects.filter(id=OuterRef("payment_object_id"), household__withdrawn=True) - payment_record_qs = Payment.objects.filter(id=OuterRef("payment_object_id"), household__withdrawn=True) + payment_qs = Payment.objects.filter(id=OuterRef("payment_id"), household__withdrawn=True) return ( PaymentVerification.objects.filter( @@ -1174,9 +1141,8 @@ def resolve_all_payment_verifications(self, info: Any, **kwargs: Any) -> QuerySe | Q(payment_verification_plan__status=PaymentVerificationPlan.STATUS_FINISHED) ) .annotate( - payment_obj__household__status=Case( + payment__household__status=Case( When(Exists(payment_qs), then=Value(STATUS_INACTIVE)), - When(Exists(payment_record_qs), then=Value(STATUS_INACTIVE)), default=Value(STATUS_ACTIVE), output_field=CharField(), ), @@ -1185,12 +1151,10 @@ def resolve_all_payment_verifications(self, info: Any, **kwargs: Any) -> QuerySe ) def resolve_sample_size(self, info: Any, input: Dict, **kwargs: Any) -> Dict[str, int]: - payment_plan_object: Union["CashPlan", "PaymentPlan"] = get_payment_plan_object( - input["cash_or_payment_plan_id"] - ) + payment_plan_object: "PaymentPlan" = get_payment_plan_object(input["cash_or_payment_plan_id"]) def get_payment_records( - obj: Union["PaymentPlan", "CashPlan"], + obj: PaymentPlan, payment_verification_plan: Optional[PaymentVerificationPlan], verification_channel: str, ) -> QuerySet: @@ -1227,10 +1191,10 @@ def resolve_all_rapid_pro_flows(self, info: Any, business_area_slug: str, **kwar return api.get_flows() def resolve_payment_record_status_choices(self, info: Any, **kwargs: Any) -> List[Dict[str, Any]]: - return to_choice_object(PaymentRecord.STATUS_CHOICE) + return to_choice_object(Payment.STATUS_CHOICE) def resolve_payment_record_entitlement_card_status_choices(self, info: Any, **kwargs: Any) -> List[Dict[str, Any]]: - return to_choice_object(PaymentRecord.ENTITLEMENT_CARD_STATUS_CHOICE) + return to_choice_object(Payment.ENTITLEMENT_CARD_STATUS_CHOICE) def resolve_payment_record_delivery_type_choices(self, info: Any, **kwargs: Any) -> List[Dict[str, Any]]: return to_choice_object(DeliveryMechanism.get_choices()) @@ -1305,19 +1269,15 @@ def resolve_chart_volume_by_delivery_mechanism( payment_items_qs.values("delivery_type") .order_by("delivery_type") .annotate(volume=Sum("delivered_quantity_usd")) - .merge_by( - "delivery_type", - aggregated_fields=["volume"], - ) ) labels = [] data = [] for volume_dict in volume_by_delivery_type: - if volume_dict.get("volume"): + if volume_value := volume_dict.get("volume", None): dm = DeliveryMechanism.objects.get(id=volume_dict.get("delivery_type")) labels.append(dm.name) - data.append(volume_dict.get("volume")) + data.append(volume_value) return {"labels": labels, "datasets": [{"data": data}]} @@ -1426,7 +1386,7 @@ def resolve_table_total_cash_transferred_by_administrative_area_for_people( def resolve_chart_total_transferred_cash_by_country(self, info: Any, year: int, **kwargs: Any) -> Dict[str, Any]: payment_items_qs: QuerySet = get_payment_items_for_dashboard(year, "global", {}, True) - countries_and_amounts: dict = ( + countries_and_amounts = ( payment_items_qs.select_related("business_area") .values("business_area") .order_by("business_area") @@ -1442,17 +1402,16 @@ def resolve_chart_total_transferred_cash_by_country(self, info: Any, year: int, business_area_name=F("business_area__name"), ) .order_by("business_area_name") - .merge_by("business_area_name", aggregated_fields=["total_delivered_cash", "total_delivered_voucher"]) ) labels = [] cash_transferred = [] voucher_transferred = [] total_transferred = [] - for data_dict in countries_and_amounts: - labels.append(data_dict.get("business_area_name")) - cash_transferred.append(data_dict.get("total_delivered_cash") or 0) - voucher_transferred.append(data_dict.get("total_delivered_voucher") or 0) + for item_dict in countries_and_amounts: + labels.append(item_dict.get("business_area_name")) + cash_transferred.append(item_dict.get("total_delivered_cash", 0)) + voucher_transferred.append(item_dict.get("total_delivered_voucher", 0)) total_transferred.append(cash_transferred[-1] + voucher_transferred[-1]) datasets = [ @@ -1473,16 +1432,13 @@ def resolve_payment_plan_background_action_status_choices(self, info: Any, **kwa return to_choice_object(PaymentPlan.BackgroundActionStatus.choices) def resolve_all_cash_plans_and_payment_plans(self, info: Any, **kwargs: Any) -> Dict[str, Any]: - service_provider_qs = ServiceProvider.objects.filter(cash_plans=OuterRef("pk")).distinct() fsp_qs = FinancialServiceProvider.objects.filter( delivery_mechanisms_per_payment_plan__payment_plan=OuterRef("pk") ).distinct() delivery_mechanisms_per_pp_qs = DeliveryMechanismPerPaymentPlan.objects.filter( payment_plan=OuterRef("pk") ).distinct("delivery_mechanism") - payment_verification_summary_qs = PaymentVerificationSummary.objects.filter( - payment_plan_object_id=OuterRef("id") - ) + payment_verification_summary_qs = PaymentVerificationSummary.objects.filter(payment_plan_id=OuterRef("id")) if "is_payment_verification_page" in kwargs and kwargs.get("is_payment_verification_page"): payment_plan_qs = PaymentPlan.objects.filter(status=PaymentPlan.Status.FINISHED) @@ -1496,88 +1452,73 @@ def resolve_all_cash_plans_and_payment_plans(self, info: Any, **kwargs: Any) -> ), currency_order=F("currency"), ) - cash_plan_qs = CashPlan.objects.all().annotate( - unicef_id=F("ca_id"), - fsp_names=ArraySubquery(service_provider_qs.values_list("full_name", flat=True)), - delivery_types=Func( - [], - F("delivery_type"), - function="array_append", - output_field=ArrayField(CharField(null=True)), - ), - currency_order=PaymentRecord.objects.filter(parent_id=OuterRef("id")).values("currency")[:1], - ) - qs = ( - ExtendedQuerySetSequence(payment_plan_qs, cash_plan_qs) - .annotate( - custom_order=Case( - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_ACTIVE)), - then=Value(1), - ), - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_PENDING)), - then=Value(2), - ), - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_FINISHED)), - then=Value(3), - ), - output_field=IntegerField(), - default=Value(0), - ), - total_number_of_households=Count("payment_items"), - total_entitled_quantity_order=Coalesce( - "total_entitled_quantity", 0, output_field=models.DecimalField() + qs = payment_plan_qs.annotate( + custom_order=Case( + When( + Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_ACTIVE)), + then=Value(1), ), - total_delivered_quantity_order=Coalesce( - "total_delivered_quantity", 0, output_field=models.DecimalField() + When( + Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_PENDING)), + then=Value(2), ), - total_undelivered_quantity_order=Coalesce( - "total_undelivered_quantity", 0, output_field=models.DecimalField() + When( + Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_FINISHED)), + then=Value(3), ), - ) - .order_by("-updated_at", "custom_order") - ) + output_field=IntegerField(), + default=Value(0), + ), + total_number_of_households=Count("payment_items"), + total_entitled_quantity_order=Coalesce("total_entitled_quantity", 0, output_field=models.DecimalField()), + total_delivered_quantity_order=Coalesce("total_delivered_quantity", 0, output_field=models.DecimalField()), + total_undelivered_quantity_order=Coalesce( + "total_undelivered_quantity", 0, output_field=models.DecimalField() + ), + ).order_by("-updated_at", "custom_order") # filtering - qs: Iterable = cash_plan_and_payment_plan_filter(qs, **kwargs) # type: ignore + qs = payment_plan_filter(qs, **kwargs) # ordering if order_by_value := kwargs.get("order_by"): - qs = cash_plan_and_payment_plan_ordering(qs, order_by_value) + qs = payment_plan_ordering(qs, order_by_value) + + qs_list = list(qs) + count = len(qs) # add qraphql pagination resp = connection_from_list_slice( - qs, + qs_list, args=kwargs, connection_type=PaginatedCashPlanAndPaymentPlanNode, edge_type=CashPlanAndPaymentPlanEdges, pageinfo_type=PageInfoNode, - list_length=len(qs), + list_length=count, ) - resp.total_count = len(qs) + resp.total_count = count return resp def resolve_all_payment_records_and_payments(self, info: Any, **kwargs: Any) -> Dict[str, Any]: """used in Household Page > Payment Records""" - qs = ExtendedQuerySetSequence( - PaymentRecord.objects.all(), Payment.objects.eligible().exclude(parent__is_removed=True) - ).order_by("-updated_at") + qs = Payment.objects.eligible().exclude(parent__is_removed=True).order_by("-updated_at") - qs: Iterable = payment_record_and_payment_filter(qs, **kwargs) # type: ignore + qs = payment_filter(qs, **kwargs) if order_by_value := kwargs.get("order_by"): - qs = payment_record_and_payment_ordering(qs, order_by_value) + qs = payment_ordering(qs, order_by_value) + + qs_list = list(qs) + count = len(qs) resp = connection_from_list_slice( - qs, + qs_list, args=kwargs, connection_type=PaginatedPaymentRecordsAndPaymentsNode, edge_type=PaymentRecordsAndPaymentsEdges, pageinfo_type=PageInfoNode, - list_length=len(qs), + list_length=count, ) - resp.total_count = len(qs) + resp.total_count = count return resp diff --git a/src/hct_mis_api/apps/payment/services/create_cash_plan_from_reconciliation.py b/src/hct_mis_api/apps/payment/services/create_cash_plan_from_reconciliation.py deleted file mode 100644 index 4a8cd53bc4..0000000000 --- a/src/hct_mis_api/apps/payment/services/create_cash_plan_from_reconciliation.py +++ /dev/null @@ -1,212 +0,0 @@ -import logging -import uuid -from datetime import datetime -from io import BytesIO -from typing import TYPE_CHECKING, Dict, List, Optional, Union - -from django.db import transaction - -import openpyxl - -from hct_mis_api.apps.core.exchange_rates import ExchangeRates -from hct_mis_api.apps.core.exchange_rates.utils import ( - calculate_delivery_quantity_in_usd, -) -from hct_mis_api.apps.core.models import BusinessArea, StorageFile -from hct_mis_api.apps.core.utils import clear_cache_for_dashboard_totals -from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.celery_tasks import create_cash_plan_reconciliation_xlsx -from hct_mis_api.apps.payment.models import ( - CashPlan, - PaymentRecord, - PaymentVerificationSummary, -) -from hct_mis_api.apps.targeting.models import TargetPopulation - -if TYPE_CHECKING: - from django.contrib.auth.models import AbstractBaseUser, AnonymousUser - - from hct_mis_api.apps.account.models import User - -logger = logging.getLogger(__name__) - -ValidationError = Exception - - -class CreateCashPlanReconciliationService: - text_template = "admin/payment/payment_record/import_payment_records_email.txt" - html_template = "admin/payment/payment_record/import_payment_records_email.html" - - COLUMN_PAYMENT_ID = "PAYMENT_ID" - COLUMN_PAYMENT_STATUS = "PAYMENT_STATUS" - COLUMN_DELIVERED_AMOUNT = "DELIVERED_AMOUNT" - COLUMN_ENTITLEMENT_QUANTITY = "ENTITLEMENT_QUANTITY" - ALL_COLUMNS = ( - COLUMN_PAYMENT_ID, - COLUMN_PAYMENT_STATUS, - COLUMN_DELIVERED_AMOUNT, - COLUMN_ENTITLEMENT_QUANTITY, - ) - - def __init__( - self, - business_area: BusinessArea, - reconciliation_xlsx_file: BytesIO, - column_mapping: Dict, - cash_plan_form_data: Dict, - currency: str, - delivery_type: str, - delivery_date: str, - ) -> None: - self.business_area = business_area - self.reconciliation_xlsx_file = reconciliation_xlsx_file - self.column_mapping = column_mapping - self.currency = currency - self.delivery_type = delivery_type - self.column_index_mapping = {} - self.cash_plan_form_data = cash_plan_form_data - self.delivery_date = delivery_date - self.total_person_covered = 0 - self.total_delivered_amount = 0 - self.total_entitlement_amount = 0 - - @transaction.atomic - def parse_xlsx(self) -> None: - wb = openpyxl.load_workbook(self.reconciliation_xlsx_file) - ws = wb.active - rows = ws.rows - next(rows) - header = [cell.value for cell in next(rows)] - self._parse_header(header) - self.cash_plan = self._create_cash_plan() - print(ws.max_row) - for index, row in enumerate(rows): - row_values = [cell.value for cell in row] - if all([value is None for value in row_values]): - break - self._parse_row(row_values, index) - self._add_cashplan_info() - self._update_exchange_rates() - # clear cached total numbers for dashboard statistics - clear_cache_for_dashboard_totals() - - def _parse_header(self, header: List) -> None: - for column, xlsx_column in self.column_mapping.items(): - if xlsx_column not in header: - raise ValidationError(f"Column {xlsx_column} not found in the header") - if column not in self.ALL_COLUMNS: - raise ValidationError(f"Column {column} is not a valid column") - - self.column_index_mapping[column] = header.index(xlsx_column) - - def _parse_row(self, row: List, index: int) -> None: - self.total_person_covered += 1 - delivered_amount = row[self.column_index_mapping[self.COLUMN_DELIVERED_AMOUNT]] - entitlement_amount = row[self.column_index_mapping[self.COLUMN_ENTITLEMENT_QUANTITY]] - status = ( - PaymentRecord.STATUS_SUCCESS - if row[self.column_index_mapping[self.COLUMN_PAYMENT_STATUS]] == 1 - else PaymentRecord.STATUS_ERROR - ) - payment_id = row[self.column_index_mapping[self.COLUMN_PAYMENT_ID]] - target_population_id, household_id = payment_id.split(" - ") - household = Household.objects.get(id=household_id) - target_population = TargetPopulation.objects.get(id=target_population_id) - currency = self.currency - self.total_delivered_amount += delivered_amount - self.total_entitlement_amount += entitlement_amount - - payment_record_id = self.cash_plan.ca_id + "-" + str(index + 1).zfill(7) - payment_record = PaymentRecord.objects.create( - business_area=self.business_area, - status=status, - ca_id=payment_record_id, - ca_hash_id=uuid.uuid4(), - cash_plan=self.cash_plan, - household=household, - head_of_household=household.primary_collector, - full_name=household.primary_collector.full_name, - total_persons_covered=household.size, - target_population=target_population, - target_population_cash_assist_id="", - currency=currency, - entitlement_quantity=entitlement_amount, - delivered_quantity=delivered_amount, - service_provider=self.cash_plan.service_provider, - status_date=self.cash_plan.status_date, - delivery_type=self.delivery_type, - delivery_date=self.delivery_date, - ) - payment_record.save() - - def _create_cash_plan(self) -> CashPlan: - current_year = str(datetime.now().year)[-2:] - last_cash_plan = ( - CashPlan.objects.filter(business_area=self.business_area, ca_id__startswith=f"HOPE-CSH-{current_year}-") - .order_by("-ca_id") - .first() - ) - last_cash_plan_index = int(last_cash_plan.ca_id.split("-")[-1]) if last_cash_plan else 0 - new_cash_plan_index_with_padding = str(last_cash_plan_index + 1).zfill(6) - return CashPlan.objects.create( - **self.cash_plan_form_data, - business_area=self.business_area, - ca_id=f"HOPE-CSH-{current_year}-{new_cash_plan_index_with_padding}", - ca_hash_id=uuid.uuid4(), - total_persons_covered=0, - total_persons_covered_revised=0, - ) - - def _add_cashplan_info(self) -> None: - self.cash_plan.total_persons_covered = self.total_person_covered - self.cash_plan.total_persons_covered_revised = self.total_person_covered - self.cash_plan.total_entitled_quantity = self.total_entitlement_amount - self.cash_plan.total_delivered_quantity = self.total_delivered_amount - PaymentVerificationSummary.objects.create( - payment_plan_obj=self.cash_plan - ) # previously CashPlanPaymentVerificationSummary - self.cash_plan.save() - - def _update_exchange_rates(self) -> None: - exchange_rates_client = ExchangeRates() - payment_records_qs = PaymentRecord.objects.filter(cash_plan=self.cash_plan) - for payment_record in payment_records_qs: - calculate_delivery_quantity_in_usd(exchange_rates_client, payment_record) - - PaymentRecord.objects.bulk_update(payment_records_qs, ["delivered_quantity_usd"], 1000) - - def create_celery_task(self, user: Union["AbstractBaseUser", "AnonymousUser"]) -> None: - reconciliation_xlsx_file = StorageFile.objects.create( - created_by=user, - business_area=self.business_area, - file=self.reconciliation_xlsx_file, - ) - program_id = self.cash_plan_form_data.pop("program").pk - service_provider_id = self.cash_plan_form_data.pop("service_provider").pk - - create_cash_plan_reconciliation_xlsx.delay( - str(reconciliation_xlsx_file.pk), - self.column_mapping, - self.cash_plan_form_data, - self.currency, - self.delivery_type.name, - str(self.delivery_date), - str(program_id), - str(service_provider_id), - ) - - def get_email_context(self, user: "User", file_name: str, error_msg: Optional[str] = None) -> Dict: - msg = "Celery task Importing Payment Records finished." - - if error_msg: - msg = msg + f"\n{error_msg}" - else: - msg = msg + f"\nCashPlan ID: {self.cash_plan.ca_id}. File name: {file_name}" - context = { - "first_name": user.first_name, - "last_name": user.last_name, - "email": user.email, - "message": msg, - "title": "Importing Payment Records finished", - } - return context diff --git a/src/hct_mis_api/apps/payment/services/create_payment_verifications.py b/src/hct_mis_api/apps/payment/services/create_payment_verifications.py index ccb0099396..32c597ff56 100644 --- a/src/hct_mis_api/apps/payment/services/create_payment_verifications.py +++ b/src/hct_mis_api/apps/payment/services/create_payment_verifications.py @@ -22,7 +22,7 @@ def create(self) -> None: payment_record_verification = PaymentVerification( status_date=timezone.now(), payment_verification_plan=self.payment_verification_plan, - payment_obj=payment_record, + payment=payment_record, received_amount=None, ) payment_record_verifications_to_create.append(payment_record_verification) diff --git a/src/hct_mis_api/apps/payment/services/dashboard_service.py b/src/hct_mis_api/apps/payment/services/dashboard_service.py index b6f3a0f845..6fc194460c 100644 --- a/src/hct_mis_api/apps/payment/services/dashboard_service.py +++ b/src/hct_mis_api/apps/payment/services/dashboard_service.py @@ -6,11 +6,8 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.models import PaymentRecord, PaymentVerification -from hct_mis_api.apps.payment.utils import ( - get_payment_items_for_dashboard, - get_payment_items_sequence_qs, -) +from hct_mis_api.apps.payment.models import Payment, PaymentVerification +from hct_mis_api.apps.payment.utils import get_payment_items_for_dashboard class PaymentVerificationChartQueryResponse(TypedDict): @@ -39,7 +36,9 @@ def payment_verification_chart_query( ) if program: - params &= Q(Q(payment__parent__program__id=program) | Q(payment_record__parent__program__id=program)) + params &= Q( + Q(payment__parent__program_cycle__program__id=program) | Q(payment_record__parent__program__id=program) + ) if administrative_area: inner_params = Q() @@ -74,13 +73,13 @@ def payment_verification_chart_query( "payments_count" ] all_payment_records_for_created_verifications = ( - get_payment_items_sequence_qs() + Payment.objects.filter(excluded=False, conflicted=False) .filter( - parent__in=payment_verifications.distinct("payment_verification_plan__payment_plan_object_id").values_list( - "payment_verification_plan__payment_plan_object_id", flat=True + parent__in=payment_verifications.distinct("payment_verification_plan__payment_plan_id").values_list( + "payment_verification_plan__payment_plan_id", flat=True ) ) - .filter(status=PaymentRecord.STATUS_SUCCESS, delivered_quantity__gt=0) + .filter(status=Payment.STATUS_SUCCESS, delivered_quantity__gt=0) .filter(household__collect_type=collect_type) .count() ) diff --git a/src/hct_mis_api/apps/payment/services/handle_total_cash_in_households.py b/src/hct_mis_api/apps/payment/services/handle_total_cash_in_households.py index 89ce8854f4..2899fa1a33 100644 --- a/src/hct_mis_api/apps/payment/services/handle_total_cash_in_households.py +++ b/src/hct_mis_api/apps/payment/services/handle_total_cash_in_households.py @@ -5,22 +5,10 @@ from django.db.models.functions import Coalesce from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.models import Payment, PaymentRecord +from hct_mis_api.apps.payment.models import Payment def handle_total_cash_in_specific_households(id_list: List[UUID]) -> None: - total_cash_received_payment_record_subquery = Subquery( - PaymentRecord.objects.filter(household__pk=OuterRef("pk")) - .values("household__pk") - .annotate(sum_delivered_quantity=Sum("delivered_quantity")) - .values("sum_delivered_quantity")[:1] - ) - total_cash_received_usd_payment_record_subquery = Subquery( - PaymentRecord.objects.filter(household__pk=OuterRef("pk")) - .values("household__pk") - .annotate(sum_delivered_quantity_usd=Sum("delivered_quantity_usd")) - .values("sum_delivered_quantity_usd")[:1] - ) total_cash_received_payment_subquery = Subquery( Payment.objects.filter(status__in=Payment.ALLOW_CREATE_VERIFICATION, household__pk=OuterRef("pk")) .values("household__pk") @@ -34,12 +22,9 @@ def handle_total_cash_in_specific_households(id_list: List[UUID]) -> None: .values("sum_delivered_quantity_usd")[:1] ) Household.objects.filter(id__in=id_list).annotate( - total_cash_received_from_payment_records=Coalesce(total_cash_received_payment_record_subquery, 0), total_cash_received_from_payments=Coalesce(total_cash_received_payment_subquery, 0), - total_cash_received_from_payment_records_usd=Coalesce(total_cash_received_usd_payment_record_subquery, 0), total_cash_received_from_payments_usd=Coalesce(total_cash_received_usd_payment_subquery, 0), ).update( - total_cash_received=F("total_cash_received_from_payment_records") + F("total_cash_received_from_payments"), - total_cash_received_usd=F("total_cash_received_from_payment_records_usd") - + F("total_cash_received_from_payments_usd"), + total_cash_received=F("total_cash_received_from_payments"), + total_cash_received_usd=F("total_cash_received_from_payments_usd"), ) diff --git a/src/hct_mis_api/apps/payment/services/mark_as_failed.py b/src/hct_mis_api/apps/payment/services/mark_as_failed.py index b8a54a47fa..6bd43600d6 100644 --- a/src/hct_mis_api/apps/payment/services/mark_as_failed.py +++ b/src/hct_mis_api/apps/payment/services/mark_as_failed.py @@ -4,7 +4,6 @@ from django.db.models import Sum -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.payment.models import Payment, PaymentRecord from hct_mis_api.apps.payment.utils import get_quantity_in_usd @@ -35,8 +34,7 @@ def revert_mark_as_failed( def recalculate_cash_received(household: "Household") -> None: - payment_items = ExtendedQuerySetSequence(household.paymentrecord_set.all(), household.payment_set.eligible()) - aggregated_delivered_quantity = payment_items.aggregate( + aggregated_delivered_quantity = household.payment_set.eligible().aggregate( total_cash_received=Sum("delivered_quantity"), total_cash_received_usd=Sum("delivered_quantity_usd"), ) diff --git a/src/hct_mis_api/apps/payment/services/payment_plan_services.py b/src/hct_mis_api/apps/payment/services/payment_plan_services.py index 7a51cbacad..65abde9c32 100644 --- a/src/hct_mis_api/apps/payment/services/payment_plan_services.py +++ b/src/hct_mis_api/apps/payment/services/payment_plan_services.py @@ -333,7 +333,7 @@ def create_payments(payment_plan: PaymentPlan) -> None: payments_to_create.append( Payment( parent=payment_plan, - program_id=payment_plan.program_id, + program_id=payment_plan.program_cycle.program_id, business_area_id=payment_plan.business_area_id, status=Payment.STATUS_PENDING, status_date=timezone.now(), @@ -395,7 +395,6 @@ def create(input_data: Dict, user: "User") -> PaymentPlan: business_area=business_area, created_by=user, target_population=target_population, - program=target_population.program, program_cycle=program_cycle, name=target_population.name, currency=input_data["currency"], @@ -443,7 +442,6 @@ def update(self, input_data: Dict) -> PaymentPlan: self.payment_plan.target_population.save() self.payment_plan.target_population = new_target_population - self.payment_plan.program = new_target_population.program self.payment_plan.program_cycle = new_target_population.program_cycle self.payment_plan.target_population.status = TargetPopulation.STATUS_ASSIGNED self.payment_plan.target_population.save() @@ -619,7 +617,7 @@ def create_follow_up_payments(self) -> None: Payment( parent=self.payment_plan, source_payment=payment, - program_id=self.payment_plan.program_id, + program_id=self.payment_plan.program_cycle.program_id, is_follow_up=True, business_area_id=payment.business_area_id, status=Payment.STATUS_PENDING, @@ -650,6 +648,7 @@ def create_follow_up( raise GraphQLError("Cannot create a follow-up for a payment plan with no unsuccessful payments") follow_up_pp = PaymentPlan.objects.create( + name=source_pp.name, status=PaymentPlan.Status.PREPARING, status_date=timezone.now(), is_follow_up=True, @@ -657,7 +656,6 @@ def create_follow_up( business_area=source_pp.business_area, created_by=user, target_population=source_pp.target_population, - program=source_pp.program, program_cycle=source_pp.program_cycle, currency=source_pp.currency, dispersion_start_date=dispersion_start_date, diff --git a/src/hct_mis_api/apps/payment/services/sampling.py b/src/hct_mis_api/apps/payment/services/sampling.py index 66fd583981..bb3dbf68a8 100644 --- a/src/hct_mis_api/apps/payment/services/sampling.py +++ b/src/hct_mis_api/apps/payment/services/sampling.py @@ -1,5 +1,5 @@ import abc -from typing import TYPE_CHECKING, Any, Dict, Tuple, Union +from typing import TYPE_CHECKING, Any, Dict, Tuple from django.db.models import Q, QuerySet @@ -11,16 +11,14 @@ from hct_mis_api.apps.payment.utils import get_number_of_samples if TYPE_CHECKING: - from hct_mis_api.apps.payment.models import CashPlan, PaymentPlan, PaymentRecord + from hct_mis_api.apps.payment.models import Payment, PaymentPlan class Sampling: - def __init__( - self, input_data: Dict, payment_plan: Union["CashPlan", "PaymentPlan"], payment_records: QuerySet - ) -> None: + def __init__(self, input_data: Dict, payment_plan: "PaymentPlan", payment_records: QuerySet["Payment"]) -> None: self.input_data = input_data self.payment_plan = payment_plan - self.payment_records: QuerySet = payment_records + self.payment_records = payment_records def process_sampling( self, payment_verification_plan: PaymentVerificationPlan @@ -83,12 +81,12 @@ def calc_sample_size(self, sample_count: int) -> int: return get_number_of_samples(sample_count, self.confidence_interval, self.margin_of_error) @abc.abstractmethod - def sampling(self, payment_records: QuerySet["PaymentRecord"]) -> None: + def sampling(self, payment_records: QuerySet["Payment"]) -> None: pass class RandomSampling(BaseSampling): - def sampling(self, payment_records: QuerySet["PaymentRecord"]) -> None: + def sampling(self, payment_records: QuerySet["Payment"]) -> None: if self.sex is not None: payment_records = payment_records.filter(household__head_of_household__sex=self.sex) @@ -107,7 +105,7 @@ def sampling(self, payment_records: QuerySet["PaymentRecord"]) -> None: class FullListSampling(BaseSampling): - def sampling(self, payment_records: QuerySet["PaymentRecord"]) -> None: + def sampling(self, payment_records: QuerySet["Payment"]) -> None: self.payment_records = payment_records.filter( ~(Q(household__admin_area__id__in=self.excluded_admin_areas_decoded)) ) diff --git a/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py b/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py index 8d93c2849c..c55019ef2a 100644 --- a/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py +++ b/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py @@ -1,6 +1,5 @@ -from typing import TYPE_CHECKING, Any, Dict, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, Optional -from django.contrib.admin.options import get_content_type_for_model from django.db.models import QuerySet from graphql import GraphQLError @@ -19,12 +18,10 @@ ) if TYPE_CHECKING: - from hct_mis_api.apps.payment.models import CashPlan, PaymentPlan + from hct_mis_api.apps.payment.models import PaymentPlan -def get_payment_records( - payment_plan: Union["PaymentPlan", "CashPlan"], verification_channel: Optional[Any] -) -> QuerySet: +def get_payment_records(payment_plan: "PaymentPlan", verification_channel: Optional[Any]) -> QuerySet: if verification_channel == PaymentVerificationPlan.VERIFICATION_CHANNEL_RAPIDPRO: return payment_plan.available_payment_records(extra_validation=does_payment_record_have_right_hoh_phone_number) return payment_plan.available_payment_records() @@ -32,14 +29,13 @@ def get_payment_records( class VerificationPlanCrudServices: @classmethod - def create(cls, payment_plan: Union["PaymentPlan", "CashPlan"], input_data: Dict) -> PaymentVerificationPlan: + def create(cls, payment_plan: "PaymentPlan", input_data: Dict) -> PaymentVerificationPlan: verifier = PaymentVerificationArgumentVerifier(input_data) verifier.verify("sampling") verifier.verify("verification_channel") payment_verification_plan = PaymentVerificationPlan() - payment_verification_plan.payment_plan_content_type = get_content_type_for_model(payment_plan) - payment_verification_plan.payment_plan_object_id = payment_plan.pk + payment_verification_plan.payment_plan = payment_plan payment_verification_plan.verification_channel = input_data.get("verification_channel") @@ -63,9 +59,9 @@ def update(cls, payment_verification_plan: PaymentVerificationPlan, input_data: raise GraphQLError("You can only edit PENDING Cash/Payment Plan Verification") payment_records = get_payment_records( - payment_verification_plan.payment_plan_obj, payment_verification_plan.verification_channel + payment_verification_plan.payment_plan, payment_verification_plan.verification_channel ) - sampling = Sampling(input_data, payment_verification_plan.payment_plan_obj, payment_records) + sampling = Sampling(input_data, payment_verification_plan.payment_plan, payment_records) pv_plan, payment_records_qs = sampling.process_sampling(payment_verification_plan) ProcessVerification(input_data, pv_plan).process() pv_plan.save() diff --git a/src/hct_mis_api/apps/payment/services/verification_plan_status_change_services.py b/src/hct_mis_api/apps/payment/services/verification_plan_status_change_services.py index 857d1868de..f479d5ea92 100644 --- a/src/hct_mis_api/apps/payment/services/verification_plan_status_change_services.py +++ b/src/hct_mis_api/apps/payment/services/verification_plan_status_change_services.py @@ -91,7 +91,7 @@ def _activate_rapidpro(self) -> None: api = RapidProAPI(business_area_slug, RapidProAPI.MODE_VERIFICATION) hoh_ids = [ - pv.payment_obj.household.head_of_household.pk + pv.payment.household.head_of_household.pk for pv in self.payment_verification_plan.payment_record_verifications.filter(sent_to_rapid_pro=False) ] individuals = Individual.objects.filter(pk__in=hoh_ids) @@ -107,7 +107,7 @@ def _activate_rapidpro(self) -> None: payment_verifications_to_upd = [] for pv in self.payment_verification_plan.payment_record_verifications.all(): - if pv.payment_obj.head_of_household in processed_individuals: + if pv.payment.head_of_household in processed_individuals: pv.sent_to_rapid_pro = True payment_verifications_to_upd.append(pv) PaymentVerification.objects.bulk_update(payment_verifications_to_upd, ("sent_to_rapid_pro",), 1000) @@ -137,7 +137,7 @@ def _create_grievance_ticket_for_status( if verifications.count() == 0: return - business_area = payment_verification_plan.payment_plan_obj.business_area + business_area = payment_verification_plan.payment_plan.business_area grievance_ticket_list = [] tickets_programs = [] GrievanceTicketProgramThrough = GrievanceTicket.programs.through @@ -145,12 +145,12 @@ def _create_grievance_ticket_for_status( grievance_ticket = GrievanceTicket( category=GrievanceTicket.CATEGORY_PAYMENT_VERIFICATION, business_area=business_area, - household_unicef_id=verification.payment_obj.household.unicef_id, - admin2_id=verification.payment_obj.household.admin2_id, + household_unicef_id=verification.payment.household.unicef_id, + admin2_id=verification.payment.household.admin2_id, ) grievance_ticket_list.append(grievance_ticket) # get program from parent GenericPaymentPlan.program - program = verification.payment_obj.parent.program + program = verification.payment.parent.program tickets_programs.append( GrievanceTicketProgramThrough(grievanceticket=grievance_ticket, program_id=program.id) diff --git a/src/hct_mis_api/apps/payment/tasks/CheckRapidProVerificationTask.py b/src/hct_mis_api/apps/payment/tasks/CheckRapidProVerificationTask.py index 7f6c11cb0e..a30ce0df0e 100644 --- a/src/hct_mis_api/apps/payment/tasks/CheckRapidProVerificationTask.py +++ b/src/hct_mis_api/apps/payment/tasks/CheckRapidProVerificationTask.py @@ -35,13 +35,13 @@ def execute(self) -> None: def _verify_cashplan_payment_verification(self, payment_verification_plan: PaymentVerificationPlan) -> None: payment_record_verifications = payment_verification_plan.payment_record_verifications.prefetch_related( - "payment_obj__head_of_household" + "payment__head_of_household" ) - business_area = payment_verification_plan.payment_plan_obj.business_area + business_area = payment_verification_plan.payment_plan.business_area payment_record_verifications_phone_number_dict = { - str(payment_verification.payment_obj.head_of_household.phone_no): payment_verification + str(payment_verification.payment.head_of_household.phone_no): payment_verification for payment_verification in payment_record_verifications - if payment_verification.payment_obj.head_of_household is not None + if payment_verification.payment.head_of_household is not None } api = RapidProAPI(business_area.slug, RapidProAPI.MODE_VERIFICATION) rapid_pro_results = api.get_mapped_flow_runs(payment_verification_plan.rapid_pro_flow_start_uuids) @@ -73,7 +73,7 @@ def _rapid_pro_results_to_payment_record_verification( payment_record_verification = payment_record_verifications_phone_number_dict.get(phone_number) if not payment_record_verification: return None - delivered_amount = payment_record_verification.payment_obj.delivered_quantity + delivered_amount = payment_record_verification.payment.delivered_quantity payment_record_verification.status = from_received_to_status(received, received_amount, delivered_amount) payment_record_verification.received_amount = received_amount return payment_record_verification diff --git a/src/hct_mis_api/apps/payment/utils.py b/src/hct_mis_api/apps/payment/utils.py index 5f6145742b..decdd20931 100644 --- a/src/hct_mis_api/apps/payment/utils.py +++ b/src/hct_mis_api/apps/payment/utils.py @@ -9,13 +9,10 @@ from django.shortcuts import get_object_or_404 from hct_mis_api.apps.core.exchange_rates import ExchangeRates -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.core.utils import chart_create_filter_query, chart_get_filtered_qs from hct_mis_api.apps.payment.models import ( - CashPlan, Payment, PaymentPlan, - PaymentRecord, PaymentVerification, PaymentVerificationPlan, ) @@ -103,14 +100,14 @@ def get_payment_items_for_dashboard( if only_with_delivered_quantity: additional_filters["delivered_quantity_usd__gt"] = 0 return chart_get_filtered_qs( - get_payment_items_sequence_qs(), + Payment.objects.filter(excluded=False, conflicted=False), year, business_area_slug_filter={"business_area__slug": business_area_slug}, additional_filters={ **additional_filters, **chart_create_filter_query( filters, - program_id_path="parent__program__id", + program_id_path="parent__program_cycle__program__id", administrative_area_path="household__admin_area", ), }, @@ -143,30 +140,9 @@ def get_quantity_in_usd( return Decimal(amount / Decimal(exchange_rate)).quantize(Decimal(".01")) -def get_payment_items_sequence_qs() -> ExtendedQuerySetSequence: - return ExtendedQuerySetSequence( - Payment.objects.filter(excluded=False, conflicted=False), PaymentRecord.objects.all() - ) - - -def get_payment_cash_plan_items_sequence_qs() -> ExtendedQuerySetSequence: - return ExtendedQuerySetSequence(PaymentPlan.objects.all(), CashPlan.objects.all()) - - -def get_payment_plan_object(cash_or_payment_plan_id: str) -> Union["PaymentPlan", "CashPlan"]: - """ - get cash_or_payment_plan_id: "UGF5bWVudFBsYW5Ob2RlOmEz4YjA2NGJkMmJmMw==" - return CashPlan/PaymentPlan object or raise 404 - """ - node_name, obj_id = b64decode(cash_or_payment_plan_id).decode().split(":") - - payment_plan_object: Union["CashPlan", "PaymentPlan"] - if node_name == "CashPlanNode": - payment_plan_object = get_object_or_404(CashPlan, pk=obj_id) - else: - payment_plan_object = get_object_or_404(PaymentPlan, pk=obj_id) - - return payment_plan_object +def get_payment_plan_object(payment_plan_id: str) -> "PaymentPlan": + node_name, obj_id = b64decode(payment_plan_id).decode().split(":") + return get_object_or_404(PaymentPlan, pk=obj_id) def get_payment_delivered_quantity_status_and_value( diff --git a/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_export_per_fsp_service.py b/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_export_per_fsp_service.py index 000fde18eb..be749f0086 100644 --- a/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_export_per_fsp_service.py +++ b/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_export_per_fsp_service.py @@ -32,7 +32,9 @@ def check_if_token_or_order_number_exists_per_program(payment: Payment, field_name: str, token: int) -> bool: - return Payment.objects.filter(parent__program=payment.parent.program, **{field_name: token}).exists() + return Payment.objects.filter( + parent__program_cycle__program=payment.parent.program_cycle.program, **{field_name: token} + ).exists() def generate_token_and_order_numbers(payment: Payment) -> Payment: diff --git a/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_per_fsp_import_service.py b/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_per_fsp_import_service.py index 4ee9a5c5b7..c7d0306249 100644 --- a/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_per_fsp_import_service.py +++ b/src/hct_mis_api/apps/payment/xlsx/xlsx_payment_plan_per_fsp_import_service.py @@ -347,8 +347,8 @@ def _import_row(self, row: Row, exchange_rate: float) -> None: self.payments_to_save.append(payment) # update PaymentVerification status - if payment.payment_verification.exists(): - payment_verification = payment.payment_verification.first() + if hasattr(payment, "payment_verification"): + payment_verification = payment.payment_verification if payment_verification.status != PaymentVerification.STATUS_PENDING: if payment_verification.received_amount == delivered_quantity: diff --git a/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_export_service.py b/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_export_service.py index 6cf9909fa5..ac98aa5f7b 100644 --- a/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_export_service.py +++ b/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_export_service.py @@ -81,7 +81,7 @@ def _get_headers(self) -> tuple: def __init__(self, payment_verification_plan: PaymentVerificationPlan) -> None: self.payment_verification_plan = payment_verification_plan - self.is_social_worker_program = payment_verification_plan.payment_plan_obj.program.is_social_worker_program + self.is_social_worker_program = payment_verification_plan.payment_plan.program.is_social_worker_program self.payment_record_verifications = payment_verification_plan.payment_record_verifications.all() self.HEADERS = self._get_headers() @@ -115,11 +115,11 @@ def _add_payment_record_verification_row(self, payment_record_verification: Paym self._add_payment_record_verification_row_for_household(payment_record_verification) def _add_payment_record_verification_row_for_people(self, payment_record_verification: PaymentVerification) -> None: - household = payment_record_verification.payment_obj.household - head_of_household = payment_record_verification.payment_obj.head_of_household + household = payment_record_verification.payment.household + head_of_household = payment_record_verification.payment.head_of_household payment_record_verification_row = ( - str(payment_record_verification.payment_object_id), - str(payment_record_verification.payment_obj.unicef_id) if payment_record_verification.payment_obj else "", + str(payment_record_verification.payment_id), + str(payment_record_verification.payment.unicef_id) if payment_record_verification.payment else "", self._to_received_column(payment_record_verification), str(head_of_household.full_name) if head_of_household else "", str(head_of_household.phone_no) if head_of_household else "", @@ -130,7 +130,7 @@ def _add_payment_record_verification_row_for_people(self, payment_record_verific str(household.admin4.name) if household.admin4 else "", str(household.village), str(household.address), - payment_record_verification.payment_obj.delivered_quantity, + payment_record_verification.payment.delivered_quantity, payment_record_verification.received_amount, ) self.ws_export_list.append(payment_record_verification_row) @@ -138,11 +138,11 @@ def _add_payment_record_verification_row_for_people(self, payment_record_verific def _add_payment_record_verification_row_for_household( self, payment_record_verification: PaymentVerification ) -> None: - household = payment_record_verification.payment_obj.household - head_of_household = payment_record_verification.payment_obj.head_of_household + household = payment_record_verification.payment.household + head_of_household = payment_record_verification.payment.head_of_household payment_record_verification_row = ( - str(payment_record_verification.payment_object_id), - str(payment_record_verification.payment_obj.unicef_id) if payment_record_verification.payment_obj else "", + str(payment_record_verification.payment.id), + str(payment_record_verification.payment.unicef_id) if payment_record_verification.payment else "", self._to_received_column(payment_record_verification), str(head_of_household.full_name) if head_of_household else "", str(head_of_household.phone_no) if head_of_household else "", @@ -153,9 +153,9 @@ def _add_payment_record_verification_row_for_household( str(household.admin4.name) if household.admin4 else "", str(household.village), str(household.address), - str(payment_record_verification.payment_obj.household_id), + str(payment_record_verification.payment.household_id), str(household.unicef_id), - payment_record_verification.payment_obj.delivered_quantity, + payment_record_verification.payment.delivered_quantity, payment_record_verification.received_amount, ) self.ws_export_list.append(payment_record_verification_row) diff --git a/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_import_service.py b/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_import_service.py index d980ee9591..555c530e96 100644 --- a/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_import_service.py +++ b/src/hct_mis_api/apps/payment/xlsx/xlsx_verification_import_service.py @@ -25,11 +25,9 @@ def __init__(self, cashplan_payment_verification: PaymentVerificationPlan, file: self.errors: List[XlsxError] = [] payment_record_verification_obj = self.cashplan_payment_verification.payment_record_verifications self.payment_record_verifications = payment_record_verification_obj.all() # .prefetch_related("payment") - self.payment_record_ids = [str(x.payment_object_id) for x in self.payment_record_verifications] - self.payment_record_verifications_dict = { - str(x.payment_object_id): x for x in self.payment_record_verifications - } - self.payment_records_dict = {str(x.payment_object_id): x.payment_obj for x in self.payment_record_verifications} + self.payment_record_ids = [str(x.payment_id) for x in self.payment_record_verifications] + self.payment_record_verifications_dict = {str(x.payment_id): x for x in self.payment_record_verifications} + self.payment_records_dict = {str(x.payment_id): x.payment for x in self.payment_record_verifications} self.payment_verifications_to_save = [] self.was_validation_run = False diff --git a/src/hct_mis_api/apps/program/fixtures.py b/src/hct_mis_api/apps/program/fixtures.py index 0c9846dedc..bfc4b80b7a 100644 --- a/src/hct_mis_api/apps/program/fixtures.py +++ b/src/hct_mis_api/apps/program/fixtures.py @@ -42,7 +42,7 @@ class Meta: variable_nb_words=True, ext_word_list=None, ) - program = factory.SubFactory("program.fixtures.ProgramFactory") + program = factory.SubFactory("hct_mis_api.apps.program.fixtures.ProgramFactory") class ProgramFactory(DjangoModelFactory): diff --git a/src/hct_mis_api/apps/program/models.py b/src/hct_mis_api/apps/program/models.py index 1ca109577c..89fc9e5325 100644 --- a/src/hct_mis_api/apps/program/models.py +++ b/src/hct_mis_api/apps/program/models.py @@ -2,7 +2,7 @@ import string from datetime import date from decimal import Decimal -from typing import Any, Collection, Optional, Union +from typing import Any, Collection, Optional from django.conf import settings from django.contrib.postgres.fields import CICharField @@ -24,8 +24,8 @@ from hct_mis_api.apps.activity_log.utils import create_mapping_dict from hct_mis_api.apps.core.models import DataCollectingType -from hct_mis_api.apps.core.querysets import ExtendedQuerySetSequence from hct_mis_api.apps.household.models import Household +from hct_mis_api.apps.payment.models import PaymentPlan from hct_mis_api.apps.targeting.models import TargetPopulation from hct_mis_api.apps.utils.models import ( AbstractSyncable, @@ -223,7 +223,7 @@ def _generate_programme_code(self) -> str: return programme_code @staticmethod - def get_total_number_of_households_from_payments(qs: Union[models.QuerySet, ExtendedQuerySetSequence]) -> int: + def get_total_number_of_households_from_payments(qs: models.QuerySet[PaymentPlan]) -> int: return ( qs.filter(**{"payment_items__delivered_quantity__gt": 0}) .distinct("payment_items__household__unicef_id") diff --git a/src/hct_mis_api/apps/program/schema.py b/src/hct_mis_api/apps/program/schema.py index 16884aa4bb..7d9b10fb44 100644 --- a/src/hct_mis_api/apps/program/schema.py +++ b/src/hct_mis_api/apps/program/schema.py @@ -1,13 +1,11 @@ -from typing import Any, Dict, List, Tuple, Type +from typing import Any, Dict, List from django.db.models import ( Case, Count, DecimalField, - Exists, F, IntegerField, - OuterRef, Q, QuerySet, Sum, @@ -16,7 +14,7 @@ ) import graphene -from graphene import Int, relay +from graphene import relay from graphene_django import DjangoObjectType from graphene_django.filter import DjangoFilterConnectionField @@ -25,7 +23,6 @@ ALL_GRIEVANCES_CREATE_MODIFY, AdminUrlNodeMixin, BaseNodePermissionMixin, - BasePermission, DjangoPermissionFilterConnectionField, Permissions, hopeOneOfPermissionClass, @@ -46,21 +43,7 @@ get_program_id_from_headers, to_choice_object, ) -from hct_mis_api.apps.payment.filters import ( - CashPlanFilter, - PaymentVerificationPlanFilter, -) -from hct_mis_api.apps.payment.models import ( - CashPlan, - DeliveryMechanism, - GenericPayment, - PaymentVerificationPlan, - PaymentVerificationSummary, -) -from hct_mis_api.apps.payment.schema import ( - PaymentVerificationPlanNode, - PaymentVerificationSummaryNode, -) +from hct_mis_api.apps.payment.models import DeliveryMechanism from hct_mis_api.apps.payment.utils import get_payment_items_for_dashboard from hct_mis_api.apps.program.filters import ProgramCycleFilter, ProgramFilter from hct_mis_api.apps.program.models import Program, ProgramCycle @@ -164,46 +147,6 @@ def resolve_can_finish(program: Program, info: Any, **kwargs: Any) -> bool: return program.can_finish -class CashPlanNode(BaseNodePermissionMixin, DjangoObjectType): - permission_classes: Tuple[Type[BasePermission], ...] = ( - hopePermissionClass(Permissions.PAYMENT_VERIFICATION_VIEW_DETAILS), - hopePermissionClass(Permissions.PROGRAMME_VIEW_LIST_AND_DETAILS), - ) - - bank_reconciliation_success = graphene.Int() - bank_reconciliation_error = graphene.Int() - delivery_type = graphene.String() - total_number_of_households = graphene.Int() - currency = graphene.String(source="currency") - total_delivered_quantity = graphene.Float() - total_entitled_quantity = graphene.Float() - total_undelivered_quantity = graphene.Float() - can_create_payment_verification_plan = graphene.Boolean() - available_payment_records_count = graphene.Int() - verification_plans = DjangoPermissionFilterConnectionField( - PaymentVerificationPlanNode, - filterset_class=PaymentVerificationPlanFilter, - ) - payment_verification_summary = graphene.Field( - PaymentVerificationSummaryNode, - source="get_payment_verification_summary", - ) - unicef_id = graphene.String(source="ca_id") - - class Meta: - model = CashPlan - interfaces = (relay.Node,) - connection_class = ExtendedConnection - - def resolve_available_payment_records_count(self, info: Any, **kwargs: Any) -> Int: - return self.payment_items.filter( - status__in=GenericPayment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0 - ).count() - - def resolve_verification_plans(self, info: Any, **kwargs: Any) -> QuerySet: - return self.get_payment_verification_plans - - class Query(graphene.ObjectType): program = relay.Node.Field(ProgramNode) all_programs = DjangoPermissionFilterConnectionField( @@ -227,18 +170,6 @@ class Query(graphene.ObjectType): program=graphene.String(required=False), administrative_area=graphene.String(required=False), ) - - cash_plan = relay.Node.Field(CashPlanNode) - all_cash_plans = DjangoPermissionFilterConnectionField( - CashPlanNode, - filterset_class=CashPlanFilter, - permission_classes=( - hopePermissionClass(Permissions.PAYMENT_VERIFICATION_VIEW_LIST), - hopePermissionClass( - Permissions.PROGRAMME_VIEW_LIST_AND_DETAILS, - ), - ), - ) program_status_choices = graphene.List(ChoiceObject) program_cycle_status_choices = graphene.List(ChoiceObject) program_frequency_of_payments_choices = graphene.List(ChoiceObject) @@ -361,30 +292,6 @@ def resolve_data_collecting_type_choices(self, info: Any, **kwargs: Any) -> List .order_by("name") ) - def resolve_all_cash_plans(self, info: Any, **kwargs: Any) -> QuerySet[CashPlan]: - payment_verification_summary_qs = PaymentVerificationSummary.objects.filter( - payment_plan_object_id=OuterRef("id") - ) - - return CashPlan.objects.annotate( - custom_order=Case( - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_ACTIVE)), - then=Value(1), - ), - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_PENDING)), - then=Value(2), - ), - When( - Exists(payment_verification_summary_qs.filter(status=PaymentVerificationPlan.STATUS_FINISHED)), - then=Value(3), - ), - output_field=IntegerField(), - default=Value(0), - ), - ).order_by("-updated_at", "custom_order") - @chart_permission_decorator(permissions=[Permissions.DASHBOARD_VIEW_COUNTRY]) @cached_in_django_cache(24) def resolve_chart_programmes_by_sector(self, info: Any, business_area_slug: str, year: int, **kwargs: Any) -> Dict: @@ -392,7 +299,7 @@ def resolve_chart_programmes_by_sector(self, info: Any, business_area_slug: str, sector_choice_mapping = dict(Program.SECTOR_CHOICE) payment_items_qs: QuerySet = get_payment_items_for_dashboard(year, business_area_slug, filters, True) - programs_ids = payment_items_qs.values_list("parent__program__id", flat=True) + programs_ids = payment_items_qs.values_list("parent__program_cycle__program__id", flat=True) programs = Program.objects.filter(id__in=programs_ids).distinct() programmes_by_sector = ( diff --git a/src/hct_mis_api/apps/registration_data/admin.py b/src/hct_mis_api/apps/registration_data/admin.py index 792e634c95..79bd900119 100644 --- a/src/hct_mis_api/apps/registration_data/admin.py +++ b/src/hct_mis_api/apps/registration_data/admin.py @@ -24,7 +24,7 @@ from hct_mis_api.apps.household.documents import get_individual_doc from hct_mis_api.apps.household.forms import MassEnrollForm from hct_mis_api.apps.household.models import Individual, PendingIndividual -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.registration_data.models import ( DeduplicationEngineSimilarityPair, RegistrationDataImport, @@ -164,9 +164,7 @@ def delete_rdi(self, request: HttpRequest, pk: UUID) -> Any: # TODO: typing @staticmethod def delete_merged_rdi_visible(rdi: RegistrationDataImport) -> bool: is_correct_status = rdi.status == RegistrationDataImport.MERGED - is_not_used_by_payment_record = ( - PaymentRecord.objects.filter(household__registration_data_import=rdi).count() == 0 - ) + is_not_used_by_payment_record = Payment.objects.filter(household__registration_data_import=rdi).count() == 0 return is_correct_status and is_not_used_by_payment_record @staticmethod diff --git a/src/hct_mis_api/apps/reporting/celery_tasks.py b/src/hct_mis_api/apps/reporting/celery_tasks.py index 8cdae047a0..a3f5eeda93 100644 --- a/src/hct_mis_api/apps/reporting/celery_tasks.py +++ b/src/hct_mis_api/apps/reporting/celery_tasks.py @@ -27,22 +27,3 @@ def report_export_task(self: Any, report_id: UUID) -> None: except Exception as e: logger.exception(e) raise self.retry(exc=e) - - -@app.task(bind=True, default_retry_delay=60, max_retries=3) -@log_start_and_end -@sentry_tags -def dashboard_report_export_task(self: Any, dashboard_report_id: UUID) -> None: - try: - from hct_mis_api.apps.reporting.models import DashboardReport - from hct_mis_api.apps.reporting.services.generate_dashboard_report_service import ( - GenerateDashboardReportService, - ) - - report_obj = DashboardReport.objects.get(id=dashboard_report_id) - set_sentry_business_area_tag(report_obj.business_area.name) - service = GenerateDashboardReportService(report=report_obj) - service.generate_report() - except Exception as e: - logger.exception(e) - raise self.retry(exc=e) diff --git a/src/hct_mis_api/apps/reporting/mutations.py b/src/hct_mis_api/apps/reporting/mutations.py index a161bb358d..c0c885298d 100644 --- a/src/hct_mis_api/apps/reporting/mutations.py +++ b/src/hct_mis_api/apps/reporting/mutations.py @@ -16,16 +16,12 @@ from hct_mis_api.apps.core.validators import CommonValidator from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.reporting.celery_tasks import ( - dashboard_report_export_task, - report_export_task, -) +from hct_mis_api.apps.reporting.celery_tasks import report_export_task from hct_mis_api.apps.reporting.inputs import ( - CreateDashboardReportInput, CreateReportInput, RestartCreateReportInput, ) -from hct_mis_api.apps.reporting.models import DashboardReport, Report +from hct_mis_api.apps.reporting.models import Report from hct_mis_api.apps.reporting.schema import ReportNode from hct_mis_api.apps.reporting.validators import ReportValidator @@ -113,44 +109,6 @@ def mutate(cls, root: Any, info: Any, report_data: Dict) -> "RestartCreateReport return RestartCreateReport(report) -class CreateDashboardReport(PermissionMutation): - success = graphene.Boolean() - - class Arguments: - report_data = CreateDashboardReportInput(required=True) - - @classmethod - @is_authenticated - def mutate(cls, root: Any, info: Any, report_data: Dict) -> "CreateDashboardReport": - business_area = BusinessArea.objects.get(slug=report_data.pop("business_area_slug")) - cls.has_permission(info, Permissions.DASHBOARD_EXPORT, business_area) - - report_vars = { - "business_area": business_area, - "created_by": info.context.user, - "status": DashboardReport.IN_PROGRESS, - "report_type": report_data["report_types"], - "year": report_data["year"], - } - - program_id = report_data.pop("program", None) - admin_area_id = report_data.pop("admin_area", None) - if program_id and business_area.slug != "global": - program = get_object_or_404(Program, id=decode_id_string(program_id), business_area=business_area) - report_vars["program"] = program - - if admin_area_id and business_area.slug != "global": - admin_area = get_object_or_404(Area, id=decode_id_string(admin_area_id)) - report_vars["admin_area"] = admin_area - - report = DashboardReport.objects.create(**report_vars) - - dashboard_report_export_task.delay(dashboard_report_id=str(report.id)) - - return CreateDashboardReport(True) - - class Mutations(graphene.ObjectType): create_report = CreateReport.Field() restart_create_report = RestartCreateReport.Field() - create_dashboard_report = CreateDashboardReport.Field() diff --git a/src/hct_mis_api/apps/reporting/schema.py b/src/hct_mis_api/apps/reporting/schema.py index 6e51c17e9c..9e74ed0b67 100644 --- a/src/hct_mis_api/apps/reporting/schema.py +++ b/src/hct_mis_api/apps/reporting/schema.py @@ -22,7 +22,7 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.geo.schema import AreaNode from hct_mis_api.apps.grievance.models import GrievanceTicket -from hct_mis_api.apps.payment.models import Payment, PaymentRecord +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.reporting.filters import ReportFilter from hct_mis_api.apps.reporting.models import DashboardReport, Report @@ -112,7 +112,6 @@ def resolve_dashboard_years_choices(self, info: Any, business_area_slug: str, ** current_year = datetime.today().year years_list = [*range(current_year, current_year - 5, -1)] models = [ - (PaymentRecord, "delivery_date"), (Payment, "delivery_date"), (GrievanceTicket, "created_at"), ] diff --git a/src/hct_mis_api/apps/reporting/services/generate_dashboard_report_service.py b/src/hct_mis_api/apps/reporting/services/generate_dashboard_report_service.py deleted file mode 100644 index fdd3eb3252..0000000000 --- a/src/hct_mis_api/apps/reporting/services/generate_dashboard_report_service.py +++ /dev/null @@ -1,1071 +0,0 @@ -import copy -import datetime -import functools -import io -import logging -from itertools import chain -from tempfile import NamedTemporaryFile -from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple - -from django.conf import settings -from django.contrib.sites.models import Site -from django.db.models import Count, DecimalField, F, Q, QuerySet, Sum -from django.template.loader import render_to_string -from django.urls import reverse - -import openpyxl -from openpyxl.styles import Font -from openpyxl.utils import get_column_letter - -from hct_mis_api.apps.account.models import User -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.geo.models import Area -from hct_mis_api.apps.grievance.models import GrievanceTicket -from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.models import ( - DeliveryMechanism, - PaymentRecord, - PaymentVerification, -) -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.reporting.models import DashboardReport - -if TYPE_CHECKING: - from openpyxl.worksheet.worksheet import Worksheet - - -logger = logging.getLogger(__name__) - - -class GenerateDashboardReportContentHelpers: - @classmethod - def get_beneficiaries(cls, report: DashboardReport) -> Tuple[Any, Dict]: - children_count_fields = [ - "female_age_group_0_5_count", - "female_age_group_6_11_count", - "female_age_group_12_17_count", - "male_age_group_0_5_count", - "male_age_group_6_11_count", - "male_age_group_12_17_count", - ] - individual_count_fields = cls._get_all_individual_count_fields() - valid_payment_records = cls._get_payment_records_for_report(report) - - ( - instances, - valid_payment_records_in_instance_filter_key, - ) = cls._get_business_areas_or_programs(report, valid_payment_records) - - for instance in instances: - valid_payment_records_in_instance = valid_payment_records.filter( - **{valid_payment_records_in_instance_filter_key: instance["id"]} - ) - valid_households = Household.objects.filter(paymentrecord__in=valid_payment_records_in_instance).distinct() - households_aggr = cls._aggregate_instances_sum( - valid_households, - individual_count_fields, - ) - instance["total_children"] = cls._reduce_aggregate(households_aggr, children_count_fields) - instance["total_individuals"] = cls._reduce_aggregate(households_aggr, individual_count_fields) - instance["num_households"] = valid_households.count() - - # get total distincts (can't use the sum of column since some households might belong to multiple programs) - households = Household.objects.filter(paymentrecord__in=valid_payment_records).distinct() - households_aggr = cls._aggregate_instances_sum(households, individual_count_fields) - totals = { - "num_households": households.count(), - "total_individuals": cls._reduce_aggregate(households_aggr, individual_count_fields), - "total_children": cls._reduce_aggregate(households_aggr, children_count_fields), - } - # return instances for rows and totals row info - return instances, totals - - @classmethod - def get_individuals(cls, report: DashboardReport) -> Tuple[Any, Dict]: - valid_payment_records = cls._get_payment_records_for_report(report) - individual_count_fields = cls._get_all_with_disabled_individual_count_fields() - ( - instances, - valid_payment_records_in_instance_filter_key, - ) = cls._get_business_areas_or_programs(report, valid_payment_records) - - for instance in instances: - valid_payment_records_in_instance = valid_payment_records.filter( - **{valid_payment_records_in_instance_filter_key: instance["id"]} - ) - households_aggr = cls._aggregate_instances_sum( - Household.objects.filter(paymentrecord__in=valid_payment_records_in_instance).distinct(), - individual_count_fields, - ) - instance.update(households_aggr) - - # get total distincts (can't use the sum of column since some households might belong to multiple programs) - households_aggr = cls._aggregate_instances_sum( - Household.objects.filter(paymentrecord__in=valid_payment_records).distinct(), - individual_count_fields, - ) - # return instances for rows and totals row info - return instances, households_aggr - - @classmethod - def get_volumes_by_delivery(cls, report: DashboardReport) -> Tuple[Any, Dict]: - valid_payment_records = cls._get_payment_records_for_report(report) - ( - instances, - valid_payment_records_in_instance_filter_key, - ) = cls._get_business_areas_or_programs(report, valid_payment_records) - - def aggregate_by_delivery_type(payment_records: QuerySet[PaymentRecord]) -> Dict: - result = dict() - for delivery_type in DeliveryMechanism.get_choices(only_active=False): - value = delivery_type[0] - result[value] = ( - payment_records.filter(delivery_type__code=value) - .aggregate(Sum("delivered_quantity_usd", output_field=DecimalField())) - .get("delivered_quantity_usd__sum") - ) - return result - - for instance in instances: - valid_payment_records_in_instance = valid_payment_records.filter( - **{valid_payment_records_in_instance_filter_key: instance["id"]} - ) - aggregated_by_delivery_type = aggregate_by_delivery_type(valid_payment_records_in_instance) - instance.update(aggregated_by_delivery_type) - - totals = aggregate_by_delivery_type(valid_payment_records) - return instances, totals - - @classmethod - def get_programs(cls, report: DashboardReport) -> Tuple[QuerySet, Optional[Dict]]: - filter_vars = cls._format_filters( - report, - {}, - "cashplan__payment_items__delivery_date", - "admin_areas", - "id", - "business_area", - ) - months_labels = cls.get_all_months() - - def get_filter_query(cash: bool, month: int) -> Q: - if cash: - return Q( - cashplan__payment_items__delivery_type__transfer_type=DeliveryMechanism.TransferType.CASH.value, - cashplan__payment_items__delivery_date__month=month, - ) - else: - return Q( - cashplan__payment_items__delivery_type__transfer_type=DeliveryMechanism.TransferType.VOUCHER.value, - cashplan__payment_items__delivery_date__month=month, - ) - - def get_annotation(index_number: int, cash: bool = True) -> Dict: - key_label = months_labels[index_number] - label = f"{key_label}_cash" if cash else f"{key_label}_voucher" - return { - label: Sum( - "cashplan__payment_items__delivered_quantity_usd", - filter=get_filter_query(cash, index_number + 1), - output_field=DecimalField(), - ) - } - - programs = ( - Program.objects.filter(**filter_vars) - .distinct() - .annotate( - successful_payments=Count( - "cashplan__payment_items", - filter=Q(cashplan__payment_items__delivered_quantity_usd__gt=0), - ) - ) - .annotate( - unsuccessful_payments=Count( - "cashplan__payment_items", - filter=Q(cashplan__payment_items__delivered_quantity_usd=0), - ) - ) - ) - for index_number in range(0, len(months_labels)): - programs = programs.annotate(**get_annotation(index_number, True)) - programs = programs.annotate(**get_annotation(index_number, False)) - - return programs, None - - @classmethod - def get_grievances(cls, report: DashboardReport) -> Tuple[QuerySet[BusinessArea], Dict]: - filter_vars = { - "created_at__year": report.year, - } - if report.admin_area: - filter_vars["admin2"] = report.admin_area - - if not cls._is_report_global(report): - filter_vars["business_area"] = report.business_area - - valid_grievances = GrievanceTicket.objects.filter(**filter_vars) - days_30_from_now = datetime.date.today() - datetime.timedelta(days=30) - days_60_from_now = datetime.date.today() - datetime.timedelta(days=60) - - feedback_categories = [ - GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - GrievanceTicket.CATEGORY_NEGATIVE_FEEDBACK, - ] - status_closed_query = Q(tickets__status=GrievanceTicket.STATUS_CLOSED) - status_open_query = ~Q(tickets__status=GrievanceTicket.STATUS_CLOSED) - instances = ( - BusinessArea.objects.filter(tickets__in=valid_grievances) - .distinct() - .annotate(total_grievances=Count("tickets", filter=~Q(tickets__category__in=feedback_categories))) - .annotate(total_feedback=Count("tickets", filter=Q(tickets__category__in=feedback_categories))) - .annotate(total_resolved=Count("tickets", filter=status_closed_query)) - .annotate( - total_unresolved_lte_30=Count( - "tickets", - filter=Q(status_open_query, tickets__created_at__gte=days_30_from_now), - ) - ) - .annotate( - total_unresolved_30=Count( - "tickets", - filter=Q( - status_open_query, - tickets__created_at__lt=days_30_from_now, - tickets__created_at__gte=days_60_from_now, - ), - ) - ) - .annotate( - total_unresolved_60=Count( - "tickets", - filter=Q(status_open_query, tickets__created_at__lt=days_60_from_now), - ) - ) - .annotate( - total_open_sensitive=Count( - "tickets", - filter=Q( - status_open_query, - tickets__category=GrievanceTicket.CATEGORY_SENSITIVE_GRIEVANCE, - ), - ) - ) - ) - - totals = instances.aggregate( - Sum("total_grievances"), - Sum("total_feedback"), - Sum("total_resolved"), - Sum("total_unresolved_lte_30"), - Sum("total_unresolved_30"), - Sum("total_unresolved_60"), - Sum("total_open_sensitive"), - ) - - return instances, totals - - @classmethod - def get_payment_verifications(cls, report: DashboardReport) -> Tuple[QuerySet[Program], None]: - filter_vars = {"payment_record__delivery_date__year": report.year} - if report.admin_area: - filter_vars["payment_record__household__admin_area"] = report.admin_area - if report.program: - filter_vars["payment_record__parent__program"] = report.program - if not cls._is_report_global(report): - filter_vars["payment_record__business_area"] = report.business_area - valid_verifications = PaymentVerification.objects.filter(**filter_vars) - path_to_payment_record_verifications = "cashplan__payment_verification_plan__payment_record_verifications" - - def format_status_filter(status: str) -> Q: - return Q(**{f"{path_to_payment_record_verifications}__status": status}) - - programs = ( - Program.objects.filter(**{f"{path_to_payment_record_verifications}__in": valid_verifications}) - .distinct() - .annotate( - total_cash_plan_verifications=Count( - "cashplan__payment_verification_plan__payment_record_verifications", distinct=True - ) - ) - .annotate( - total_households=Count( - f"{path_to_payment_record_verifications}__payment_record__household", - distinct=True, - ) - ) - .annotate( - total_payment_records=Count( - "cashplan__payment_items", - distinct=True, - ) - ) - .annotate( - all_possible_payment_records=Count( - "cashplan__payment_items", - distinct=True, - filter=Q( - cashplan__payment_verification_plan__isnull=False, - cashplan__payment_items__status=PaymentRecord.STATUS_SUCCESS, - cashplan__payment_items__delivered_quantity__gt=0, - ), - ) - ) - .annotate(total_verifications_done=Count(path_to_payment_record_verifications, distinct=True)) - .annotate( - received=Count( - path_to_payment_record_verifications, - filter=format_status_filter(PaymentVerification.STATUS_RECEIVED), - distinct=True, - ) - ) - .annotate( - not_received=Count( - path_to_payment_record_verifications, - filter=format_status_filter(PaymentVerification.STATUS_NOT_RECEIVED), - distinct=True, - ) - ) - .annotate( - received_with_issues=Count( - path_to_payment_record_verifications, - filter=format_status_filter(PaymentVerification.STATUS_RECEIVED_WITH_ISSUES), - distinct=True, - ) - ) - .annotate( - not_responded=Count( - path_to_payment_record_verifications, - distinct=True, - filter=format_status_filter(PaymentVerification.STATUS_PENDING), - ) - ) - ) - - return programs, None - - @classmethod - def get_total_transferred_by_country(cls, report: DashboardReport) -> Tuple[QuerySet[BusinessArea], Dict]: - # only for HQ dashboard - business_areas = ( - BusinessArea.objects.filter( - paymentrecord__delivered_quantity_usd__gt=0, - paymentrecord__delivery_date__year=report.year, - ) - .annotate( - total_cash=Sum( - "paymentrecord__delivered_quantity_usd", - filter=Q(paymentrecord__delivery_type__transfer_type=DeliveryMechanism.TransferType.CASH.value), - output_field=DecimalField(), - ) - ) - .annotate( - total_voucher=Sum( - "paymentrecord__delivered_quantity_usd", - filter=Q(paymentrecord__delivery_type__transfer_type=DeliveryMechanism.TransferType.VOUCHER.value), - output_field=DecimalField(), - ) - ) - ) - - totals = business_areas.aggregate( - Sum("total_cash", output_field=DecimalField()), Sum("total_voucher", output_field=DecimalField()) - ) - - return business_areas, totals - - @classmethod - def get_total_transferred_by_admin_area(cls, report: DashboardReport) -> Tuple: - # only for country dashboard - valid_payment_records = cls._get_payment_records_for_report(report) - admin_areas = ( - Area.objects.filter( - area_type__area_level=2, - household__paymentrecord__in=valid_payment_records, - ) - .distinct() - .annotate( - total_transferred=Sum("household__paymentrecord__delivered_quantity_usd", output_field=DecimalField()) - ) - .annotate(num_households=Count("household", distinct=True)) - ) - - totals = admin_areas.aggregate( - Sum("total_transferred", output_field=DecimalField()), Sum("num_households", output_field=DecimalField()) - ) - admin_areas = admin_areas.values("id", "name", "p_code", "num_households", "total_transferred") - - individual_count_fields = cls._get_all_individual_count_fields() - - for admin_area in admin_areas: - valid_payment_records_in_instance = valid_payment_records.filter(household__admin_area=admin_area["id"]) - households_aggr = cls._aggregate_instances_sum( - Household.objects.filter(paymentrecord__in=valid_payment_records_in_instance).distinct(), - individual_count_fields, - ) - admin_area.update(households_aggr) - - totals.update( - cls._aggregate_instances_sum( - Household.objects.filter(paymentrecord__in=valid_payment_records).distinct(), - individual_count_fields, - ) - ) - - return admin_areas, totals - - @staticmethod - def format_beneficiaries_row(instance: Dict, is_totals: bool, *args: Any) -> Tuple: - return ( - instance.get("business_area_code", "") if not is_totals else "", - instance.get("name", "") if not is_totals else "Total Distinct", - instance.get("num_households", ""), - instance.get("total_individuals", ""), - instance.get("total_children", ""), - ) - - @classmethod - def format_individuals_row(cls, instance: Dict, is_totals: bool, *args: Any) -> Tuple: - all_count_fields = cls._get_all_with_disabled_individual_count_fields() - result = [ - instance.get("business_area_code", "") if not is_totals else "", - instance.get("name", "") if not is_totals else "Total Distinct", - ] - for field in all_count_fields: - result.append(instance.get(f"{field}__sum", 0)) - return tuple(result) - - @classmethod - def format_volumes_by_delivery_row(cls, instance: Dict, is_totals: bool, *args: Any) -> Tuple: - result = [ - instance.get("business_area_code", "") if not is_totals else "", - instance.get("name", "") if not is_totals else "Total", - ] - for choice in DeliveryMechanism.get_choices(only_active=False): - result.append(instance.get(choice[0])) - - return tuple(result) - - @classmethod - def format_programs_row(cls, instance: Program, *args: Any) -> Tuple: - result: List = [ - instance.business_area.cash_assist_code, - instance.business_area.name, - instance.name, - instance.sector, - instance.cash_plus, - instance.frequency_of_payments, - instance.unsuccessful_payments, - instance.successful_payments, - ] - months = cls.get_all_months() - for month in months: - result += [ - getattr(instance, f"{month}_cash", 0), - getattr(instance, f"{month}_voucher", 0), - ] - return tuple(result) - - @staticmethod - def format_total_transferred_by_country(instance: BusinessArea, is_totals: bool, *args: Any) -> Tuple: - if is_totals: - return ( - "", - "Total", - instance.get("total_cash__sum") or 0, - instance.get("total_voucher__sum") or 0, - ) - else: - return ( - instance.code, - instance.name, - instance.total_cash or 0, - instance.total_voucher or 0, - ) - - @staticmethod - def format_grievances_row(instance: GrievanceTicket, is_totals: bool, is_hq: bool) -> Tuple: - if is_totals and not is_hq: - # no totals row for country report - return () - elif is_totals: - return ( - "", - "Total", - instance.get("total_grievances__sum", 0), - instance.get("total_feedback__sum", 0), - instance.get("total_resolved__sum", 0), - instance.get("total_unresolved_lte_30__sum", 0), - instance.get("total_unresolved_30__sum", 0), - instance.get("total_unresolved_60__sum", 0), - instance.get("total_open_sensitive__sum", 0), - ) - else: - shared_cells = ( - instance.total_grievances, - instance.total_feedback, - instance.total_resolved, - instance.total_unresolved_lte_30, - instance.total_unresolved_30, - instance.total_unresolved_60, - instance.total_open_sensitive, - ) - if is_hq: - return (instance.code, instance.name) + shared_cells - else: - return (instance.code,) + shared_cells - - @staticmethod - def format_payment_verifications_row(instance: Program, *args: Any) -> Tuple: - average_sampling = 0 - if instance.all_possible_payment_records: - average_sampling = round((instance.total_verifications_done / instance.all_possible_payment_records) * 100) - return ( - instance.business_area.cash_assist_code, - instance.business_area.name, - instance.name, - instance.total_cash_plan_verifications, - instance.total_households, - average_sampling, - instance.received, - instance.not_received, - instance.received_with_issues, - instance.not_responded, - ) - - @classmethod - def format_total_transferred_by_admin_area_row(cls, instance: Area, is_totals: bool, *args: Any) -> Tuple: - fields_list = cls._get_all_individual_count_fields() - - shared_cells = tuple(instance.get(f"{field_name}__sum", 0) for field_name in fields_list) - - if is_totals: - return ( - "", - "Total", - instance.get("total_transferred__sum", 0), - instance.get("num_households__sum", 0), - ) + shared_cells - else: - return ( - instance.get("name", ""), - instance.get("p_code", ""), - instance.get("total_transferred", 0), - instance.get("num_households", 0), - ) + shared_cells - - @staticmethod - def _is_report_global(report: DashboardReport) -> bool: - return report.business_area.slug == "global" - - @classmethod - def _format_filters( - cls, - report: DashboardReport, - custom_filters: Dict, - date_path: str, - admin_area_path: str, - program_path: str, - business_area_path: str, - ) -> Dict: - filter_vars = custom_filters or {} - if date_path: - filter_vars.update({f"{date_path}__year": report.year}) - if admin_area_path and report.admin_area: - filter_vars.update({admin_area_path: report.admin_area, f"{admin_area_path}__level": 2}) - if program_path and report.program: - filter_vars.update({program_path: report.program}) - if not cls._is_report_global(report) and business_area_path: - filter_vars.update({business_area_path: report.business_area}) - return filter_vars - - @classmethod - def _format_filters_for_payment_records(self, report: DashboardReport) -> Dict: - return self._format_filters( - report, - {"delivered_quantity_usd__gt": 0}, - "delivery_date", - "household__admin_area", - "parent__program", - "business_area", - ) - - @classmethod - def _get_payment_records_for_report(self, report: DashboardReport) -> QuerySet[PaymentRecord]: - return PaymentRecord.objects.filter(**self._format_filters_for_payment_records(report)) - - @classmethod - def _get_business_areas_or_programs( - cls, report: DashboardReport, valid_payment_records: Iterable[PaymentRecord] - ) -> Tuple[Any, str]: - if cls._is_report_global(report): - business_area_code_path = "code" - instances = BusinessArea.objects.filter(paymentrecord__in=valid_payment_records) - valid_payment_records_in_instance_filter_key = "business_area" - else: - business_area_code_path = "business_area__code" - instances = Program.objects.filter(cashplan__payment_items__in=valid_payment_records) - valid_payment_records_in_instance_filter_key = "parent__program" - - instances = ( - instances.distinct() - .annotate(business_area_code=F(business_area_code_path)) - .values("id", "name", "business_area_code") - ) - return instances, valid_payment_records_in_instance_filter_key - - @staticmethod - def _aggregate_instances_sum(instances: Any, field_list: List) -> Dict: - aggregation_list = [Sum(field_name) for field_name in field_list] - return instances.aggregate(*aggregation_list) - - @staticmethod - def _reduce_aggregate(aggregate: Dict, fields_list: List) -> int: - return functools.reduce( - lambda a, b: a + aggregate[f"{b}__sum"] if aggregate[f"{b}__sum"] else a, - fields_list, - 0, - ) - - @staticmethod - def _get_all_with_disabled_individual_count_fields() -> List[str]: - return [ - "female_age_group_0_5_count", - "female_age_group_0_5_disabled_count", - "female_age_group_6_11_count", - "female_age_group_6_11_disabled_count", - "female_age_group_12_17_count", - "female_age_group_12_17_disabled_count", - "female_age_group_18_59_count", - "female_age_group_18_59_disabled_count", - "female_age_group_60_count", - "female_age_group_60_disabled_count", - "male_age_group_0_5_count", - "male_age_group_0_5_disabled_count", - "male_age_group_6_11_count", - "male_age_group_6_11_disabled_count", - "male_age_group_12_17_count", - "male_age_group_12_17_disabled_count", - "male_age_group_18_59_count", - "male_age_group_18_59_disabled_count", - "male_age_group_60_count", - "male_age_group_60_disabled_count", - ] - - @staticmethod - def _get_all_individual_count_fields() -> List[str]: - return [ - "female_age_group_0_5_count", - "female_age_group_6_11_count", - "female_age_group_12_17_count", - "female_age_group_18_59_count", - "female_age_group_60_count", - "male_age_group_0_5_count", - "male_age_group_6_11_count", - "male_age_group_12_17_count", - "male_age_group_18_59_count", - "male_age_group_60_count", - ] - - @staticmethod - def get_all_months() -> List[str]: - return [ - "january", - "february", - "march", - "april", - "may", - "june", - "july", - "august", - "september", - "october", - "november", - "december", - ] - - -class GenerateDashboardReportService: - HQ = 1 - COUNTRY = 2 - SHARED = 3 - ROW_CONTENT_METHODS: Dict = { - DashboardReport.BENEFICIARIES_REACHED: ( - GenerateDashboardReportContentHelpers.get_beneficiaries, - GenerateDashboardReportContentHelpers.format_beneficiaries_row, - ), - DashboardReport.INDIVIDUALS_REACHED: ( - GenerateDashboardReportContentHelpers.get_individuals, - GenerateDashboardReportContentHelpers.format_individuals_row, - ), - DashboardReport.VOLUME_BY_DELIVERY_MECHANISM: ( - GenerateDashboardReportContentHelpers.get_volumes_by_delivery, - GenerateDashboardReportContentHelpers.format_volumes_by_delivery_row, - ), - DashboardReport.PROGRAMS: ( - GenerateDashboardReportContentHelpers.get_programs, - GenerateDashboardReportContentHelpers.format_programs_row, - ), - DashboardReport.TOTAL_TRANSFERRED_BY_COUNTRY: ( - GenerateDashboardReportContentHelpers.get_total_transferred_by_country, - GenerateDashboardReportContentHelpers.format_total_transferred_by_country, - ), - DashboardReport.GRIEVANCES_AND_FEEDBACK: ( - GenerateDashboardReportContentHelpers.get_grievances, - GenerateDashboardReportContentHelpers.format_grievances_row, - ), - DashboardReport.PAYMENT_VERIFICATION: ( - GenerateDashboardReportContentHelpers.get_payment_verifications, - GenerateDashboardReportContentHelpers.format_payment_verifications_row, - ), - DashboardReport.TOTAL_TRANSFERRED_BY_ADMIN_AREA: ( - GenerateDashboardReportContentHelpers.get_total_transferred_by_admin_area, - GenerateDashboardReportContentHelpers.format_total_transferred_by_admin_area_row, - ), - } - META_HEADERS = ( - "report type", - "creation date", - "created by", - "business area", - "report year", - ) - META_SHEET = "Meta data" - MAX_COL_WIDTH = 75 - - def __init__(self, report: DashboardReport) -> None: - self.report = report - self.report_types = report.report_type - self.business_area = report.business_area - self.hq_or_country = self.HQ if report.business_area.slug == "global" else self.COUNTRY - - @property - def headers(self) -> Dict: - return { - DashboardReport.BENEFICIARIES_REACHED: { - self.HQ: ("business area", "country"), - self.COUNTRY: ("business area", "programme"), - self.SHARED: ("households reached", "individuals reached", "children reached"), - }, - DashboardReport.TOTAL_TRANSFERRED_BY_ADMIN_AREA: { - self.HQ: (), - self.COUNTRY: ( - "Admin Level 2", - "Admin Code", - "Total tranferred (USD)", - "Households reached", - "Female 0-5 Reached", - "Female 6-11 Reached", - "Female 12-17 Reached", - "Female 18-59 Reached", - "Female 60+ Reached", - "Male 0-5 Reached", - "Male 6-11 Reached", - "Male 12-17 Reached", - "Male 18-59 Reached", - "Male 60+ Reached", - ), - self.SHARED: (), - }, - DashboardReport.PAYMENT_VERIFICATION: { - self.HQ: (), - self.COUNTRY: (), - self.SHARED: ( - "business area", - "country", - "programme", - "cash plan verifications", - "Households Contacted", - "average sampling", - "Received", - "Not Received", - "Received with issues", - "Not Responded", - ), - }, - DashboardReport.GRIEVANCES_AND_FEEDBACK: { - self.HQ: ( - "business area", - "country", - ), - self.COUNTRY: ("business area",), - self.SHARED: ( - "grievance tickets", - "feedback tickets", - "resolved tickets", - "Unresolved =<30 days", - "Unresolved >30 days", - "Unresolved >60 days", - "open sensitive grievances", - ), - }, - DashboardReport.TOTAL_TRANSFERRED_BY_COUNTRY: { - self.HQ: ( - "business area", - "country", - "actual cash transferred", - "actual voucher transferred", - ), - self.COUNTRY: (), - self.SHARED: (), - }, - DashboardReport.PROGRAMS: { - self.HQ: (), - self.COUNTRY: (), - self.SHARED: ( - "business area", - "country", - "programme", - "sector", - "cash+", - "frequency", - "unsuccessful payment", - "successful payment", - ) - + tuple( - chain.from_iterable( - [ - [f"{month.capitalize()} cash", f"{month.capitalize()} voucher"] - for month in GenerateDashboardReportContentHelpers.get_all_months() - ] - ) - ), - }, - DashboardReport.VOLUME_BY_DELIVERY_MECHANISM: { - self.HQ: ( - "business area", - "country", - ), - self.COUNTRY: ( - "business area", - "programme", - ), - self.SHARED: tuple(choice[1] for choice in DeliveryMechanism.get_choices(only_active=False)), - }, - DashboardReport.INDIVIDUALS_REACHED: { - self.HQ: ( - "business area", - "country", - ), - self.COUNTRY: ( - "business area", - "programme", - ), - self.SHARED: ( - "females 0-5 reached", - "females 0-5 w/ disability reached", - "females 6-11 reached", - "females 6-11 w/ disability reached", - "females 12-17 reached", - "females 12-17 w/ disability reached", - "females 18-59 reached", - "females 18-59 w/ disability reached", - "females 60+ reached", - "females 60+ w/ disability reached", - "males 0-5 reached", - "males 0-5 w/ disability reached", - "males 6-11 reached", - "males 6-11 w/ disability reached", - "males 12-17 reached", - "males 12-17 w/ disability reached", - "males 18-59 reached", - "males 18-59 w/ disability reached", - "males 60+ reached", - "males 60+ w/ disability reached", - ), - }, - } - - @property - def remove_empty_columns(self) -> dict: - return { - DashboardReport.VOLUME_BY_DELIVERY_MECHANISM: ( - 3, - DeliveryMechanism.objects.all().count() + 3, - ) - } - - def _create_workbook(self) -> openpyxl.Workbook: - wb = openpyxl.Workbook() - ws_meta = wb.active - ws_meta.title = self.META_SHEET - self.wb = wb - self.ws_meta = ws_meta - return wb - - def _format_meta_tab(self) -> None: - self.ws_meta.append(self.META_HEADERS) - info_row = ( - self._report_types_to_joined_str(), - self._format_date(self.report.created_at), - self._format_user_name(self.report.created_by), - self.business_area.name, - str(self.report.year), - ) - self.ws_meta.append(info_row) - - def _add_headers(self, active_sheet: "Worksheet", report_type: str) -> int: - headers_row = self.headers[report_type][self.hq_or_country] + self.headers[report_type][self.SHARED] - headers_row = self._stringify_all_values(headers_row) - active_sheet.append(headers_row) - return len(headers_row) - - def _add_rows(self, active_sheet: "Worksheet", report_type: str) -> int: - is_hq_report = self.hq_or_country == self.HQ - get_row_methods: Tuple[Callable, Callable] = self.ROW_CONTENT_METHODS[report_type] - all_instances, totals = get_row_methods[0](self.report) - for instance in all_instances: - row = get_row_methods[1](instance, False, is_hq_report) - str_row = self._stringify_all_values(row) - active_sheet.append(str_row) - # append totals row - if totals: - row = get_row_methods[1](totals, True, is_hq_report) - str_row = self._stringify_all_values(row) - active_sheet.append(str_row) - return len(all_instances) - - def generate_workbook(self) -> openpyxl.Workbook: - self._create_workbook() - self._format_meta_tab() - self._add_font_style_to_sheet(self.ws_meta) - self._adjust_column_width_from_col(self.ws_meta, 1, 5, 1) - - # loop through all selected report types and add sheet for each - for report_type in self.report_types: - sheet_title = self._report_type_to_str(report_type) - active_sheet = self.wb.create_sheet(sheet_title, -1) - number_of_columns = self._add_headers(active_sheet, report_type) - number_of_rows = self._add_rows(active_sheet, report_type) - self._add_font_style_to_sheet(active_sheet, number_of_rows + 2) - remove_empty_columns_values = self.remove_empty_columns.get(report_type) - if remove_empty_columns_values: - self._remove_empty_columns( - active_sheet, - number_of_rows + 2, - remove_empty_columns_values[0], - remove_empty_columns_values[1], - ) - self._adjust_column_width_from_col(active_sheet, 1, number_of_columns, 1) - - return self.wb - - def generate_report(self) -> None: - try: - self.generate_workbook() - file_name = ( - self._report_type_to_str(self.report_types[0]) if len(self.report_types) == 1 else "Multiple reports" - ) - with NamedTemporaryFile() as tmp: - self.wb.save(tmp.name) - file = bytes(tmp.read()) - self.report.file.save( - f"{file_name}-{self._format_date(self.report.created_at)}.xlsx", - io.BytesIO(file), - save=False, - ) - self.report.status = DashboardReport.COMPLETED - except Exception as e: # pragma: no cover - logger.exception(e) - self.report.status = DashboardReport.FAILED - self.report.save() - - if self.report.file and self.business_area.enable_email_notification: - self._send_email() - - def _send_email(self) -> None: - path = reverse("dashboard_report", kwargs={"report_id": self.report.id}) - protocol = "https" if settings.SOCIAL_AUTH_REDIRECT_IS_HTTPS else "http" - context = { - "report_type": self._report_types_to_joined_str(), - "created_at": self._format_date(self.report.created_at), - "report_url": f"{protocol}://{Site.objects.first()}{path}", - "title": "Report", - } - text_body = render_to_string("dashboard_report.txt", context=context) - html_body = render_to_string("dashboard_report.html", context=context) - subject = "HOPE report generated" - - self.report.created_by.email_user( - subject=subject, - html_body=html_body, - text_body=text_body, - ) - - @staticmethod - def _adjust_column_width_from_col(ws: "Worksheet", min_col: int, max_col: int, min_row: int) -> None: - column_widths = [] - for i, col in enumerate(ws.iter_cols(min_col=min_col, max_col=max_col, min_row=min_row)): - for cell in col: - value = cell.value - if value is not None: - if isinstance(value, str) is False: - value = str(value) - if len(value) > GenerateDashboardReportService.MAX_COL_WIDTH: - alignment = copy.copy(cell.alignment) - alignment.wrapText = True - cell.alignment = alignment - try: - column_widths[i] = max(column_widths[i], len(value)) - except IndexError: - column_widths.append(len(value)) - - for i in range(len(column_widths)): - col_name = get_column_letter(min_col + i) - value = column_widths[i] + 2 - value = ( - GenerateDashboardReportService.MAX_COL_WIDTH - if value > GenerateDashboardReportService.MAX_COL_WIDTH - else value - ) - ws.column_dimensions[col_name].width = value - - @staticmethod - def _add_font_style_to_sheet(ws: "Worksheet", totals_row: Optional[int] = None) -> None: - bold_font = Font(bold=True) - for cell in ws["1:1"]: - cell.font = bold_font - if totals_row: - ws[f"B{totals_row}"].font = bold_font - - @staticmethod - def _report_type_to_str(report_type: str) -> str: - types_dict = dict(DashboardReport.REPORT_TYPES) - label = str(types_dict.get(report_type, "")) - return label[:31] - - def _report_types_to_joined_str(self) -> str: - return ", ".join([self._report_type_to_str(report_type) for report_type in self.report_types]) - - @staticmethod - def _stringify_all_values(row: tuple) -> tuple: - str_row = [] - for value in row: - if isinstance(value, (str, int, float)): - str_row.append(value) - else: - str_row.append(str(value if value is not None else "")) - return tuple(str_row) - - @staticmethod - def _format_date(date: datetime.date) -> str: - return date.strftime("%Y-%m-%d") if date else "" - - @staticmethod - def _format_user_name(user: User) -> str: - return ( - f"{user.first_name} {user.last_name}" if user.first_name or user.last_name else user.email or user.username - ) - - @staticmethod - def _remove_empty_columns(ws: "Worksheet", totals_row: int, min_col: int = 1, max_col: int = 2) -> int: - to_remove_columns = [] - for col_idx in range(min_col, max_col): - col_letter = get_column_letter(col_idx) - if not ws[f"{col_letter}{totals_row}"].value: - to_remove_columns.append(col_idx) - columns_removed = 0 - for column in to_remove_columns: - ws.delete_cols(column - columns_removed) - columns_removed += 1 - return len(to_remove_columns) diff --git a/src/hct_mis_api/apps/reporting/services/generate_report_service.py b/src/hct_mis_api/apps/reporting/services/generate_report_service.py index 7e52c8d1ae..f809f70ce6 100644 --- a/src/hct_mis_api/apps/reporting/services/generate_report_service.py +++ b/src/hct_mis_api/apps/reporting/services/generate_report_service.py @@ -203,8 +203,8 @@ def _map_admin_area_names_from_ids(admin_areas_ids: list) -> str: def format_cash_plan_verification_row(cls, verification: PaymentVerificationPlan) -> tuple: return ( verification.id, - verification.payment_plan_obj.get_unicef_id, - verification.payment_plan_obj.program.name, + verification.payment_plan.unicef_id, + verification.payment_plan.program.name, cls._format_date(verification.activation_date), verification.status, verification.verification_channel, @@ -247,8 +247,8 @@ def format_payment_row(cls, payment: PaymentRecord) -> tuple: cash_or_voucher = "voucher" return ( - payment.ca_id, - payment.parent.ca_id if payment.parent else "", + payment.unicef_id, + payment.parent.unicef_id if payment.parent else "", payment.status, payment.currency, payment.delivered_quantity, @@ -269,21 +269,21 @@ def get_payment_verifications(report: Report) -> QuerySet: PaymentPlan.objects.filter(business_area=report.business_area).values_list("id", flat=True) ) filter_vars = { - "payment_verification_plan__payment_plan_object_id__in": pp_business_area_ids, + "payment_verification_plan__payment_plan_id__in": pp_business_area_ids, "payment_verification_plan__completion_date__isnull": False, "payment_verification_plan__completion_date__date__range": (report.date_from, report.date_to), } if report.program: pp_program_ids = list(PaymentPlan.objects.filter(program=report.program).values_list("id", flat=True)) - filter_vars["payment_verification_plan__payment_plan_object_id__in"] = pp_program_ids + filter_vars["payment_verification_plan__payment_plan_id__in"] = pp_program_ids return PaymentVerification.objects.filter(**filter_vars) @classmethod def format_payment_verification_row(cls, payment_verification: PaymentVerification) -> tuple: return ( payment_verification.payment_verification_plan.id, - payment_verification.payment_obj.unicef_id, - payment_verification.payment_verification_plan.get_payment_plan.get_unicef_id, + payment_verification.payment.unicef_id, + payment_verification.payment_verification_plan.payment_plan.unicef_id, cls._format_date(payment_verification.payment_verification_plan.completion_date), payment_verification.received_amount, payment_verification.status, @@ -304,7 +304,7 @@ def get_payment_plans(report: Report) -> QuerySet[PaymentPlan]: @classmethod def format_payment_plan_row(cls, payment_plan: PaymentPlan) -> tuple: return ( - payment_plan.get_unicef_id, + payment_plan.unicef_id, payment_plan.get_status_display(), payment_plan.total_households_count, payment_plan.get_currency_display(), diff --git a/src/hct_mis_api/apps/targeting/models.py b/src/hct_mis_api/apps/targeting/models.py index b3191a3cdf..ac1a41fa00 100644 --- a/src/hct_mis_api/apps/targeting/models.py +++ b/src/hct_mis_api/apps/targeting/models.py @@ -223,6 +223,7 @@ class TargetPopulation(SoftDeletableModel, TimeStampedUUIDModel, ConcurrencyMode help_text="Written by a tool such as Corticon.", blank=True, ) + excluded_ids = models.TextField(blank=True) exclusion_reason = models.TextField(blank=True) @@ -251,7 +252,6 @@ class TargetPopulation(SoftDeletableModel, TimeStampedUUIDModel, ConcurrencyMode null=True, ) - # TODO: move to StorageFile storage_file = models.OneToOneField(StorageFile, blank=True, null=True, on_delete=models.SET_NULL) @property diff --git a/src/hct_mis_api/apps/utils/models.py b/src/hct_mis_api/apps/utils/models.py index 529505d456..39ad4bdf52 100644 --- a/src/hct_mis_api/apps/utils/models.py +++ b/src/hct_mis_api/apps/utils/models.py @@ -631,3 +631,10 @@ def discard_all(cls) -> None: @classmethod def purge(cls) -> None: app.control.purge() + + +class InternalDataFieldModel(models.Model): + internal_data = models.JSONField(default=dict) + + class Meta: + abstract = True diff --git a/src/hct_mis_api/migrations_script/main.py b/src/hct_mis_api/migrations_script/main.py index 40da6f22e5..927d598ae8 100644 --- a/src/hct_mis_api/migrations_script/main.py +++ b/src/hct_mis_api/migrations_script/main.py @@ -45,6 +45,12 @@ def apply_migrations(): if __name__ == "__main__": export_migration_info_to_csv() clear_migration_table() - excluded_migrations = [("targeting", "0002_migration")] + excluded_migrations = [ + ("targeting", "0002_migration"), + ("household", "0003_migration"), + ("grievance", "0004_migration"), + ("payment", "0002_migration"), + ("payment", "0003_migration"), + ] fake_migrations(excluded_migrations) apply_migrations() diff --git a/src/hct_mis_api/one_time_scripts/add_tickets_to_missing_rdis.py b/src/hct_mis_api/one_time_scripts/add_tickets_to_missing_rdis.py deleted file mode 100644 index e576c94bf8..0000000000 --- a/src/hct_mis_api/one_time_scripts/add_tickets_to_missing_rdis.py +++ /dev/null @@ -1,479 +0,0 @@ -import copy -import logging -from typing import Any - -from django.db.models import Q, QuerySet - -from hct_mis_api.apps.grievance.models import ( - GrievanceDocument, - GrievanceTicket, - TicketAddIndividualDetails, - TicketComplaintDetails, - TicketDeleteHouseholdDetails, - TicketDeleteIndividualDetails, - TicketHouseholdDataUpdateDetails, - TicketIndividualDataUpdateDetails, - TicketNeedsAdjudicationDetails, - TicketNegativeFeedbackDetails, - TicketNote, - TicketPaymentVerificationDetails, - TicketPositiveFeedbackDetails, - TicketReferralDetails, - TicketSensitiveDetails, - TicketSystemFlaggingDetails, -) -from hct_mis_api.apps.household.models import Household, Individual -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.registration_data.models import RegistrationDataImport -from hct_mis_api.one_time_scripts.migrate_data_for_sync import ( - get_household_representation_per_program_by_old_household_id, - get_individual_representation_per_program_by_old_individual_id, -) -from hct_mis_api.one_time_scripts.migrate_grievance_for_sync import ( - copy_grievance_ticket, - copy_ticket_with_household, - copy_ticket_with_individual, - handle_bulk_create_paginated_data, - handle_bulk_update_representations_household_unicef_id, - handle_extra_data, - handle_role_reassign_data, -) - -rdi_list_dict = [ - { - "rdi_id": "dd4edad1-bc79-4b29-ad0b-64b5f9880730", - "wrong_program_id": "d3453d26-4dfd-4754-9509-199409d664e0", - "good_program_id": "1b9ae544-ad2f-492a-87ed-b0d2ea69d62e", - }, - { - "rdi_id": "e53e277b-2abb-46a0-9dd5-f84622f500a1", - "wrong_program_id": "c5f1caa6-68b6-4c68-8ae5-d6a180d68666", - "good_program_id": "5d9d2eec-a51f-4613-8494-ee96b4bb3f2b", - }, - { - "rdi_id": "294082c6-2911-489e-8cbe-39701be3a9fc", - "wrong_program_id": "a16e88a9-a2ed-44b8-828d-13ee7cf8d92f", - "good_program_id": "60018500-f548-4334-80b6-4e33d53746be", - }, - { - "rdi_id": "99037d0b-0a6c-4b92-969e-ecac793498f5", - "wrong_program_id": "a16e88a9-a2ed-44b8-828d-13ee7cf8d92f", - "good_program_id": "60018500-f548-4334-80b6-4e33d53746be", - }, - { - "rdi_id": "cb02f7a2-1de3-4a62-becb-969d5793f5ca", - "wrong_program_id": "c6203ef4-f793-45fd-a322-c02480ff7c2e", - "good_program_id": "c6203ef4-f793-45fd-a322-c02480ff7c2e", - }, - { - "rdi_id": "cc96e2d0-7ed1-44fc-90d2-c4c430e1e92b", - "wrong_program_id": "373a51cf-f4e3-405a-ba5a-14db65244496", - "good_program_id": "d2090028-c216-4ec0-8734-7500a0386669", - }, - { - "rdi_id": "6b4a5350-1112-4e03-9f95-487e2c0464f3", - "wrong_program_id": "d25d9093-2308-4b7f-ab0a-2fabf8809b66", - "good_program_id": "d25d9093-2308-4b7f-ab0a-2fabf8809b66", - }, - { - "rdi_id": "0b3b9909-f214-4195-a093-ec5e661ed333", - "wrong_program_id": "d3453d26-4dfd-4754-9509-199409d664e0", - "good_program_id": "1b9ae544-ad2f-492a-87ed-b0d2ea69d62e", - }, - { - "rdi_id": "a09c1115-661c-409d-af56-460d913c157a", - "wrong_program_id": "a16e88a9-a2ed-44b8-828d-13ee7cf8d92f", - "good_program_id": "60018500-f548-4334-80b6-4e33d53746be", - }, - { - "rdi_id": "ca905acc-a67e-4e19-bf6a-503d613dfea9", - "wrong_program_id": "edeefab7-08d0-4f91-a805-6e3afabdbfbb", - "good_program_id": "edeefab7-08d0-4f91-a805-6e3afabdbfbb", - }, - { - "rdi_id": "cf4b391c-7106-4540-8655-2b1d11510ccf", - "wrong_program_id": "96a3d4df-c6ac-4664-b631-9f284b85bad0", - "good_program_id": "263b9684-0cda-4b8c-947a-a128912f301d", - }, -] -rdis = RegistrationDataImport.objects.filter(id__in=[rdi["rdi_id"] for rdi in rdi_list_dict]) - -logger = logging.getLogger(__name__) - -BATCH_SIZE = 100 - - -def create_tickets_for_missing_rdis(rdis: QuerySet) -> None: - model_list = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketPaymentVerificationDetails, - TicketIndividualDataUpdateDetails, - TicketHouseholdDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, - TicketNeedsAdjudicationDetails, - GrievanceTicket, - TicketNote, - GrievanceDocument, - ] - for model in model_list: - model._meta.get_field("created_at").auto_now_add = False - try: - for rdi in rdis: - logger.info(f"Creating tickets for {rdi}") - program = rdi.program - households_ids = list( - Household.original_and_repr_objects.filter(registration_data_import=rdi, is_original=True).values_list( - "id", flat=True - ) - ) - individuals_ids = list( - Individual.original_and_repr_objects.filter( - Q(is_original=True) - & (Q(household__id__in=households_ids) | Q(represented_households__id__in=households_ids)) - ).values_list("id", flat=True) - ) - handle_add_individual_details_for_fix(households_ids, program) - handle_delete_household_details_for_fix(households_ids, program) - handle_individual_data_update_details_for_fix(individuals_ids, program) - handle_system_flagging_details_for_fix(individuals_ids, program) - handle_needs_adjudication_details_for_fix(individuals_ids, program) - finally: - for model in model_list: - model._meta.get_field("created_at").auto_now_add = True - - -def handle_add_individual_details_for_fix(households_ids: list, program: Program) -> None: - logger.info("Handling TicketAddIndividualDetails") - handle_tickets_with_household_for_fix(TicketAddIndividualDetails, households_ids, program) - - -def handle_delete_household_details_for_fix(households_ids: list, program: Program) -> None: - logger.info("Handling TicketDeleteHouseholdDetails") - handle_tickets_with_household_for_fix(TicketDeleteHouseholdDetails, households_ids, program) - - -def handle_individual_data_update_details_for_fix(individuals_ids: list, program: Program) -> None: - logger.info("Handling TicketIndividualDataUpdateDetails") - handle_tickets_with_individual_for_fix(TicketIndividualDataUpdateDetails, individuals_ids, program) - - -def handle_system_flagging_details_for_fix(individuals_ids: list, program: Program) -> None: - logger.info("Handling TicketSystemFlaggingDetails") - handle_tickets_with_individual_for_fix( - TicketSystemFlaggingDetails, individuals_ids, program, individual_field_name="golden_records_individual" - ) - - -def handle_needs_adjudication_details_for_fix(individuals_ids: list, program: Program) -> None: - logger.info("Handling TicketNeedsAdjudicationDetails") - tickets = ( - TicketNeedsAdjudicationDetails.objects.select_related( - "ticket", - "golden_records_individual", - ) - .filter( - Q(ticket__is_original=True) - & (Q(golden_records_individual__id__in=individuals_ids) | Q(possible_duplicates__id__in=individuals_ids)) - ) - .order_by("pk") - ) - logger.info(f"Updating TicketNeedsAdjudicationDetails for program {program.name}") - # adding individuals to existing copied tickets - update_needs_adjudication_representations(tickets, program) - - # creating new tickets representations - logger.info(f"Creating new TicketNeedsAdjudicationDetails for program {program.name}") - create_new_needs_adjudication_representations(tickets, program) - - -def update_needs_adjudication_representations(tickets: QuerySet, program: Program) -> None: - tickets_to_update = tickets.filter(ticket__copied_to__programs=program).order_by("pk") - - PossibleDuplicateThrough = TicketNeedsAdjudicationDetails.possible_duplicates.through - SelectedIndividualThrough = TicketNeedsAdjudicationDetails.selected_individuals.through - - tickets_to_update_ids = list(tickets_to_update.values_list("id", flat=True)) - tickets_to_update_count = len(tickets_to_update_ids) - logger.info(f"Tickets to handle: {tickets_to_update_count}") - for batch_start in range(0, tickets_to_update_count, BATCH_SIZE): - logger.info(f"Handling needs adjudication tickets: {batch_start} of {tickets_to_update_count}") - batched_tickets_to_update_ids = tickets_to_update_ids[batch_start : batch_start + BATCH_SIZE] - batched_tickets_to_update = TicketNeedsAdjudicationDetails.objects.filter( - id__in=batched_tickets_to_update_ids - ).select_related( - "ticket", - "golden_records_individual", - ) - possible_duplicates_through_to_create = [] - select_through_to_create = [] - for original_needs_adjudication_ticket in batched_tickets_to_update: - needs_adjudication_ticket_repr = ( - original_needs_adjudication_ticket.ticket.copied_to.filter(programs=program) - .first() - .needs_adjudication_ticket_details - ) - individual_representations_from_original = [ - original_needs_adjudication_ticket.golden_records_individual.copied_to.filter(program=program).first(), - *[ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ind.id, - ) - for ind in original_needs_adjudication_ticket.possible_duplicates( - manager="original_and_repr_objects" - ).only("id") - ], - ] - # Delete None values - individual_representations_from_original = [ind for ind in individual_representations_from_original if ind] - individual_representations_from_copy = [ - needs_adjudication_ticket_repr.golden_records_individual, - *needs_adjudication_ticket_repr.possible_duplicates.all(), - ] - for ind in individual_representations_from_original: - if ind not in individual_representations_from_copy: - possible_duplicates_through_to_create.append( - PossibleDuplicateThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_repr, - individual=ind, - ) - ) - - selected_individual_representations_from_original = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ind.id, - ) - for ind in original_needs_adjudication_ticket.selected_individuals( - manager="original_and_repr_objects" - ).only("id") - ] - # Delete None values - selected_individual_representations_from_original = [ - ind for ind in selected_individual_representations_from_original if ind - ] - for ind in selected_individual_representations_from_original: - select_through_to_create.append( - SelectedIndividualThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_repr, - individual=ind, - ) - ) - PossibleDuplicateThrough.objects.bulk_create(possible_duplicates_through_to_create, ignore_conflicts=True) - SelectedIndividualThrough.objects.bulk_create(select_through_to_create, ignore_conflicts=True) - - -def create_new_needs_adjudication_representations(tickets: QuerySet, program: Program) -> None: - needs_adjudication_tickets = tickets.exclude(ticket__copied_to__programs=program).order_by("pk") - - PossibleDuplicateThrough = TicketNeedsAdjudicationDetails.possible_duplicates.through - SelectedIndividualThrough = TicketNeedsAdjudicationDetails.selected_individuals.through - needs_adjudication_tickets_ids = list(needs_adjudication_tickets.values_list("pk", flat=True)) - tickets_count = len(needs_adjudication_tickets_ids) - logger.info(f"Tickets to handle: {tickets_count}") - for batch_start in range(0, tickets_count, BATCH_SIZE): - batched_ids = needs_adjudication_tickets_ids[batch_start : batch_start + BATCH_SIZE] - needs_adjudication_tickets_batch = TicketNeedsAdjudicationDetails.objects.filter( - id__in=batched_ids - ).select_related( - "ticket", - "golden_records_individual", - ) - logger.info(f"Handling needs adjudication tickets: {batch_start} of {tickets_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - - new_possible_duplicates_to_create = [] - new_selected_individuals_to_create = [] - - for needs_adjudication_ticket in needs_adjudication_tickets_batch: - individuals = [ - needs_adjudication_ticket.golden_records_individual, - *needs_adjudication_ticket.possible_duplicates(manager="original_and_repr_objects").all(), - ] - possible_duplicates_repr = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual.id, - ) - for individual in individuals - if individual - ] - possible_duplicates_repr = [individual for individual in possible_duplicates_repr if individual] - if len(possible_duplicates_repr) > 1: - needs_adjudication_ticket_copy = copy.deepcopy(needs_adjudication_ticket) - if hasattr(needs_adjudication_ticket_copy, "role_reassign_data"): - needs_adjudication_ticket_copy = handle_role_reassign_data(needs_adjudication_ticket_copy, program) - if hasattr(needs_adjudication_ticket_copy, "extra_data"): - needs_adjudication_ticket_copy = handle_extra_data(needs_adjudication_ticket_copy, program) - needs_adjudication_ticket_copy.pk = None - # Copy Grievance Ticket - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - needs_adjudication_ticket_copy, - program, - needs_adjudication_ticket, - ) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(needs_adjudication_ticket_copy) - - needs_adjudication_ticket_copy.golden_records_individual = possible_duplicates_repr.pop() - - # Handle selected_individuals - old_selected_individuals = ( - needs_adjudication_ticket.selected_individuals(manager="original_and_repr_objects") - .filter(is_original=True) - .all() - ) - selected_individuals = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual, - ) - for individual in old_selected_individuals - ] - selected_individuals = [individual for individual in selected_individuals if individual] - - new_possible_duplicates_to_create.extend( - [ - PossibleDuplicateThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in possible_duplicates_repr - ] - ) - new_selected_individuals_to_create.extend( - [ - SelectedIndividualThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in selected_individuals - ] - ) - - handle_bulk_create_paginated_data([], objects_to_create_dict, TicketNeedsAdjudicationDetails) - PossibleDuplicateThrough.objects.bulk_create(new_possible_duplicates_to_create) - SelectedIndividualThrough.objects.bulk_create(new_selected_individuals_to_create) - - -def handle_tickets_with_household_for_fix(model: Any, households_ids: list, program: Program) -> None: - tickets = ( - model.objects.select_related( - "ticket", - "household", - ) - .filter(household__id__in=households_ids, ticket__is_original=True) - .exclude(ticket__copied_to__programs=program) - ) - tickets_to_handle = tickets.filter( - (Q(ticket__status=GrievanceTicket.STATUS_CLOSED) & ~Q(ticket__copied_to__programs__is_visible=True)) - | ~Q(ticket__status=GrievanceTicket.STATUS_CLOSED) - ).order_by("pk") - tickets_to_handle_ids = list(tickets_to_handle.values_list("pk", flat=True)) - tickets_to_handle_count = len(tickets_to_handle_ids) - logger.info(f"Found {tickets_to_handle_count} tickets to handle") - for batch_start in range(0, tickets_to_handle_count, BATCH_SIZE): - tickets_to_handle_batched_ids = tickets_to_handle_ids[batch_start : batch_start + BATCH_SIZE] - tickets_to_handle_batch = model.objects.filter(id__in=tickets_to_handle_batched_ids).select_related( - "ticket", "household" - ) - logger.info(f"Handling tickets: {batch_start} of {tickets_to_handle_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - for ticket_to_handle in tickets_to_handle_batch: - if household_representation := ticket_to_handle.household.copied_to.filter(program=program).first(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - ticket_to_handle, program, household_representation=household_representation - ) - if model == TicketDeleteHouseholdDetails: - ticket_copy.reason_household = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=ticket_to_handle.reason_household, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - handle_bulk_create_paginated_data([], objects_to_create_dict, model) - - tickets_with_hh_representation = model.objects.select_related( - "ticket", - "household", - ).filter( - household__isnull=False, - ticket__is_original=False, - ticket__copied_from__id__in=tickets_to_handle_ids, - ticket__programs=program, - ) - handle_bulk_update_representations_household_unicef_id( - tickets_with_hh_representation, - model, - ) - - -def handle_tickets_with_individual_for_fix( - model: Any, - individuals_ids: list, - program: Program, - individual_field_name: str = "individual", -) -> None: - tickets = ( - model.objects.select_related( - "ticket", - individual_field_name, - ) - .filter(**{f"{individual_field_name}__id__in": individuals_ids}, ticket__is_original=True) - .exclude(ticket__copied_to__programs=program) - ) - tickets_to_handle = tickets.filter( - Q(Q(ticket__status=GrievanceTicket.STATUS_CLOSED) & ~Q(ticket__copied_to__programs__is_visible=True)) - | ~Q(ticket__status__in=[GrievanceTicket.STATUS_CLOSED]) - ).order_by("pk") - tickets_to_handle_ids = list(tickets_to_handle.values_list("pk", flat=True)) - tickets_to_handle_count = len(tickets_to_handle_ids) - logger.info(f"Found {tickets_to_handle_count} tickets to handle") - for batch_start in range(0, tickets_to_handle_count, BATCH_SIZE): - batched_ids = tickets_to_handle_ids[batch_start : batch_start + BATCH_SIZE] - tickets_to_handle_batch = model.objects.select_related("ticket", individual_field_name).filter( - id__in=batched_ids - ) - logger.info(f"Handling tickets: {batch_start} of {tickets_to_handle_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - for ticket_to_handle in tickets_to_handle_batch: - if individual_representation := ( - getattr(ticket_to_handle, individual_field_name).copied_to.filter(program=program).first() - ): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_individual( - ticket_to_handle, - program, - individual_field_name=individual_field_name, - individual_representation=individual_representation, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - handle_bulk_create_paginated_data([], objects_to_create_dict, model) diff --git a/src/hct_mis_api/one_time_scripts/create_payment_snapshot.py b/src/hct_mis_api/one_time_scripts/create_payment_snapshot.py index c56242c736..f53629f92f 100644 --- a/src/hct_mis_api/one_time_scripts/create_payment_snapshot.py +++ b/src/hct_mis_api/one_time_scripts/create_payment_snapshot.py @@ -26,7 +26,7 @@ def create_payment_snapshot() -> None: if program_qs: print(f"Processing {program_qs.count()} programs for {ba.name}.") for program in program_qs: - for payment_plan in PaymentPlan.all_objects.filter(program=program): + for payment_plan in PaymentPlan.all_objects.filter(program_cycle__program=program): payments_ids = list( payment_plan.eligible_payments.filter(household_snapshot__isnull=True) .values_list("id", flat=True) diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py new file mode 100644 index 0000000000..3d46b810cd --- /dev/null +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -0,0 +1,287 @@ +from django.contrib.contenttypes.models import ContentType +from django.db import transaction + +from hct_mis_api.apps.grievance.models import ( + TicketComplaintDetails, + TicketSensitiveDetails, +) +from hct_mis_api.apps.payment.models import ( + CashPlan, + DeliveryMechanism, + DeliveryMechanismPerPaymentPlan, + FinancialServiceProvider, + Payment, + PaymentPlan, + PaymentRecord, + PaymentVerification, + PaymentVerificationPlan, + PaymentVerificationSummary, + ServiceProvider, +) +from hct_mis_api.apps.payment.services.payment_household_snapshot_service import ( + create_payment_plan_snapshot_data, +) + + +def get_status(status: str) -> str: + mapping = {"Transaction Successful": "Distribution Successful"} + return mapping.get(status, status) + + +def migrate_cash_plan_to_payment_plan() -> None: + content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) + content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) + content_type_for_payment = ContentType.objects.get_for_model(Payment) + content_type_for_payment_record = ContentType.objects.get_for_model(PaymentRecord) + + delivery_type_to_obj = {obj.name: obj for obj in DeliveryMechanism.objects.all()} + + for sp in ServiceProvider.objects.all(): + if not sp.cash_plans.exists(): + continue + + if FinancialServiceProvider.objects.filter(vision_vendor_number=sp.vision_id).exists(): + continue + + delivery_mechanisms = set(sp.cash_plans.all().values_list("delivery_type", flat=True)) + + fsp = FinancialServiceProvider.objects.create( + name=sp.full_name, + vision_vendor_number=sp.vision_id, + communication_channel="API", + internal_data={ + "is_cash_assist": True, + "business_area": sp.business_area.slug, + "country": sp.country, + "ca_id": sp.ca_id, + "short_name": sp.short_name, + }, + ) + fsp.delivery_mechanisms.set([delivery_type_to_obj[dt] for dt in delivery_mechanisms]) + + fsp_vision_vendor_number_to_obj = {obj.vision_vendor_number: obj for obj in FinancialServiceProvider.objects.all()} + + dm_cash = delivery_type_to_obj["Cash"] + + for cp in CashPlan.objects.filter(is_migrated_to_payment_plan=False): + with transaction.atomic(): + if not cp.payment_items.exists(): + continue + + # get target populations from payment records + target_populations = cp.payment_items.values_list("target_population", flat=True).distinct() + # for each target population create a payment plan within tp.payment_cycle + for tp in target_populations: + payment_records = cp.payment_items.filter(target_population=tp) + first_record = payment_records.first() + if first_record.delivery_type: + delivery_mechanism = delivery_type_to_obj[first_record.delivery_type.name] + else: + delivery_mechanism = dm_cash + currency = first_record.currency + + # create payment plan + pp = PaymentPlan.objects.create( + status="FINISHED", + name=tp.name, + business_area_id=tp.business_area.id, + created_by_id=tp.created_by.id, + created_at=tp.created_at, + target_population_id=tp.id, + program_cycle_id=tp.program_cycle.id, + currency=currency, + dispersion_start_date=cp.start_date or tp.program_cycle.start_date, + dispersion_end_date=cp.dispersion_date or tp.program_cycle.end_date, + start_date=cp.start_date or tp.program_cycle.start_date, + end_date=cp.end_date or tp.program_cycle.end_date, + status_date=cp.status_date, + exchange_rate=cp.exchange_rate, + total_entitled_quantity=cp.total_entitled_quantity, + total_entitled_quantity_usd=cp.total_entitled_quantity_usd, + total_entitled_quantity_revised=cp.total_entitled_quantity_revised, + total_entitled_quantity_revised_usd=cp.total_entitled_quantity_revised_usd, + total_delivered_quantity=cp.total_delivered_quantity, + total_delivered_quantity_usd=cp.total_delivered_quantity_usd, + total_undelivered_quantity=cp.total_undelivered_quantity, + total_undelivered_quantity_usd=cp.total_undelivered_quantity_usd, + is_cash_assist=True, + internal_data={ + "name": cp.name, + "ca_hash_id": str(cp.ca_hash_id), + "distribution_level": cp.distribution_level, + "coverage_duration": cp.coverage_duration, + "coverage_unit": cp.coverage_unit, + "comments": cp.comments, + "assistance_measurement": cp.assistance_measurement, + "assistance_through": cp.assistance_through, + "vision_id": cp.vision_id, + "funds_commitment": cp.funds_commitment, + "down_payment": cp.down_payment, + "validation_alerts_count": cp.validation_alerts_count, + "total_persons_covered": cp.total_persons_covered, + "total_persons_covered_revised": cp.total_persons_covered_revised, + }, + ) + pp.unicef_id = cp.ca_id + pp.save(update_fields=["unicef_id"]) + pp.update_population_count_fields() + + if not first_record.service_provider.vision_id: + raise Exception(f"Service provider {first_record.service_provider} vision_id is None") + financial_service_provider = fsp_vision_vendor_number_to_obj.get( + first_record.service_provider.vision_id + ) + if not financial_service_provider: + raise Exception( + f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" + ) + + DeliveryMechanismPerPaymentPlan.objects.update_or_create( + payment_plan_id=pp.id, + delivery_mechanism_id=delivery_mechanism.id, + sent_date=cp.status_date, + delivery_mechanism_order=1, + created_by_id=tp.created_by.id, + created_at=tp.created_at, + financial_service_provider_id=financial_service_provider.id, + ) + + # migrate payment verification summary, payment verification plans + + payment_verification_summary = PaymentVerificationSummary.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_summary: + payment_verification_summary.payment_plan_content_type_id = content_type_for_payment_plan.id + payment_verification_summary.payment_plan_object_id = pp.id + payment_verification_summary.payment_plan = pp + payment_verification_summary.save() + + payment_verification_plan = PaymentVerificationPlan.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_plan: + payment_verification_plan.payment_plan_content_type_id = content_type_for_payment_plan.id + payment_verification_plan.payment_plan_object_id = pp.id + payment_verification_plan.payment_plan = pp + payment_verification_plan.save() + + with transaction.atomic(): + for record in cp.payment_items.filter(target_population=tp).prefetch_related("service_provider"): + financial_service_provider = fsp_vision_vendor_number_to_obj.get( + record.service_provider.vision_id + ) + payment = Payment.objects.create( + parent_id=pp.id, + business_area_id=pp.business_area.id, + status=get_status(record.status), + status_date=record.status_date, + household_id=record.household_id, + head_of_household_id=record.head_of_household_id, + collector_id=record.head_of_household_id, + delivery_type_id=record.delivery_type_id, + currency=record.currency, + entitlement_quantity=record.entitlement_quantity, + entitlement_quantity_usd=record.entitlement_quantity_usd, + delivered_quantity=record.delivered_quantity, + delivered_quantity_usd=record.delivered_quantity_usd, + delivery_date=record.delivery_date, + transaction_reference_id=record.transaction_reference_id, + transaction_status_blockchain_link=record.transaction_status_blockchain_link, + financial_service_provider=financial_service_provider, + program_id=tp.program_cycle.program_id, + is_cash_assist=True, + internal_data={ + "ca_hash_id": str(record.ca_hash_id), + "full_name": record.full_name, + "total_persons_covered": record.total_persons_covered, + "distribution_modality": record.distribution_modality, + "target_population_cash_assist_id": record.target_population_cash_assist_id, + "target_population": str(record.target_population_id), + "entitlement_card_number": record.entitlement_card_number, + "entitlement_card_status": record.entitlement_card_status, + "entitlement_card_issue_date": str(record.entitlement_card_issue_date), + "vision_id": record.vision_id, + "registration_ca_id": record.registration_ca_id, + "service_provider": str(record.service_provider_id), + }, + ) + payment.unicef_id = record.ca_id + payment.save(update_fields=["unicef_id"]) + + payment_record_verification = PaymentVerification.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if payment_record_verification: + payment_record_verification.payment_content_type_id = content_type_for_payment.id + payment_record_verification.payment_object_id = payment.id + payment_record_verification.save() + + ticket_complaint_details = TicketComplaintDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_complaint_details: + ticket_complaint_details.payment_content_type_id = content_type_for_payment.id + ticket_complaint_details.payment_object_id = payment.id + ticket_complaint_details.save() + + ticket_sensitive_details = TicketSensitiveDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_sensitive_details: + ticket_sensitive_details.payment_content_type_id = content_type_for_payment.id + ticket_sensitive_details.payment_object_id = payment.id + ticket_sensitive_details.save() + + create_payment_plan_snapshot_data(pp) + + cp.is_migrated_to_payment_plan = True + cp.save(update_fields=["is_migrated_to_payment_plan"]) + + +def migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() -> None: + with transaction.atomic(): + verification_plans_to_update = [] + for verification_plan in PaymentVerificationPlan.objects.exclude( + payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True + ): + if verification_plan.payment_plan_content_type.model == "paymentplan": + payment_plan = PaymentPlan.objects.get(id=verification_plan.payment_plan_object_id) + verification_plan.payment_plan = payment_plan + verification_plans_to_update.append(verification_plan) + + PaymentVerificationPlan.objects.bulk_update(verification_plans_to_update, ["payment_plan"]) + + +def migrate_payment_verification_summary_generic_foreign_key_to_onetoone() -> None: + with transaction.atomic(): + verification_summaries_to_update = [] + for verification_summary in PaymentVerificationSummary.objects.exclude( + payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True + ): + if verification_summary.payment_plan_content_type.model == "paymentplan": + related_instance = PaymentPlan.objects.get(id=verification_summary.payment_plan_object_id) + verification_summary.payment_plan = related_instance + verification_summaries_to_update.append(verification_summary) + + PaymentVerificationSummary.objects.bulk_update(verification_summaries_to_update, ["payment_plan"]) + + +def migrate_payment_verification_generic_foreign_key_to_onetoone() -> None: + with transaction.atomic(): + verifications_to_update = [] + for verification in PaymentVerification.objects.exclude( + payment_content_type__isnull=True, payment_object_id__isnull=True + ): + if verification.payment_content_type.model == "payment": + related_instance = Payment.objects.get(id=verification.payment_object_id) + verification.payment = related_instance + verifications_to_update.append(verification) + + PaymentVerification.objects.bulk_update(verifications_to_update, ["payment"]) + + +def migrate_payment_verification_models() -> None: + migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() + migrate_payment_verification_summary_generic_foreign_key_to_onetoone() + migrate_payment_verification_generic_foreign_key_to_onetoone() diff --git a/src/hct_mis_api/one_time_scripts/migrate_data_for_sync.py b/src/hct_mis_api/one_time_scripts/migrate_data_for_sync.py deleted file mode 100644 index b41f503f53..0000000000 --- a/src/hct_mis_api/one_time_scripts/migrate_data_for_sync.py +++ /dev/null @@ -1,912 +0,0 @@ -import csv -import logging -import os -from collections import defaultdict -from copy import deepcopy -from itertools import chain -from typing import Any, Dict, List, Optional - -from django.db import transaction -from django.db.models import Q, QuerySet -from django.utils import timezone - -from hct_mis_api.apps.core.models import BusinessArea, DataCollectingType -from hct_mis_api.apps.household.models import ( - COLLECT_TYPE_FULL, - COLLECT_TYPE_NONE, - COLLECT_TYPE_PARTIAL, - COLLECT_TYPE_SIZE_ONLY, - COLLECT_TYPE_UNKNOWN, - BankAccountInfo, - Document, - EntitlementCard, - Household, - Individual, - IndividualIdentity, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.registration_data.models import RegistrationDataImport -from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation - -logger = logging.getLogger(__name__) - -BATCH_SIZE = 100 -BATCH_SIZE_SMALL = 20 - -# 1. migrate_data_to_representations()/migrate_data_to_representations_per_business_area(ba) - handles if new household was created and/or added to TP of program/if new RDI was created and any of its households was added to TP of program -# 2. copy_individual_sync - if new individual was added to household/external collector was added -# 3. copy_roles_sync - if new role was created - new repr has to be created, also needs to be checked if representation for individual needs to be created; if role for hh repr has been assigned to external individual, it is possible that this ind representation does not exist yet in this program -# 4 - Documents: copy_document_per_individual_fast, Identity: copy_individual_identity_per_individual_fast, BankAccountInfo: copy_bank_account_info_per_individual_fast - - -def migrate_data_to_representations() -> None: - for business_area in BusinessArea.objects.all(): - logger.info("----- NEW BUSINESS AREA -----") - logger.info(f"Handling business area: {business_area}") - migrate_data_to_representations_per_business_area(business_area=business_area) - - -def migrate_data_to_representations_per_business_area(business_area: BusinessArea) -> None: - """ - This function is used to migrate data from old models to new representations per business_area. - Take TargetPopulations: - - all for programs in status ACTIVE - - in status STATUS_READY_FOR_PAYMENT_MODULE and STATUS_READY_FOR_CASH_ASSIST for programs in status FINISHED, - delete other TargetPopulations - For all households and individuals in given TargetPopulations: - - create new representations - - copy all objects related to old households/individuals - - handle RDI: if there is RDI for household copy all households in this RDI to current program - For whole business_area: - - for rdi that was not related to program: add rdi and copy its households to the biggest program in that ba - - adjust payments and payment_records to corresponding representations - - """ - unknown_unassigned_dict = get_unknown_unassigned_dict() - unknown_unassigned_program = unknown_unassigned_dict.get(business_area) - - hhs_to_ignore = get_ignored_hhs() if business_area.name == "Afghanistan" else None - - for program in Program.objects.filter( - business_area=business_area, status__in=[Program.ACTIVE, Program.FINISHED] - ).order_by("status"): - logger.info("----- NEW PROGRAM -----") - logger.info(f"Creating representations for program: {program}") - target_populations_ids = TargetPopulation.objects.filter( - program=program, - ).values_list("id", flat=True) - - household_selections = HouseholdSelection.original_and_repr_objects.filter( - Q(target_population_id__in=target_populations_ids) - & Q(is_original=True) - & Q(is_migration_handled=False) - & ( - Q( - target_population__status__in=[ - TargetPopulation.STATUS_READY_FOR_PAYMENT_MODULE, - TargetPopulation.STATUS_READY_FOR_CASH_ASSIST, - ] - ) - | Q(household__withdrawn=False) - ) - ) - household_ids = household_selections.distinct("household").values_list("household_id", flat=True) - - households = Household.original_and_repr_objects.filter(id__in=household_ids, is_original=True).order_by( - "id" - ) # without is_migration_handled filter because there can be handled household but assigned to new TP; so filter for nothandled HHselection is only needed now - households_filtered = households.exclude(copied_to__program=program) - households_filtered_ids = list(households_filtered.values_list("id", flat=True)) - households_count = len(households_filtered_ids) - - logger.info(f"Handling households for program: {program}") - - for batch_start in range(0, households_count, BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logger.info(f"Handling {batch_start} - {batch_end}/{households_count} households") - individuals_per_household_dict = defaultdict(list) - batched_household_ids = households_filtered_ids[batch_start:batch_end] - batched_households = Household.original_and_repr_objects.filter(id__in=batched_household_ids) - for individual in Individual.original_and_repr_objects.filter(household__in=batched_households): - individuals_per_household_dict[individual.household_id].append(individual) - - with transaction.atomic(): - for household in batched_households: - copy_household_representation_for_programs_fast( - household, program, individuals_per_household_dict[household.id] - ) - - rdi_ids = households.values_list("registration_data_import_id", flat=True).distinct() - rdis = RegistrationDataImport.objects.filter(id__in=rdi_ids) - if program.status == Program.ACTIVE: - logger.info(f"Handling RDIs for program: {program}") - handle_rdis(rdis, program, hhs_to_ignore) - else: - rdis.filter(program__isnull=True).update(program=program) - - logger.info(f"Copying roles for program: {program}") - copy_roles(households, program=program) - - logger.info(f"Copying household selections for program: {program}") - copy_household_selections(household_selections, program) - logger.info(f"Finished creating representations for program: {program}") - logger.info("Updating is_migration_handled for households") - # mark programs households as migrated and exclude in rerun - Household.original_and_repr_objects.filter( - business_area=business_area, copied_to__isnull=False, is_original=True, is_migration_handled=False - ).update(is_migration_handled=True) - logger.info("Handling objects without any representations yet - enrolling to storage programs") - handle_non_program_objects(business_area, hhs_to_ignore, unknown_unassigned_program) - - logger.info("Updating Households with migration date") - Household.original_and_repr_objects.filter( - business_area=business_area, - copied_to__isnull=False, - is_original=True, - is_migration_handled=False, - ).update( - is_migration_handled=True, - migrated_at=timezone.now(), - ) - - logger.info("Updating Individuals with migration date") - Individual.original_and_repr_objects.filter( - business_area=business_area, is_original=True, copied_to__isnull=False, is_migration_handled=False - ).update( - is_migration_handled=True, - migrated_at=timezone.now(), - ) - - logger.info("Updating IndividualRoleInHouseholds with migration date") - IndividualRoleInHousehold.original_and_repr_objects.filter( - household__business_area=business_area, is_original=True, copied_to__isnull=False, is_migration_handled=False - ).update(is_migration_handled=True, migrated_at=timezone.now()) - - if business_area.name == "Democratic Republic of Congo": - apply_congo_withdrawal() - - -def get_household_representation_per_program_by_old_household_id( - program: Program, - old_household_id: str, -) -> Optional[Household]: - return Household.original_and_repr_objects.filter( - program=program, - copied_from_id=old_household_id, - is_original=False, - ).first() - - -def get_individual_representation_per_program_by_old_individual_id( - program: Program, - old_individual_id: str, -) -> Optional[Individual]: - return Individual.original_and_repr_objects.filter( - program=program, - copied_from_id=old_individual_id, - is_original=False, - ).first() - - -def copy_household_representation( - household: Household, - program: Program, - individuals: list[Individual], -) -> Optional[Household]: - """ - Copy household into representation for given program if it does not exist yet. - """ - # copy representations only based on original households - if household.is_original: - # if there is no representation of this household in this program yet, copy the household - if household_representation := Household.original_and_repr_objects.filter( - program=program, - copied_from=household, - is_original=False, - ).first(): - return household_representation - else: - return copy_household(household, program, individuals) - return household - - -def copy_household_representation_for_programs_fast( - household: Household, - program: Program, - individuals: list[Individual], -) -> Optional[Household]: - """ - Copy household into representation for given program if it does not exist yet. - """ - # copy representations only based on original households - if household.is_original: - return copy_household_fast(household, program, individuals) - return household - - -def copy_household(household: Household, program: Program, individuals: list[Individual]) -> Household: - copy = deepcopy(household) - original_household_id = household.id - original_unicef_id = household.unicef_id - original_head_of_household_id = household.head_of_household_id - copy.copied_from_id = original_household_id - copy.origin_unicef_id = original_unicef_id - copy.pk = None - copy.unicef_id = original_unicef_id - copy.program = program - copy.is_original = False - - individuals_to_create = [] - for individual in individuals: - individuals_to_create.append(copy_individual_representation(program, individual)) - - copy.head_of_household = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=original_head_of_household_id, - ) - Household.objects.bulk_create([copy]) - for individual in individuals_to_create: # type: ignore - individual.household = copy - - Individual.original_and_repr_objects.bulk_update(individuals_to_create, ["household"]) - - # copy_entitlement_card_per_household(household=original_household, household_representation=household) - - del individuals_to_create - return copy - - -def copy_household_fast(household: Household, program: Program, individuals: list[Individual]) -> Household: - copy = deepcopy(household) - original_household_id = household.id - original_head_of_household_id = household.head_of_household_id - original_unicef_id = household.unicef_id - copy.copied_from_id = original_household_id - copy.origin_unicef_id = original_unicef_id - copy.pk = None - copy.unicef_id = original_unicef_id - copy.program = program - copy.is_original = False - external_collectors_id_to_update = [] - individuals_to_create = [] - documents_to_create = [] - identities_to_create = [] - bank_account_info_to_create = [] - individuals_to_exclude_dict = { - str(x["copied_from_id"]): str(x["pk"]) - for x in Individual.original_and_repr_objects.filter( - copied_from_id__in=individuals, is_original=False, program=program - ).values("copied_from_id", "pk") - } - - for individual in individuals: - if str(individual.id) in individuals_to_exclude_dict: - external_collectors_id_to_update.append(individuals_to_exclude_dict[str(individual.id)]) - continue - ( - individual_to_create, - documents_to_create_batch, - identities_to_create_batch, - bank_account_info_to_create_batch, - ) = copy_individual_representation_fast(program, individual) - documents_to_create.extend(documents_to_create_batch) - identities_to_create.extend(identities_to_create_batch) - bank_account_info_to_create.extend(bank_account_info_to_create_batch) - individuals_to_create.append(individual_to_create) - individuals_dict = {i.copied_from_id: i for i in individuals_to_create} - Individual.objects.bulk_create(individuals_to_create) - Document.objects.bulk_create(documents_to_create) - IndividualIdentity.objects.bulk_create(identities_to_create) - BankAccountInfo.objects.bulk_create(bank_account_info_to_create) - if original_head_of_household_id in individuals_dict: - copy.head_of_household = individuals_dict[original_head_of_household_id] - else: - copy.head_of_household = get_individual_representation_per_program_by_old_individual_id( - program, original_head_of_household_id - ) - Household.objects.bulk_create([copy]) - ids_to_update = [x.pk for x in individuals_to_create] + external_collectors_id_to_update - Individual.original_and_repr_objects.filter(id__in=ids_to_update).update(household=copy) - - # copy_entitlement_card_per_household(household=original_household, household_representation=household) - - del individuals_to_create - return copy - - -def copy_individual_representation( - program: Program, - individual: Individual, -) -> Optional[Individual]: - """ - Copy individual into representation for given program if it does not exist yet. - Return existing representation if it exists. - """ - # copy representations only based on original individuals - if individual.is_original: - # if there is no representation of this individual in this program yet, copy the individual - if individual_representation := get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual.pk, - ): - return individual_representation - else: - return copy_individual(individual, program) - else: - return get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual.copied_from_id, - ) - - -def copy_individual_representation_fast( - program: Program, - individual: Individual, -) -> tuple: - """ - Copy individual into representation for given program if it does not exist yet. - Return existing representation if it exists. - """ - # copy representations only based on original individuals - if individual.is_original: - return copy_individual_fast(individual, program.id) - else: - raise Exception("Cannot copy representation of representation") - - -def copy_individual(individual: Individual, program: Program) -> Individual: - ( - individual_to_create, - documents_to_create, - identities_to_create, - bank_account_info_to_create, - ) = copy_individual_fast(individual, program.id) - (created_individual,) = Individual.objects.bulk_create([individual_to_create]) - Document.objects.bulk_create(documents_to_create) - IndividualIdentity.objects.bulk_create(identities_to_create) - BankAccountInfo.objects.bulk_create(bank_account_info_to_create) - return created_individual - - -def copy_individual_fast(individual: Individual, program_id: str) -> tuple: - documents = list(individual.documents(manager="original_and_repr_objects").all()) - identities = list(individual.identities(manager="original_and_repr_objects").all()) - bank_accounts_info = list(individual.bank_account_info(manager="original_and_repr_objects").all()) - - copy = deepcopy(individual) - - original_individual_id = individual.id - original_unicef_id = individual.unicef_id - copy.copied_from_id = original_individual_id - copy.origin_unicef_id = original_unicef_id - copy.pk = None - copy.unicef_id = original_unicef_id - copy.program_id = program_id - copy.household = None - copy.is_original = False - documents_to_create = copy_document_per_individual_fast(documents, copy) - identities_to_create = copy_individual_identity_per_individual_fast(identities, copy) - bank_account_info_to_create = copy_bank_account_info_per_individual_fast(bank_accounts_info, copy) - return copy, documents_to_create, identities_to_create, bank_account_info_to_create - - -def copy_roles(households: QuerySet, program: Program) -> None: - # filter only original roles - roles_ids = list( - IndividualRoleInHousehold.original_and_repr_objects.filter( - household__in=households, - individual__is_removed=False, - household__is_removed=False, - is_original=True, - ) - .exclude(copied_to__household__program=program) - .distinct("individual", "household") - .order_by("individual", "household") - .values_list("id", flat=True) - ) - - roles_count = len(roles_ids) - for batch_start in range(0, roles_count, BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logger.info(f"Handling {batch_start} - {batch_end}/{roles_count} roles") - roles_list = [] - roles_batch = IndividualRoleInHousehold.original_and_repr_objects.filter( - id__in=roles_ids[batch_start:batch_end] - ).select_related("individual", "household") - original_individual_ids = [role.individual_id for role in roles_batch] - original_household_ids = [role.household_id for role in roles_batch] - household_representations = Household.original_and_repr_objects.filter( - program=program, - copied_from_id__in=original_household_ids, - ).only("copied_from_id", "id") - individual_representations = Individual.original_and_repr_objects.filter( - program=program, - copied_from_id__in=original_individual_ids, - ).only("copied_from_id", "id") - household_representations_dict = { - household.copied_from_id: household for household in household_representations - } - individual_representation_dict = { - individual.copied_from_id: individual for individual in individual_representations - } - individuals_to_create_batch = [] - documents_to_create_batch = [] - identities_to_create_batch = [] - bank_account_info_to_create_batch = [] - for role in roles_batch: - household_representation = household_representations_dict[role.household_id] - individual_representation = individual_representation_dict.get(role.individual_id) - if not individual_representation: - ( - individual_representation, - documents_to_create_individual_batch, - identities_to_create_individual_batch, - bank_account_info_to_create_individual_batch, - ) = copy_individual_representation_fast(program=program, individual=role.individual) - individual_representation_dict[individual_representation.copied_from_id] = individual_representation - individuals_to_create_batch.append(individual_representation) - documents_to_create_batch.extend(documents_to_create_individual_batch) - identities_to_create_batch.extend(identities_to_create_individual_batch) - bank_account_info_to_create_batch.extend(bank_account_info_to_create_individual_batch) - - copy = deepcopy(role) - original_role_id = role.id - copy.copied_from_id = original_role_id - copy.pk = None - copy.household = household_representation - copy.individual = individual_representation - copy.is_original = False - roles_list.append(copy) - with transaction.atomic(): - Individual.objects.bulk_create(individuals_to_create_batch) - Document.objects.bulk_create(documents_to_create_batch) - IndividualIdentity.objects.bulk_create(identities_to_create_batch) - BankAccountInfo.objects.bulk_create(bank_account_info_to_create_batch) - IndividualRoleInHousehold.original_and_repr_objects.bulk_create(roles_list) - del roles_list - - -def copy_entitlement_card_per_household(household: Household, household_representation: Household) -> None: - entitlement_cards = household.entitlement_cards.all() - entitlement_cards_list = [] - for entitlement_card in entitlement_cards: - copy = deepcopy(entitlement_card) - original_entitlement_card_id = entitlement_card.id - copy.copied_from_id = original_entitlement_card_id - copy.pk = None - copy.household = household_representation - copy.is_original = False - entitlement_cards_list.append(copy) - EntitlementCard.original_and_repr_objects.bulk_create(entitlement_cards_list) - del entitlement_cards_list - - -def copy_document_per_individual_fast( - documents: List[Document], individual_representation: Individual -) -> List[Document]: - """ - Clone document for individual if new individual_representation has been created. - """ - documents_list = [] - for document in documents: - copy = deepcopy(document) - original_document_id = document.id - copy.copied_from_id = original_document_id - copy.pk = None - copy.individual = individual_representation - copy.program_id = individual_representation.program_id - copy.is_original = False - documents_list.append(copy) - return documents_list - - -def copy_individual_identity_per_individual_fast( - identities: List[IndividualIdentity], individual_representation: Individual -) -> List[IndividualIdentity]: - """ - Clone individual_identity for individual if new individual_representation has been created. - """ - identities_list = [] - for identity in identities: - copy = deepcopy(identity) - original_identity_id = identity.id - copy.copied_from_id = original_identity_id - copy.pk = None - copy.individual = individual_representation - copy.is_original = False - identities_list.append(copy) - return identities_list - - -def copy_bank_account_info_per_individual_fast( - bank_accounts_info: List[BankAccountInfo], individual_representation: Individual -) -> List[BankAccountInfo]: - """ - Clone bank_account_info for individual if new individual_representation has been created. - """ - bank_accounts_info_list = [] - for bank_account_info in bank_accounts_info: - copy = deepcopy(bank_account_info) - copy.copied_from_id = bank_account_info.id - copy.pk = None - copy.individual = individual_representation - copy.is_original = False - bank_accounts_info_list.append(copy) - return bank_accounts_info_list - - -def copy_document_per_individual(documents: List[Document], individual_representation: Individual) -> None: - """ - Clone document for individual if new individual_representation has been created. - """ - - Document.original_and_repr_objects.bulk_create( - copy_document_per_individual_fast(documents, individual_representation) - ) - - -def copy_individual_identity_per_individual( - identities: List[IndividualIdentity], individual_representation: Individual -) -> None: - """ - Clone individual_identity for individual if new individual_representation has been created. - """ - IndividualIdentity.original_and_repr_objects.bulk_create( - copy_individual_identity_per_individual_fast(identities, individual_representation) - ) - - -def copy_bank_account_info_per_individual( - bank_accounts_info: List[BankAccountInfo], individual_representation: Individual -) -> None: - """ - Clone bank_account_info for individual if new individual_representation has been created. - """ - BankAccountInfo.original_and_repr_objects.bulk_create( - copy_bank_account_info_per_individual_fast(bank_accounts_info, individual_representation) - ) - - -def copy_household_selections(household_selections: QuerySet, program: Program) -> None: - """ - Copy HouseholdSelections to new households representations. By this TargetPopulations are adjusted. - Because TargetPopulation is per program, HouseholdSelections are per program. - """ - household_selections_ids = list( - household_selections.filter(household__is_removed=False).values_list("id", flat=True) - ) - - for batch_start in range(0, len(household_selections_ids), BATCH_SIZE): - batched_ids = household_selections_ids[batch_start : batch_start + BATCH_SIZE] - batched_household_selections = HouseholdSelection.original_and_repr_objects.filter(id__in=batched_ids) - logger.info(f"Copying household selections {batch_start} of {len(household_selections_ids)}") - household_selections_to_create = [] - household_ids = [x.household_id for x in batched_household_selections] - household_representations = Household.original_and_repr_objects.filter( - program=program, copied_from__in=household_ids - ).values("id", "copied_from") - household_representations_dict = {x["copied_from"]: x["id"] for x in household_representations} - for household_selection in batched_household_selections: - copy = deepcopy(household_selection) - copy.pk = None - copy.household_id = household_representations_dict[household_selection.household_id] - copy.is_original = False - household_selections_to_create.append(copy) - - with transaction.atomic(): - HouseholdSelection.original_and_repr_objects.bulk_create(household_selections_to_create) - HouseholdSelection.original_and_repr_objects.filter( - id__in=batched_household_selections.values_list("id", flat=True) - ).update(is_migration_handled=True) - - -def handle_rdis(rdis: QuerySet, program: Program, hhs_to_ignore: Optional[QuerySet] = None) -> None: - rdis_count = rdis.count() - for i, rdi in enumerate(rdis): - if i % 100 == 0: - logger.info(f"Handling {i} - {i + 99}/{rdis_count} RDIs") - rdi_households = ( - rdi.households(manager="original_and_repr_objects") - .filter(is_original=True, withdrawn=False) - .exclude(copied_to__program=program) - ) - if hhs_to_ignore: - rdi_households = rdi_households.exclude(id__in=hhs_to_ignore) - rdi_households_ids = list(rdi_households.values_list("id", flat=True)) - households_count = len(rdi_households_ids) - for batch_start in range(0, households_count, BATCH_SIZE_SMALL): - batch_end = batch_start + BATCH_SIZE_SMALL - logger.info(f"Copying {batch_start} - {batch_end}/{households_count} households for RDI") - household_dict = {} - batched_household_ids = rdi_households_ids[batch_start:batch_end] - batched_households = Household.original_and_repr_objects.filter(id__in=batched_household_ids) - with transaction.atomic(): - individuals_per_household_dict = defaultdict(list) - for individual in Individual.original_and_repr_objects.filter(household__in=batched_households): - individuals_per_household_dict[individual.household_id].append(individual) - for household in batched_households: - household_original_id = household.pk - household_representation = copy_household_representation_for_programs_fast( - household, - program, - individuals_per_household_dict[household_original_id], - ) - household_dict[household_original_id] = household_representation - - copy_roles_from_dict(household_dict, program) # type: ignore - - rdis.filter(program__isnull=True).update(program=program) - - -def handle_non_program_objects( - business_area: BusinessArea, - hhs_to_ignore: Optional[QuerySet] = None, - unknown_unassigned_program: Optional[Program] = None, -) -> None: - households = Household.original_and_repr_objects.filter( - business_area=business_area, copied_to__isnull=True, is_original=True - ).order_by("pk") - if hhs_to_ignore: - households = households.exclude(id__in=hhs_to_ignore) - collecting_types_from_charfield = ( - households.values_list("collect_individual_data", flat=True).distinct().order_by("pk") - ) - - for collecting_type in collecting_types_from_charfield: - program = create_program_with_matching_collecting_type( - business_area, collecting_type, unknown_unassigned_program - ) - households_with_collecting_type = households.filter(collect_individual_data=collecting_type) - - # Handle rdis before copying households so households query is not changed yet - RegistrationDataImport.objects.filter( - households__in=households_with_collecting_type, - program__isnull=True, - ).update(program=program) - - logger.info(f"Handling households with collecting type {collecting_type}") - households_with_collecting_type_ids = list(households_with_collecting_type.values_list("id", flat=True)) - household_count = len(households_with_collecting_type_ids) - logger.info(f"Households with collecting type {collecting_type}: {household_count}") - for batch_start in range(0, household_count, BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logger.info( - f"Copying {batch_start} - {batch_end}/{household_count} " - f"households to program with collect_individual_data {collecting_type}" - ) - household_dict = {} - with transaction.atomic(): - individuals_per_household_dict = defaultdict(list) - households_ids_batch = households_with_collecting_type_ids[batch_start:batch_end] - batched_households = Household.original_and_repr_objects.filter(id__in=households_ids_batch) - for individual in Individual.original_and_repr_objects.filter(household_id__in=households_ids_batch): - individuals_per_household_dict[individual.household_id].append(individual) - for household in batched_households: - household_original_id = household.pk - household_representation = copy_household_fast( - household, - program, - individuals_per_household_dict[household_original_id], - ) - household_dict[household_original_id] = household_representation - - copy_roles_from_dict(household_dict, program) - - -def create_program_with_matching_collecting_type( - business_area: BusinessArea, - collecting_type: DataCollectingType, - unknown_unassigned_program: Optional[Program] = None, -) -> Program: - if collecting_type == COLLECT_TYPE_FULL: - program_collecting_type = DataCollectingType.objects.get(code="full_collection") - elif collecting_type == COLLECT_TYPE_PARTIAL: - program_collecting_type = DataCollectingType.objects.get(code="partial_individuals") - elif collecting_type == COLLECT_TYPE_SIZE_ONLY: - program_collecting_type = DataCollectingType.objects.get(code="size_only") - elif collecting_type == COLLECT_TYPE_NONE: - program_collecting_type = DataCollectingType.objects.get(code="size_age_gender_disaggregated") - elif collecting_type == COLLECT_TYPE_UNKNOWN: - if unknown_unassigned_program: - return unknown_unassigned_program - program_collecting_type, _ = DataCollectingType.objects.get_or_create( - code="unknown", - label="Unknown", - defaults={"description": "Unknown", "deprecated": True}, - ) - else: # in case there are some deprecated collecting types - program_collecting_type = None - return create_storage_program_for_collecting_type(business_area, program_collecting_type) - - -def copy_roles_from_dict(household_dict: dict[Any, Household], program: Program) -> None: - roles = ( - IndividualRoleInHousehold.original_and_repr_objects.filter( - household__id__in=household_dict.keys(), - individual__is_removed=False, - household__is_removed=False, - is_original=True, - ) - .exclude(copied_to__household__program=program) - .order_by("pk") - ) - - roles_to_create = [] - for role in roles: - household_representation = household_dict[role.household_id] - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=role.individual_id, - ) - if not individual_representation: - individual_representation = copy_individual_representation(program=program, individual=role.individual) - copy = deepcopy(role) - copy.copied_from_id = role.id - copy.pk = None - copy.household = household_representation - copy.individual = individual_representation - copy.is_original = False - roles_to_create.append(copy) - - IndividualRoleInHousehold.original_and_repr_objects.bulk_create(roles_to_create) - - -def create_storage_program_for_collecting_type( - business_area: BusinessArea, collecting_type: Optional[DataCollectingType] = None -) -> Program: - return Program.all_objects.get_or_create( - name=(f"Storage program - COLLECTION TYPE {collecting_type.label}" if collecting_type else "Storage program"), - data_collecting_type=collecting_type, - business_area=business_area, - defaults={ - "status": Program.DRAFT, - "start_date": timezone.now(), - "end_date": timezone.datetime.max, - "budget": 0, - "frequency_of_payments": Program.ONE_OFF, - "sector": Program.CHILD_PROTECTION, - "scope": Program.SCOPE_FOR_PARTNERS, - "cash_plus": True, - "population_goal": 1, - "is_visible": False, - }, - )[0] - - -def apply_congo_withdrawal() -> None: - logger.info("Applying Congo custom withdrawal rules") - business_area_congo = BusinessArea.objects.get(name="Democratic Republic of Congo") - csv_congo_withdraw = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "files", - "data_migration_gpf", - "congo_to_withdraw.csv", - ) - rdis_names = [] - with open(csv_congo_withdraw, mode="r", newline="") as csvfile: - reader = csv.reader(csvfile, delimiter=";") - for row in reader: - rdis_names.append(row[0]) - untargetted_hhs = ( - Household.original_and_repr_objects.filter( - is_original=True, - selections__isnull=True, - registration_data_import__name__in=rdis_names, - registration_data_import__business_area=business_area_congo, - ) - .only("id") - .distinct() - ) - Household.original_and_repr_objects.filter(copied_from__id__in=untargetted_hhs).update(withdrawn=True) - - -def get_ignored_hhs() -> QuerySet: - business_area_afg = BusinessArea.objects.get(name="Afghanistan") - csv_afg_ignore = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "files", - "data_migration_gpf", - "afg_to_ignore.csv", - ) - rdis_names = [] - with open(csv_afg_ignore, mode="r", newline="") as csvfile: - reader = csv.reader(csvfile, delimiter=";") - for row in reader: - rdis_names.append(row[0]) - - return Household.original_and_repr_objects.filter( - is_original=True, - selections__isnull=True, - registration_data_import__name__in=rdis_names, - registration_data_import__business_area=business_area_afg, - ).values_list("id", flat=True) - - -def get_unknown_unassigned_dict() -> Dict: - unknown_unassigned_dict = {} - unknown_unassigned_program = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "files", - "data_migration_gpf", - "unknown_unassigned_program.csv", - ) - with open(unknown_unassigned_program, mode="r", newline="") as csvfile: - reader = csv.reader(csvfile, delimiter=";") - next(reader) # skip header - for row in reader: - business_area = BusinessArea.objects.get(name=row[0]) - program = Program.objects.filter(name=row[1], business_area=business_area).first() - if program: - unknown_unassigned_dict[business_area] = program - return unknown_unassigned_dict - - -def copy_individual_sync(individuals_ids: List) -> None: - individuals_to_create = [] - documents_to_create = [] - identities_to_create = [] - bank_account_info_to_create = [] - for individual in ( - Individual.original_and_repr_objects.filter(id__in=individuals_ids) - .select_related("household") - .iterator(chunk_size=10000) - ): - programs = ( - individual.represented_households(manager="original_and_repr_objects") - .all() - .values_list("program", flat=True) - ) - if individual.household: - programs = chain( - individual.household.copied_to(manager="original_and_repr_objects") - .all() - .values_list("program", flat=True), - programs, - ) - household = individual.household - for program_id in programs: - ( - individual_to_create, - documents_to_create_batch, - identities_to_create_batch, - bank_account_info_to_create_batch, - ) = copy_individual_fast(individual, program_id) - if household: - household_representation = ( - household.copied_to(manager="original_and_repr_objects").filter(program_id=program_id).first() - ) - individual_to_create.household = household_representation - documents_to_create.extend(documents_to_create_batch) - identities_to_create.extend(identities_to_create_batch) - bank_account_info_to_create.extend(bank_account_info_to_create_batch) - individuals_to_create.append(individual_to_create) - - Individual.objects.bulk_create(individuals_to_create) - Document.objects.bulk_create(documents_to_create) - IndividualIdentity.objects.bulk_create(identities_to_create) - BankAccountInfo.objects.bulk_create(bank_account_info_to_create) - - -def copy_roles_sync(roles_ids: List) -> None: - roles_to_create = [] - for role in IndividualRoleInHousehold.original_and_repr_objects.filter(id__in=roles_ids): - programs = role.household.copied_to(manager="original_and_repr_objects").values_list("program", flat=True) - for program in programs: - household_representation = role.household.copied_to - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=role.individual_id, - ) - if not individual_representation: - individual_representation = copy_individual(individual=role.individual, program=program) - - copy = deepcopy(role) - copy.copied_from_id = role.id - copy.pk = None - copy.household = household_representation - copy.individual = individual_representation - copy.is_original = False - roles_to_create.append(copy) - - IndividualRoleInHousehold.original_and_repr_objects.bulk_create(roles_to_create) diff --git a/src/hct_mis_api/one_time_scripts/migrate_everything_to_representations.py b/src/hct_mis_api/one_time_scripts/migrate_everything_to_representations.py deleted file mode 100644 index 3a93bb96f0..0000000000 --- a/src/hct_mis_api/one_time_scripts/migrate_everything_to_representations.py +++ /dev/null @@ -1,34 +0,0 @@ -import time - -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.household.models import Individual -from hct_mis_api.one_time_scripts.create_hh_and_ind_collections import ( - create_hh_and_ind_collections, -) -from hct_mis_api.one_time_scripts.migrate_data_to_representations import ( - migrate_data_to_representations_per_business_area, -) -from hct_mis_api.one_time_scripts.migrate_files_to_representations import ( - migrate_files_to_representations_per_business_area, -) -from hct_mis_api.one_time_scripts.migrate_grievance_to_representations import ( - migrate_grievance_to_representations_per_business_area, -) - - -def migrate_everything_to_representations_per_ba(ba_slug: str) -> None: - start_time = time.time() - ba = BusinessArea.objects.get(slug=ba_slug) - print(f"STARTING MIGRATION FOR {ba.slug}" + "-" * 50) - create_hh_and_ind_collections(ba) - print(f"FINISHED CREATING COLLECTIONS FOR {ba.slug}" + "-" * 50) - migrate_data_to_representations_per_business_area(ba) - print(f"FINISHED MIGRATING DATA FOR {ba.slug}" + "-" * 50) - migrate_files_to_representations_per_business_area(ba) - print(f"FINISHED MIGRATING FILES FOR {ba.slug}" + "-" * 50) - migrate_grievance_to_representations_per_business_area(ba) - print(f"FINISHED MIGRATING GRIEVANCES FOR {ba.slug}" + "-" * 50) - print( - f"FINISHED MIGRATION FOR {ba.slug} in {time.time() - start_time} for {Individual.original_and_repr_objects.filter(business_area__slug=ba_slug).exclude(copied_from=None).count()} individuals" - + "-" * 50 - ) diff --git a/src/hct_mis_api/one_time_scripts/migrate_files_to_representations.py b/src/hct_mis_api/one_time_scripts/migrate_files_to_representations.py deleted file mode 100644 index 100af09914..0000000000 --- a/src/hct_mis_api/one_time_scripts/migrate_files_to_representations.py +++ /dev/null @@ -1,118 +0,0 @@ -import logging -import os -from typing import Any - -from django.core.files.base import ContentFile - -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.grievance.models import GrievanceDocument -from hct_mis_api.apps.household.models import Document, Household, Individual - -logger = logging.getLogger(__name__) - -BATCH_SIZE = 500 - - -def migrate_files_to_representations() -> None: - for business_area in BusinessArea.objects.all(): - logger.info(f"Migrating files for business area: {business_area.name}") - migrate_files_to_representations_per_business_area(business_area) - - -def migrate_files_to_representations_per_business_area(business_area: BusinessArea) -> None: - migrate_grievance_document_files(business_area) - migrate_document_files(business_area) - migrate_individual_files(business_area) - migrate_household_files(business_area) - - -def copy_file(instance: Any, file_field: str) -> None: - try: - name_and_extension = os.path.splitext(getattr(instance, file_field).name) - new_file = ContentFile(getattr(instance, file_field).read()) - new_file.name = f"{name_and_extension[0]}{instance.id}{name_and_extension[1]}" - setattr(instance, file_field, new_file) - instance.save() - except Exception: - logger.info(f"Failed to copy file for {instance.__class__.__name__}: {instance.id}") - - -def migrate_grievance_document_files(business_area: BusinessArea) -> None: - logger.info(f"Migrating grievance document files for business area: {business_area.name}") - grievance_document_ids = list( - GrievanceDocument.objects.filter( - grievance_ticket__is_original=False, - grievance_ticket__business_area=business_area, - ) - .exclude(file="") - .values_list("id", flat=True) - ) - for batch_start in range(0, len(grievance_document_ids), BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logging.info( - f"{business_area.name}: Grievance document batch {batch_start}-{batch_end}/{len(grievance_document_ids)}" - ) - batched_ids = grievance_document_ids[batch_start:batch_end] - grievance_documents = list(GrievanceDocument.objects.filter(id__in=batched_ids)) - for grievance_document in grievance_documents: - copy_file(grievance_document, "file") - - -def migrate_document_files(business_area: BusinessArea) -> None: - logger.info(f"Migrating document files for business area: {business_area.name}") - document_ids = list( - Document.original_and_repr_objects.filter( - individual__business_area=business_area, - copied_from__isnull=False, - ) - .exclude(photo="") - .values_list("id", flat=True) - ) - for batch_start in range(0, len(document_ids), BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logging.info(f"{business_area.name}: Document batch {batch_start}-{batch_end}/{len(document_ids)}") - batched_ids = document_ids[batch_start:batch_end] - documents = list(Document.original_and_repr_objects.filter(id__in=batched_ids)) - for document in documents: - copy_file(document, "photo") - - -def migrate_individual_files(business_area: BusinessArea) -> None: - logger.info(f"Migrating individual files for business area: {business_area.name}") - individual_ids = list( - Individual.original_and_repr_objects.filter( - is_original=False, - business_area=business_area, - ) - .exclude(photo="", disability_certificate_picture="") - .values_list("id", flat=True) - ) - for batch_start in range(0, len(individual_ids), BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logging.info(f"{business_area.name}: Individual batch {batch_start}-{batch_end}/{len(individual_ids)}") - batched_ids = individual_ids[batch_start:batch_end] - individuals = list(Individual.original_and_repr_objects.filter(id__in=batched_ids)) - for individual in individuals: - if individual.photo: - copy_file(individual, "photo") - if individual.disability_certificate_picture: - copy_file(individual, "disability_certificate_picture") - - -def migrate_household_files(business_area: BusinessArea) -> None: - logger.info(f"Migrating household files for business area: {business_area.name}") - household_ids = list( - Household.original_and_repr_objects.filter( - is_original=False, - business_area=business_area, - ) - .exclude(consent_sign="") - .values_list("id", flat=True) - ) - for batch_start in range(0, len(household_ids), BATCH_SIZE): - batch_end = batch_start + BATCH_SIZE - logging.info(f"{business_area.name}: Household batch {batch_start}-{batch_end}/{len(household_ids)}") - batched_ids = household_ids[batch_start:batch_end] - households = list(Household.original_and_repr_objects.filter(id__in=batched_ids)) - for household in households: - copy_file(household, "consent_sign") diff --git a/src/hct_mis_api/one_time_scripts/migrate_grievance_for_sync.py b/src/hct_mis_api/one_time_scripts/migrate_grievance_for_sync.py deleted file mode 100644 index 8532303a65..0000000000 --- a/src/hct_mis_api/one_time_scripts/migrate_grievance_for_sync.py +++ /dev/null @@ -1,2070 +0,0 @@ -import copy -import logging -from itertools import chain -from typing import Any, Optional, Union - -from django.db.models import Count, OuterRef, Q, QuerySet, Subquery -from django.utils import timezone - -from hct_mis_api.apps.accountability.models import Feedback, FeedbackMessage, Message -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.core.utils import decode_id_string, encode_id_base64 -from hct_mis_api.apps.grievance.models import ( - GrievanceDocument, - GrievanceTicket, - GrievanceTicketThrough, - TicketAddIndividualDetails, - TicketComplaintDetails, - TicketDeleteHouseholdDetails, - TicketDeleteIndividualDetails, - TicketHouseholdDataUpdateDetails, - TicketIndividualDataUpdateDetails, - TicketNeedsAdjudicationDetails, - TicketNegativeFeedbackDetails, - TicketNote, - TicketPaymentVerificationDetails, - TicketPositiveFeedbackDetails, - TicketReferralDetails, - TicketSensitiveDetails, - TicketSystemFlaggingDetails, -) -from hct_mis_api.apps.household.models import ( - BankAccountInfo, - Document, - Household, - Individual, - IndividualIdentity, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.payment.models import Payment, PaymentRecord -from hct_mis_api.apps.program.models import Program -from hct_mis_api.one_time_scripts.migrate_data_to_representations import ( - get_household_representation_per_program_by_old_household_id, - get_individual_representation_per_program_by_old_individual_id, -) - -logger = logging.getLogger(__name__) - -BATCH_SIZE = 100 - -ticket_grievance_ticket_field_name_mapping = { - TicketComplaintDetails: "complaint_ticket_details", - TicketSensitiveDetails: "sensitive_ticket_details", - TicketPaymentVerificationDetails: "payment_verification_ticket_details", - TicketIndividualDataUpdateDetails: "individual_data_update_ticket_details", - TicketHouseholdDataUpdateDetails: "household_data_update_ticket_details", - TicketAddIndividualDetails: "add_individual_ticket_details", - TicketDeleteIndividualDetails: "delete_individual_ticket_details", - TicketDeleteHouseholdDetails: "delete_household_ticket_details", - TicketSystemFlaggingDetails: "system_flagging_ticket_details", - TicketPositiveFeedbackDetails: "positive_feedback_ticket_details", - TicketNegativeFeedbackDetails: "negative_feedback_ticket_details", - TicketReferralDetails: "referral_ticket_details", - TicketNeedsAdjudicationDetails: "needs_adjudication_ticket_details", -} - - -def migrate_grievance_to_representations() -> None: - """ - Migrate grievance tickets and feedback into representations. - """ - model_list = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketPaymentVerificationDetails, - TicketIndividualDataUpdateDetails, - TicketHouseholdDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, - TicketNeedsAdjudicationDetails, - GrievanceTicket, - TicketNote, - GrievanceDocument, - Message, - Feedback, - FeedbackMessage, - ] - for model in model_list: - model._meta.get_field("created_at").auto_now_add = False - try: - migrate_grievance_tickets() - migrate_messages() - migrate_feedback() - migrate_linked_tickets() - finally: - for model in model_list: - model._meta.get_field("created_at").auto_now_add = True - - -def migrate_grievance_to_representations_per_business_area(business_area: Optional[BusinessArea] = None) -> None: - """ - Migrate grievance tickets and feedback into representations per business area. - """ - model_list = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketPaymentVerificationDetails, - TicketIndividualDataUpdateDetails, - TicketHouseholdDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, - TicketNeedsAdjudicationDetails, - GrievanceTicket, - TicketNote, - GrievanceDocument, - Message, - Feedback, - FeedbackMessage, - ] - for model in model_list: - model._meta.get_field("created_at").auto_now_add = False - try: - migrate_grievance_tickets(business_area) - migrate_messages(business_area) - migrate_feedback(business_area) - migrate_linked_tickets(business_area) - finally: - for model in model_list: - model._meta.get_field("created_at").auto_now_add = True - - -def migrate_grievance_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Migrate grievance tickets into representations. - """ - # logger.info("Handle payment related tickets") - # handle_payment_related_tickets() - logger.info("Handle non payment related tickets") - handle_non_payment_related_tickets(business_area) - logger.info("Handle tickets not connected to any program") - handle_non_program_tickets(business_area) - - -def handle_non_payment_related_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Copy grievance tickets to representations. - Applied for tickets not connected to specific payment but connected to household or its individual. - """ - logger.info("Handle TicketComplaintDetails without payment") - handle_complaint_tickets_without_payments(business_area) - logger.info("Handle TicketSensitiveDetails without payment") - handle_sensitive_tickets_without_payments(business_area) - logger.info("Handle TicketHouseholdDataUpdateDetails") - handle_household_data_update_tickets(business_area) - logger.info("Handle TicketIndividualDataUpdateDetails") - handle_individual_data_update_tickets(business_area) - logger.info("Handle TicketAddIndividualDetails") - handle_add_individual_tickets(business_area) - logger.info("Handle TicketDeleteIndividualDetails") - handle_delete_individual_tickets(business_area) - logger.info("Handle TicketDeleteHouseholdDetails") - handle_delete_household_tickets(business_area) - logger.info("Handle TicketSystemFlaggingDetails") - handle_system_flagging_details_tickets(business_area) - logger.info("Handle TicketPositiveFeedbackDetails") - handle_positive_feedback_tickets(business_area) - logger.info("Handle TicketNegativeFeedbackDetails") - handle_negative_feedback_tickets(business_area) - logger.info("Handle TicketReferralDetails") - handle_referral_tickets(business_area) - logger.info("Handle TicketNeedsAdjudicationDetails") - handle_needs_adjudication_tickets(business_area) - - -def handle_complaint_tickets_without_payments(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - complaint_tickets_without_payments = TicketComplaintDetails.objects.select_related( - "ticket", - "household", - "individual", - ).filter( - payment_object_id__isnull=True, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_closed_tickets_with_household_and_individual(complaint_tickets_without_payments, TicketComplaintDetails) - handle_active_tickets_with_household_and_individual(complaint_tickets_without_payments, TicketComplaintDetails) - - complaint_tickets_without_payments_representations = TicketComplaintDetails.objects.filter( - payment_object_id__isnull=True, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_bulk_update_representations_household_unicef_id( - complaint_tickets_without_payments_representations, TicketComplaintDetails - ) - - -def handle_sensitive_tickets_without_payments(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - sensitive_tickets_without_payments = TicketSensitiveDetails.objects.select_related( - "ticket", - "household", - "individual", - ).filter( - payment_object_id__isnull=True, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_closed_tickets_with_household_and_individual(sensitive_tickets_without_payments, TicketSensitiveDetails) - handle_active_tickets_with_household_and_individual(sensitive_tickets_without_payments, TicketSensitiveDetails) - - sensitive_tickets_without_payments_representations = TicketSensitiveDetails.objects.filter( - payment_object_id__isnull=True, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_bulk_update_representations_household_unicef_id( - sensitive_tickets_without_payments_representations, TicketSensitiveDetails - ) - - -def handle_closed_tickets_with_household_and_individual(tickets: QuerySet, ticket_class: Any) -> None: - """ - In case of closed complaint ticket, we need to copy the ticket to random representation of assigned - household/individual. - """ - logger.info("Handle closed tickets with household and individual") - closed_tickets = tickets.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = ticket_class.objects.filter(id__in=batched_ids).select_related( - "ticket", "household", "individual" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - household_representation = None - individual_representation = None - program = None - if closed_ticket.household: - if household_representation := closed_ticket.household.copied_to.first(): - program = household_representation.program - if closed_ticket.individual: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=closed_ticket.individual, - ) - elif closed_ticket.individual: - if individual_representation := closed_ticket.individual.copied_to.first(): - program = individual_representation.program - if program: - ( - ticket_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - ) = copy_closed_ticket_with_household_and_individual( - closed_ticket, program, household_representation, individual_representation - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, ticket_class) - - -def copy_closed_ticket_with_household_and_individual( - closed_ticket: Any, - program: Program, - household_representation: Optional[Household] = None, - individual_representation: Optional[Individual] = None, -) -> tuple: - ticket_copy = copy.deepcopy(closed_ticket) - ticket_copy.pk = None - ticket_copy.household = household_representation - ticket_copy.individual = individual_representation - - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, program, closed_ticket - ) - return ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_active_tickets_with_household_and_individual(tickets: QuerySet, ticket_class: Any) -> None: - """ - For active complaint tickets, we need to copy tickets for every household/individual representation - """ - logger.info("Handle active tickets with household and individual") - active_tickets = tickets.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = ticket_class.objects.filter(id__in=batched_ids).select_related( - "ticket", "household", "individual" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - if active_ticket.individual: - individual_representations = active_ticket.individual.copied_to.all() - else: - individual_representations = Individual.original_and_repr_objects.none() - if active_ticket.household: - household_representations = active_ticket.household.copied_to(manager="original_and_repr_objects").all() - else: - household_representations = Household.original_and_repr_objects.none() - - if individual_representations or household_representations: - individual_programs = individual_representations.values_list("program", flat=True).distinct() - household_programs = household_representations.values_list("program", flat=True).distinct() - - all_programs = household_programs.union(individual_programs) - - for program in all_programs: - ( - ticket_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - ) = copy_active_ticket_with_household_and_individual(active_ticket, program) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, ticket_class) - - -def copy_active_ticket_with_household_and_individual(active_ticket: Any, program: Program) -> tuple: - ticket_copy = copy.deepcopy(active_ticket) - ticket_copy.pk = None - if ticket_copy.household: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=ticket_copy.household, - ) - ticket_copy.household = household_representation - - if ticket_copy.individual: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ticket_copy.individual, - ) - ticket_copy.individual = individual_representation - - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, program, active_ticket - ) - return ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_tickets_with_household(model: Any, business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_hh = model.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - logger.info(f"Tickets to handle: {tickets_with_hh.count()}") - - # Handle closed tickets - copy only for 1 random representation - closed_tickets = tickets_with_hh.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - closed_batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = model.objects.filter(id__in=closed_batched_ids).select_related("ticket", "household") - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if household_representation := closed_ticket.household.copied_to.first(): - program = household_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - closed_ticket, program, household_representation=household_representation - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - # Handle active tickets - copy for all representations - active_tickets = tickets_with_hh.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - active_batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = model.objects.filter(id__in=active_batched_ids).select_related("ticket", "household") - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - household_representations = active_ticket.household.copied_to.all() - household_programs = household_representations.values_list("program", flat=True).distinct() - - for program in household_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - active_ticket, program - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - tickets_with_hh_representation = model.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs) - handle_bulk_update_representations_household_unicef_id( - tickets_with_hh_representation, - model, - ) - - -def handle_tickets_delete_household_details(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_hh = TicketDeleteHouseholdDetails.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - logger.info(f"Tickets to handle: {tickets_with_hh.count()}") - - # Handle closed tickets - copy only for 1 random representation - closed_tickets = tickets_with_hh.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - closed_batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = TicketDeleteHouseholdDetails.objects.filter(id__in=closed_batched_ids).select_related( - "ticket", "household", "reason_household" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if household_representation := closed_ticket.household.copied_to.first(): - program = household_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - closed_ticket, program, household_representation=household_representation - ) - ticket_copy.reason_household = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=closed_ticket.reason_household, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketDeleteHouseholdDetails - ) - - # Handle active tickets - copy for all representations - active_tickets = tickets_with_hh.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - active_batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = TicketDeleteHouseholdDetails.objects.filter(id__in=active_batched_ids).select_related( - "ticket", "household", "reason_household" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - household_representations = active_ticket.household.copied_to.all() - household_programs = household_representations.values_list("program", flat=True).distinct() - - for program in household_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - active_ticket, program - ) - ticket_copy.reason_household = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=active_ticket.reason_household, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketDeleteHouseholdDetails - ) - - tickets_with_hh_representation = TicketDeleteHouseholdDetails.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs) - handle_bulk_update_representations_household_unicef_id( - tickets_with_hh_representation, - TicketDeleteHouseholdDetails, - ) - - -def copy_ticket_with_household( - active_ticket: Any, program: Program, household_representation: Optional[Household] = None -) -> tuple: - ticket = copy.deepcopy(active_ticket) - if hasattr(ticket, "role_reassign_data"): - ticket = handle_role_reassign_data(ticket, program) - if not household_representation: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=ticket.household, - ) - ticket.household = household_representation - - ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket(ticket, program, active_ticket) - return ticket, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_tickets_with_individual( - model: Any, individual_field_name: str = "individual", business_area: Optional[BusinessArea] = None -) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_ind = model.objects.select_related( - "ticket", - individual_field_name, - ).filter( - **{f"{individual_field_name}__isnull": False}, - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - logger.info(f"Tickets to handle: {tickets_with_ind.count()}") - - # Handle closed tickets - closed_tickets = tickets_with_ind.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - for batch_start in range(0, len(closed_tickets_ids), BATCH_SIZE): - batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = model.objects.select_related("ticket", individual_field_name).filter(id__in=batched_ids) - logger.info(f"Handling closed tickets with individual: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if individual_representation := (getattr(closed_ticket, individual_field_name).copied_to.first()): - program = individual_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_individual( - closed_ticket, - program, - individual_field_name=individual_field_name, - individual_representation=individual_representation, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - # Handle active tickets - active_tickets = tickets_with_ind.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, len(active_tickets_ids), BATCH_SIZE): - batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = model.objects.select_related("ticket", individual_field_name).filter(id__in=batched_ids) - logger.info(f"Handling active tickets with individual: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - individual_representations = getattr(active_ticket, individual_field_name).copied_to.all() - individual_programs = individual_representations.values_list("program", flat=True).distinct() - - for program in individual_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_individual( - active_ticket, program, individual_field_name=individual_field_name - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - -def copy_ticket_with_individual( - active_ticket: Any, - program: Program, - individual_field_name: str, - individual_representation: Optional[Individual] = None, -) -> tuple: - ticket = copy.deepcopy(active_ticket) - if hasattr(ticket, "role_reassign_data"): - ticket = handle_role_reassign_data(ticket, program) - if hasattr(active_ticket, "individual_data") and isinstance(active_ticket, TicketIndividualDataUpdateDetails): - ticket = handle_individual_data(ticket, program) - if not individual_representation: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=getattr(ticket, individual_field_name), - ) - setattr(ticket, individual_field_name, individual_representation) - - ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket(ticket, program, active_ticket) - return ticket, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_individual_data_update_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual(TicketIndividualDataUpdateDetails, business_area=business_area) - - -def handle_household_data_update_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_household(TicketHouseholdDataUpdateDetails, business_area=business_area) - - -def handle_add_individual_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_household(TicketAddIndividualDetails, business_area=business_area) - - -def handle_delete_individual_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual(TicketDeleteIndividualDetails, business_area=business_area) - - -def handle_delete_household_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_delete_household_details(business_area=business_area) - - -def handle_system_flagging_details_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual( - TicketSystemFlaggingDetails, individual_field_name="golden_records_individual", business_area=business_area - ) - - -def handle_positive_feedback_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - positive_feedback_tickets = TicketPositiveFeedbackDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(positive_feedback_tickets, TicketPositiveFeedbackDetails) - handle_active_tickets_with_household_and_individual(positive_feedback_tickets, TicketPositiveFeedbackDetails) - - positive_feedback_tickets_representations = TicketPositiveFeedbackDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_bulk_update_representations_household_unicef_id( - positive_feedback_tickets_representations, - TicketPositiveFeedbackDetails, - ) - - -def handle_negative_feedback_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - negative_feedback_tickets = TicketNegativeFeedbackDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(negative_feedback_tickets, TicketNegativeFeedbackDetails) - handle_active_tickets_with_household_and_individual(negative_feedback_tickets, TicketNegativeFeedbackDetails) - - negative_feedback_tickets_representations = TicketNegativeFeedbackDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_bulk_update_representations_household_unicef_id( - negative_feedback_tickets_representations, - TicketNegativeFeedbackDetails, - ) - - -def handle_referral_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - referral_tickets = TicketReferralDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(referral_tickets, TicketReferralDetails) - handle_active_tickets_with_household_and_individual(referral_tickets, TicketReferralDetails) - - referral_tickets_representations = TicketReferralDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - - handle_bulk_update_representations_household_unicef_id( - referral_tickets_representations, - TicketReferralDetails, - ) - - -def handle_needs_adjudication_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - needs_adjudication_tickets = ( - TicketNeedsAdjudicationDetails.objects.select_related( - "ticket", - "golden_records_individual", - ) - .filter(ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - .order_by("pk") - ) - - PossibleDuplicateThrough = TicketNeedsAdjudicationDetails.possible_duplicates.through - SelectedIndividualThrough = TicketNeedsAdjudicationDetails.selected_individuals.through - needs_adjudication_tickets_ids = list(needs_adjudication_tickets.values_list("pk", flat=True)) - tickets_count = len(needs_adjudication_tickets_ids) - logger.info(f"Tickets to handle: {tickets_count}") - for batch_start in range(0, tickets_count, BATCH_SIZE): - batched_ids = needs_adjudication_tickets_ids[batch_start : batch_start + BATCH_SIZE] - needs_adjudication_tickets_batch = TicketNeedsAdjudicationDetails.objects.filter( - id__in=batched_ids - ).select_related( - "ticket", - "golden_records_individual", - ) - logger.info(f"Handling needs adjudication tickets: {batch_start} of {tickets_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - - new_possible_duplicates_to_create = [] - new_selected_individuals_to_create = [] - - for needs_adjudication_ticket in needs_adjudication_tickets_batch: - individuals = [ - needs_adjudication_ticket.golden_records_individual, - *needs_adjudication_ticket.possible_duplicates(manager="original_and_repr_objects").all(), - ] - program_ids = ( - Individual.original_and_repr_objects.filter(id__in=[individual.id for individual in individuals]) - .values( - "copied_to__program", - ) - .annotate(program_count=Count("id")) - .filter(program_count__gt=1) - .values_list("copied_to__program", flat=True) - ) - programs = Program.objects.filter(id__in=program_ids) - if not programs: - grievance_ticket = needs_adjudication_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - continue - - for program in programs: - needs_adjudication_ticket_copy = copy.deepcopy(needs_adjudication_ticket) - if hasattr(needs_adjudication_ticket_copy, "role_reassign_data"): - needs_adjudication_ticket_copy = handle_role_reassign_data(needs_adjudication_ticket_copy, program) - if hasattr(needs_adjudication_ticket_copy, "extra_data"): - needs_adjudication_ticket_copy = handle_extra_data(needs_adjudication_ticket_copy, program) - needs_adjudication_ticket_copy.pk = None - # Copy Grievance Ticket - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - needs_adjudication_ticket_copy, - program, - needs_adjudication_ticket, - ) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(needs_adjudication_ticket_copy) - - possible_duplicates = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual.id, - ) - for individual in individuals - if individual - ] - possible_duplicates = [individual for individual in possible_duplicates if individual] - if possible_duplicates: - needs_adjudication_ticket_copy.golden_records_individual = possible_duplicates.pop() - - # Handle selected_individuals - old_selected_individuals = needs_adjudication_ticket.selected_individuals.all() - selected_individuals = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual, - ) - for individual in old_selected_individuals - ] - selected_individuals = [individual for individual in selected_individuals if individual] - - new_possible_duplicates_to_create.extend( - [ - PossibleDuplicateThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in possible_duplicates - ] - ) - new_selected_individuals_to_create.extend( - [ - SelectedIndividualThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in selected_individuals - ] - ) - - grievance_ticket = needs_adjudication_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketNeedsAdjudicationDetails - ) - - PossibleDuplicateThrough.objects.bulk_create(new_possible_duplicates_to_create) - SelectedIndividualThrough.objects.bulk_create(new_selected_individuals_to_create) - - -def migrate_messages(business_area: Optional[BusinessArea] = None) -> None: - logger.info("Handle Messages") - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - message_objects = ( - Message.original_and_repr_objects.select_related( - "target_population", - "target_population__program", - ) - .filter(is_original=True, is_migration_handled=False, **filter_kwargs) - .distinct() - ) - - message_objects_ids = list(message_objects.values_list("pk", flat=True)) - message_objects_count = len(message_objects_ids) - logger.info(f"Messages to handle: {message_objects_count}") - for batch_start in range(0, message_objects_count, BATCH_SIZE): - message_objects_batched_ids = message_objects_ids[batch_start : batch_start + BATCH_SIZE] - message_objects_batch = Message.original_and_repr_objects.filter( - id__in=message_objects_batched_ids - ).select_related( - "target_population", - "target_population__program", - ) - logger.info(f"Handling messages: {batch_start} of {message_objects_count}") - new_messages_to_create = [] - message_household_to_create = [] - old_messages_to_update = [] - for message in message_objects_batch: - if message.households(manager="original_and_repr_objects").exists(): - if message.target_population: - program = message.target_population.program - message_copy, message_household = copy_message(message, program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - - message.is_migration_handled = True - old_messages_to_update.append(message) - else: - programs = list( - message.households(manager="original_and_repr_objects") - .values_list("copied_to__program", flat=True) - .distinct() - ) - for program in programs: - message_copy, message_household = copy_message(message, program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - message.is_migration_handled = True - old_messages_to_update.append(message) - Message.original_and_repr_objects.bulk_create(new_messages_to_create) - MessageHouseholdRelation = Message.households.through - MessageHouseholdRelation.objects.bulk_create(message_household_to_create) - Message.original_and_repr_objects.bulk_update(old_messages_to_update, ["is_migration_handled", "migrated_at"]) - logger.info("Handle Messages not connected to any program") - handle_non_program_messages(business_area) - - -def copy_message(active_message: Message, program: Program) -> tuple: - message = copy.deepcopy(active_message) - message.pk = None - message.is_original = False - message.copied_from = active_message - message.unicef_id = None - if isinstance(program, Program): - message.program = program - else: - message.program_id = program - - households_representations = [ - get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=household.id, - ) - for household in active_message.households(manager="original_and_repr_objects").all().only("id") - ] - households_representations = [household for household in households_representations if household] - MessageHouseholdRelation = Message.households.through - message_household = [ - MessageHouseholdRelation(message=message, household_id=household.id) for household in households_representations - ] - return message, message_household - - -def migrate_feedback(business_area: Optional[BusinessArea] = None) -> None: - logger.info("Handle Feedback objects") - # Handle closed Feedback (Feedback related to a closed grievance ticket) OR Feedback with program - copy_feedback_to_specific_program(business_area) - # Handle active Feedback objects without program - - # (Feedback with active tickets OR Feedback not related to any ticket) AND without defined program - handle_active_feedback(business_area) - logger.info("Handle Feedback not connected to any program") - handle_non_program_feedback(business_area) - - -def copy_feedback_to_specific_program(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - feedback_objects_for_specific_program = ( - Feedback.original_and_repr_objects.select_related( - "program", - "household_lookup", - "individual_lookup", - "linked_grievance", - "household_lookup__program", - "individual_lookup__program", - ) - .filter( - (Q(linked_grievance__status=GrievanceTicket.STATUS_CLOSED) | Q(program__isnull=False)) - & Q(is_original=True) - & Q(is_migration_handled=False) - ) - .filter(**filter_kwargs) - .distinct() - ) - logger.info("Handle Feedback objects with program or closed grievance ticket") - - feedback_objects_for_specific_program_ids = list(feedback_objects_for_specific_program.values_list("pk", flat=True)) - feedback_objects_for_specific_program_count = len(feedback_objects_for_specific_program_ids) - logger.info(f"Feedback objects to handle: {feedback_objects_for_specific_program_count}") - for batch_start in range(0, feedback_objects_for_specific_program_count, BATCH_SIZE): - feedback_objects_for_specific_program_batched_ids = feedback_objects_for_specific_program_ids[ - batch_start : batch_start + BATCH_SIZE - ] - feedback_objects_for_specific_program_batch = Feedback.original_and_repr_objects.filter( - id__in=feedback_objects_for_specific_program_batched_ids - ).select_related( - "program", - "household_lookup", - "individual_lookup", - "linked_grievance", - "household_lookup__program", - "individual_lookup__program", - ) - logger.info( - f"Handling feedbacks to specific program: {batch_start} of {feedback_objects_for_specific_program_count}" - ) - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback_obj in feedback_objects_for_specific_program_batch: - household_representation = None - individual_representation = None - program = None - - if feedback_obj.program: - program = feedback_obj.program - if feedback_obj.household_lookup: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=feedback_obj.household_lookup, - ) - if feedback_obj.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_obj.individual_lookup, - ) - elif feedback_obj.household_lookup: - if household_representation := feedback_obj.household_lookup.copied_to.first(): - program = household_representation.program - if feedback_obj.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_obj.individual_lookup, - ) - elif feedback_obj.individual_lookup: - if individual_representation := feedback_obj.individual_lookup.copied_to.first(): - program = individual_representation.program - if program: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback_obj, program, household_representation, individual_representation) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback_obj.is_migration_handled = True - old_feedbacks_to_update.append(feedback_obj) - if linked_grievance := feedback_obj.linked_grievance: - linked_grievance.is_migration_handled = True - old_grievance_tickets_to_update.append(linked_grievance) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.original_and_repr_objects.bulk_update(old_feedbacks_to_update, ["is_migration_handled", "migrated_at"]) - - -def handle_active_feedback(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - active_feedback_objects = ( - Feedback.original_and_repr_objects.select_related( - "linked_grievance", - "program", - "household_lookup", - "individual_lookup", - "household_lookup__program", - "individual_lookup__program", - ) - .prefetch_related( - "feedback_messages", - ) - .filter( - (Q(linked_grievance__isnull=True) | ~Q(linked_grievance__status=GrievanceTicket.STATUS_CLOSED)) - & Q(program__isnull=True) - & Q(is_original=True) - & Q(is_migration_handled=False) - ) - .filter(**filter_kwargs) - .distinct() - ) - logger.info("Handle Feedback objects without program and without closed grievance ticket") - - active_feedback_objects_ids = list(active_feedback_objects.values_list("pk", flat=True)) - active_feedback_objects_count = len(active_feedback_objects_ids) - logger.info(f"Active Feedback objects to handle: {active_feedback_objects_count}") - for batch_start in range(0, active_feedback_objects_count, BATCH_SIZE): - active_feedback_objects_batched_ids = active_feedback_objects_ids[batch_start : batch_start + BATCH_SIZE] - active_feedback_objects_batch = Feedback.original_and_repr_objects.filter( - id__in=active_feedback_objects_batched_ids - ).select_related( - "linked_grievance", - "program", - "household_lookup", - "individual_lookup", - "household_lookup__program", - "individual_lookup__program", - ) - logger.info(f"Handling active feedbacks: {batch_start} of {active_feedback_objects_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback_obj in active_feedback_objects_batch: - if feedback_obj.individual_lookup: - individual_representations = feedback_obj.individual_lookup.copied_to.all() - else: - individual_representations = Individual.original_and_repr_objects.none() - if feedback_obj.household_lookup: - household_representations = feedback_obj.household_lookup.copied_to.all() - else: - household_representations = Household.original_and_repr_objects.none() - if individual_representations or household_representations: - household_programs = household_representations.values_list("program", flat=True).distinct() - individual_programs = individual_representations.values_list("program", flat=True).distinct() - - all_programs = ( - Program.objects.filter(Q(id__in=household_programs) | Q(id__in=individual_programs)) - .distinct() - .iterator() - ) - - for program in all_programs: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback_obj, program) - - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback_obj.is_migration_handled = True - old_feedbacks_to_update.append(feedback_obj) - - if linked_grievance := feedback_obj.linked_grievance: - linked_grievance.is_migration_handled = True - old_grievance_tickets_to_update.append(linked_grievance) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.original_and_repr_objects.bulk_update(old_feedbacks_to_update, ["is_migration_handled", "migrated_at"]) - - -def copy_feedback( - feedback_obj: Feedback, - program: Program, - household_representation: Optional[Household] = None, - individual_representation: Optional[Individual] = None, -) -> tuple: - feedback_copy = copy.deepcopy(feedback_obj) - if not household_representation and feedback_copy.household_lookup: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=feedback_copy.household_lookup, - ) - feedback_copy.household_lookup = household_representation - - if not individual_representation and feedback_copy.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_copy.individual_lookup, - ) - feedback_copy.individual_lookup = individual_representation - - feedback_copy.pk = None - feedback_copy.is_original = False - feedback_copy.copied_from = feedback_obj - feedback_copy.unicef_id = None - if feedback_copy.linked_grievance: - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - feedback_copy, program, feedback_obj, related_grievance_field="linked_grievance" - ) - else: - grievance_ticket_data, notes_to_create, documents_to_create = {}, [], [] - - feedback_copy.program = program - messages_to_create = [] - for message in feedback_obj.feedback_messages.all(): - message_copy = copy.deepcopy(message) - message_copy.pk = None - message_copy.feedback = feedback_copy - messages_to_create.append(message_copy) - - return feedback_copy, grievance_ticket_data, notes_to_create, documents_to_create, messages_to_create - - -def copy_grievance_ticket( - ticket_copy: Any, - program: Program, - original_ticket: Any, - related_grievance_field: str = "ticket", -) -> tuple: - grievance_ticket = getattr(ticket_copy, related_grievance_field) - original_grievance_ticket_id = grievance_ticket.pk - grievance_ticket.pk = None - grievance_ticket.unicef_id = None - grievance_ticket.is_original = False - grievance_ticket.copied_from_id = original_grievance_ticket_id - - grievance_ticket_data = { - "grievance_ticket": grievance_ticket, - "program": program, - } - notes_to_create = [] - for note in getattr(original_ticket, related_grievance_field).ticket_notes.all(): - note.pk = None - note.ticket = grievance_ticket - notes_to_create.append(note) - - documents_to_create = [] - for document in getattr(original_ticket, related_grievance_field).support_documents.all(): - document.pk = None - document.grievance_ticket = grievance_ticket - documents_to_create.append(document) - - setattr(ticket_copy, related_grievance_field, grievance_ticket) - - return grievance_ticket_data, notes_to_create, documents_to_create - - -def migrate_linked_tickets(business_area: Optional[BusinessArea] = None) -> None: - logger.info(f"Handling linked tickets for business area: {business_area}") - - filter_params = {} - if business_area: - filter_params["business_area"] = business_area - - tickets_representations_ids = list( - GrievanceTicket.default_for_migrations_fix.filter(**filter_params, is_original=False).values_list( - "id", flat=True - ) - ) - tickets_representations_count = len(tickets_representations_ids) - logger.info(f"Tickets representations to handle: {tickets_representations_count}") - for batch_start in range(0, tickets_representations_count, BATCH_SIZE): - batched_ids = tickets_representations_ids[batch_start : batch_start + BATCH_SIZE] - tickets_representations = GrievanceTicket.default_for_migrations_fix.filter(id__in=batched_ids).select_related( - "copied_from" - ) - # Link all linked_tickets representations with current ticket_representation - linked_tickets_to_create = [] - for ticket_representation in tickets_representations: - original_ticket = ticket_representation.copied_from - linked_tickets_representations = GrievanceTicket.default_for_migrations_fix.filter( - copied_from__linked_tickets__in=[original_ticket] - ).distinct() - for linked_ticket_representation in linked_tickets_representations: - linked_tickets_to_create.extend( - [ - GrievanceTicketThrough( - main_ticket=ticket_representation, - linked_ticket=linked_ticket_representation, - ), - GrievanceTicketThrough( - main_ticket=linked_ticket_representation, - linked_ticket=ticket_representation, - ), - ] - ) - # Link all representations of the same ticket with current representation - if original_ticket: - for ticket_other_representation in original_ticket.copied_to( - manager="default_for_migrations_fix" - ).all(): - if ticket_other_representation.pk != ticket_representation.pk: - linked_tickets_to_create.extend( - [ - GrievanceTicketThrough( - main_ticket=ticket_representation, - linked_ticket=ticket_other_representation, - ), - GrievanceTicketThrough( - main_ticket=ticket_other_representation, - linked_ticket=ticket_representation, - ), - ] - ) - - GrievanceTicketThrough.objects.bulk_create(linked_tickets_to_create, ignore_conflicts=True) - - -def handle_grievance_ticket_data_creation(grievance_ticket_data: list) -> None: - """ - Function that bulk creates grievance tickets, add their linked tickets and programs relation. - grievance_ticket_data consists of 3 keys: - - grievance_ticket: GrievanceTicket object list - - program: Program for which GrievanceTicket is created ( in many-to-many relation "programs") - """ - GrievanceTicketProgram = GrievanceTicket.programs.through - - grievance_tickets = [gt["grievance_ticket"] for gt in grievance_ticket_data] - grievance_tickets_program = [] - for grievance_ticket in grievance_ticket_data: - program_id = ( - grievance_ticket["program"].pk - if isinstance(grievance_ticket["program"], Program) - else grievance_ticket["program"] - ) - grievance_tickets_program.append( - GrievanceTicketProgram(grievanceticket=grievance_ticket["grievance_ticket"], program_id=program_id) - ) - - GrievanceTicket.default_for_migrations_fix.bulk_create(grievance_tickets) - GrievanceTicketProgram.objects.bulk_create(grievance_tickets_program, ignore_conflicts=True) - - -def handle_bulk_create_paginated_data( - old_grievance_tickets_to_update: list, objects_to_create_dict: dict, model: Any -) -> None: - handle_grievance_ticket_data_creation(objects_to_create_dict["grievance_tickets"]) - TicketNote.objects.bulk_create(objects_to_create_dict["notes"]) - GrievanceDocument.objects.bulk_create(objects_to_create_dict["documents"]) - GrievanceTicket.default_for_migrations_fix.bulk_update( - old_grievance_tickets_to_update, ["is_migration_handled", "migrated_at"] - ) - model.objects.bulk_create(objects_to_create_dict["tickets"]) - - -def handle_bulk_update_representations_household_unicef_id(query: QuerySet, model: Any) -> None: - related_name = ticket_grievance_ticket_field_name_mapping[model] - GrievanceTicket.default_for_migrations_fix.filter(**{f"{related_name}__in": query}).update( - household_unicef_id=Subquery( - GrievanceTicket.default_for_migrations_fix.filter(pk=OuterRef("pk")).values( - f"{related_name}__household__unicef_id" - )[:1] - ) - ) - - -def create_void_program(business_area: BusinessArea) -> Program: - return Program.all_objects.get_or_create( - name="Storage Program For Non-Program Grievance And Accountability", - business_area=business_area, - defaults=dict( - status=Program.DRAFT, - start_date=timezone.datetime.min, - end_date=timezone.datetime.max, - budget=0, - frequency_of_payments=Program.ONE_OFF, - sector=Program.CHILD_PROTECTION, - scope=Program.SCOPE_FOR_PARTNERS, - cash_plus=True, - population_goal=1, - is_visible=False, - ), - )[0] - - -def handle_non_program_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Handle tickets that are not connected to any program. They should be moved to dummy program. - Exclude payment-related-tickets that will be handled during sync. - """ - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_query = ( - Q(ticket__business_area=business_area) & Q(ticket__is_migration_handled=False) & Q(ticket__is_original=True) - ) - non_program_tickets_dict = { - TicketComplaintDetails: TicketComplaintDetails.objects.filter( - non_program_query & ~Q(payment_object_id__isnull=False) - ).order_by("id"), - TicketSensitiveDetails: TicketSensitiveDetails.objects.filter( - non_program_query & ~Q(payment_object_id__isnull=False) - ).order_by("id"), - TicketPaymentVerificationDetails: TicketPaymentVerificationDetails.objects.filter( - non_program_query - & ~(Q(payment_verification__isnull=False) & Q(payment_verification__payment_object_id__isnull=False)) - ).order_by("id"), - TicketHouseholdDataUpdateDetails: TicketHouseholdDataUpdateDetails.objects.filter( - non_program_query - ).order_by("id"), - TicketIndividualDataUpdateDetails: TicketIndividualDataUpdateDetails.objects.filter( - non_program_query - ).order_by("id"), - TicketAddIndividualDetails: TicketAddIndividualDetails.objects.filter(non_program_query).order_by("id"), - TicketDeleteIndividualDetails: TicketDeleteIndividualDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketDeleteHouseholdDetails: TicketDeleteHouseholdDetails.objects.filter(non_program_query).order_by("id"), - TicketSystemFlaggingDetails: TicketSystemFlaggingDetails.objects.filter(non_program_query).order_by("id"), - TicketPositiveFeedbackDetails: TicketPositiveFeedbackDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketNegativeFeedbackDetails: TicketNegativeFeedbackDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketNeedsAdjudicationDetails: TicketNeedsAdjudicationDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketReferralDetails: TicketReferralDetails.objects.filter(non_program_query).order_by("id"), - } - - void_program = create_void_program(business_area) # type: ignore[arg-type] - for model, query in non_program_tickets_dict.items(): - objects_ids = list(query.values_list("pk", flat=True)) - objects_count = len(objects_ids) - logger.info(f"Non-program tickets of type {model.__name__} to handle: {objects_count}") - for batch_start in range(0, objects_count, BATCH_SIZE): - objects_batched_ids = objects_ids[batch_start : batch_start + BATCH_SIZE] - objects_batch = model.objects.filter(id__in=objects_batched_ids).select_related("ticket") - logger.info(f"Handling non-program tickets of type {model.__name__}: {batch_start} of {objects_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for non_program_ticket in objects_batch: - ticket_copy = copy.deepcopy(non_program_ticket) - ticket_copy.pk = None - non_program_ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, void_program, non_program_ticket - ) - - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = non_program_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - -def handle_non_program_feedback(business_area: Optional[BusinessArea] = None) -> None: - """ - Handle feedback that is not connected to any project. They should be moved to dummy program. - """ - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_feedback_objects = Feedback.original_and_repr_objects.filter( - is_original=True, is_migration_handled=False, business_area=business_area - ) - if non_program_feedback_objects: - void_program = create_void_program(business_area) # type: ignore[arg-type] - - non_program_feedback_objects_ids = list(non_program_feedback_objects.values_list("pk", flat=True)) - non_program_feedback_objects_count = len(non_program_feedback_objects_ids) - logger.info(f"Non-program feedback objects to handle: {non_program_feedback_objects_count}") - for batch_start in range(0, non_program_feedback_objects_count, BATCH_SIZE): - non_program_feedback_objects_batched_ids = non_program_feedback_objects_ids[ - batch_start : batch_start + BATCH_SIZE - ] - non_program_feedback_objects_batch = Feedback.original_and_repr_objects.filter( - id__in=non_program_feedback_objects_batched_ids - ).select_related("linked_grievance") - logger.info( - f"Handling non-program feedback objects: {batch_start} of {non_program_feedback_objects_count}" - ) - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback in non_program_feedback_objects_batch: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback, void_program) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback.is_migration_handled = True - old_feedbacks_to_update.append(feedback) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.original_and_repr_objects.bulk_update( - old_feedbacks_to_update, ["is_migration_handled", "migrated_at"] - ) - - -def handle_non_program_messages(business_area: Optional[BusinessArea] = None) -> None: - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_messages = Message.original_and_repr_objects.filter( - is_original=True, business_area=business_area, is_migration_handled=False - ) - if non_program_messages: - void_program = create_void_program(business_area) # type: ignore[arg-type] - - non_program_message_objects_ids = list(non_program_messages.values_list("pk", flat=True)) - non_program_message_objects_count = len(non_program_message_objects_ids) - logger.info(f"Non-program message objects to handle: {non_program_message_objects_count}") - for batch_start in range(0, non_program_message_objects_count, BATCH_SIZE): - non_program_message_objects_batched_ids = non_program_message_objects_ids[ - batch_start : batch_start + BATCH_SIZE - ] - non_program_message_objects_batch = Message.original_and_repr_objects.filter( - id__in=non_program_message_objects_batched_ids - ) - logger.info( - f"Handling non-program message objects: {batch_start} of {non_program_message_objects_count}" - ) - new_messages_to_create = [] - message_household_to_create = [] - old_messages_to_update = [] - for message in non_program_message_objects_batch: - message_copy, message_household = copy_message(message, void_program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - message.is_migration_handled = True - old_messages_to_update.append(message) - Message.original_and_repr_objects.bulk_create(new_messages_to_create) - MessageHouseholdRelation = Message.households.through - MessageHouseholdRelation.objects.bulk_create(message_household_to_create) - Message.original_and_repr_objects.bulk_update( - old_messages_to_update, ["is_migration_handled", "migrated_at"] - ) - - -def handle_role_reassign_data(ticket: Any, program: Program) -> Any: - """ - role_reassign_data structure: - { - role_uuid / "HEAD": { - "household": household_encoded_id, - "individual": individual_encoded_id, - "role": role - }, - ... - } - """ - - def retrieve_household_representation(household_from_json: Household, program: Program) -> Optional[Household]: - if household_from_json_in_program := household_from_json.copied_to.filter(program=program).first(): - encoded_id = encode_id_base64(household_from_json_in_program.id, "Household") - role_data["household"] = encoded_id - return household_from_json_in_program - - def retrieve_individual_representation(individual_from_json: Individual, program: Program) -> Optional[Individual]: - if individual_from_json_in_program := individual_from_json.copied_to.filter(program=program).first(): - encoded_id = encode_id_base64(individual_from_json_in_program.id, "Individual") - role_data["individual"] = encoded_id - return individual_from_json_in_program - - def retrieve_role_from_program(role_from_json: IndividualRoleInHousehold, program: Program) -> Optional[Individual]: - role_household_in_program = role_from_json.household.copied_to.filter(program=program).first() - role_individual_in_program = role_from_json.individual.copied_to.filter(program=program).first() - - role_from_json_in_program = IndividualRoleInHousehold.original_and_repr_objects.filter( - household=role_household_in_program, individual=role_individual_in_program - ).first() - return role_from_json_in_program - - if not ticket.role_reassign_data: - return ticket - - new_role_reassign_data = {} - for role_uuid, role_data in ticket.role_reassign_data.items(): - role_data_to_extend = {} - - household_from_json = Household.original_and_repr_objects.filter( - id=decode_id_string(role_data.get("household")) - ).first() - # Fetch correct household representation from JSON - household_from_json_in_program = ( - retrieve_household_representation(household_from_json, program) if household_from_json else None - ) - - individual_from_json = Individual.original_and_repr_objects.filter( - id=decode_id_string(role_data.get("individual")) - ).first() - # Fetch correct individual representation from JSON - individual_from_json_in_program = ( - retrieve_individual_representation(individual_from_json, program) if individual_from_json else None - ) - - if household_from_json_in_program and individual_from_json_in_program: - if role_uuid == "HEAD": - role_data_to_extend["HEAD"] = role_data - else: - role_from_json = IndividualRoleInHousehold.original_and_repr_objects.filter(id=role_uuid).first() - # Fetch correct role representation from JSON - role_from_json_in_program = ( - retrieve_role_from_program(role_from_json, program) if role_from_json else None - ) - if role_from_json_in_program: - role_data_to_extend[str(role_from_json_in_program.id)] = role_data - - if role_data_to_extend: - new_role_reassign_data.update(role_data_to_extend) - - ticket.role_reassign_data = new_role_reassign_data - return ticket - - -def handle_extra_data(ticket: Any, program: Program) -> Any: - """ - extra_data structure: - { - "golden_records": [ - { - "dob": date_of_birth, - "full_name": full_name, - "hit_id": hit_id, - "location": location, - "proximity_to_score": proximity_to_score, - "score": score - }, - ... - ], - "possible_duplicate": [ - { - "dob": date_of_birth, - "full_name": full_name, - "hit_id": hit_id, - "location": location, - "proximity_to_score": proximity_to_score, - "score": score - }, - ... - ] - } - """ - - if not ticket.extra_data: - return ticket - - for list_data in ticket.extra_data.values(): - for ind_data in list_data: - id_found = False - hit_from_json = Individual.original_and_repr_objects.filter(id=ind_data.get("hit_id")).first() - # Fetch correct individual representation from JSON - if hit_from_json: - hit_from_json_in_program = hit_from_json.copied_to.filter(program=program).first() - if hit_from_json_in_program: - id_found = True - ind_data["hit_id"] = str(hit_from_json_in_program.id) - if id_found is False: - list_data.remove(ind_data) - - # ticket.save() - return ticket - - -def handle_individual_data( - ticket: TicketIndividualDataUpdateDetails, program: Program -) -> TicketIndividualDataUpdateDetails: - """ - individual_data consists of multiple values, but only some have ids. - These are: [documents/identities/payment_channels]_to_remove and _to_edit. - Structure of individual_data: - { - "_to_remove": [ - { - "approve_status": bool, - "value": "base64_id_of_object_to_remove" - } - ] - "_to_edit": [ - { - "approve_status": bool, - "previous_value": { - "id": base64_object_id, - (if not document) - "individual": base64_individual_id, - **other_object_specific_fields - }, - "value": { - "id": base64_object_id(the same as the one above), - (if not document) - "individual": base64_individual_id, - **other_object_specific_fields - } - } - ], - also for _to_remove objects there are corresponding previous_[documents/identities/payment_channels]. - { - "base64_object_id": { - "id": same as base64_object_id(same as value in _to_remove), - "individual" base64_document_individual_id, - **object specific data - } - } - } - """ - individual = ticket.individual - individual_in_program = individual.copied_to.filter(program=program).first() - if not individual_in_program: - return ticket - - encoded_individual_id = encode_id_base64(individual_in_program.id, "Individual") - individual_data = ticket.individual_data - if not individual_data: - return ticket - - for model in (Document, IndividualIdentity, BankAccountInfo): - IndividualDataObjectsToEditHandler( - individual_data, - individual_in_program, - model, - encoded_individual_id, - ).handle_objects_to_edit() - IndividualDataObjectsToRemoveHandler( - individual_data, - individual_in_program, - model, - encoded_individual_id, - ).handle_objects_to_remove() - - ticket.individual_data = individual_data - # ticket.save(update_fields=["individual_data"]) - return ticket - - -class IndividualDataObjectsToRemoveHandler: - def __init__( - self, - individual_data: dict, - individual_in_program: Individual, - model: Any, - encoded_individual_id: Optional[str], - ) -> None: - self.individual_data = individual_data - self.model = model - self.objects_to_remove_string, self.previous_objects_string = self.object_specific_update_fields() - self.individual_in_program = individual_in_program - self.encoded_individual_id = encoded_individual_id - - def object_specific_update_fields(self) -> tuple[str, str]: - model_related_string = { - Document: "documents", - IndividualIdentity: "identities", - BankAccountInfo: "payment_channels", - }[self.model] - return f"{model_related_string}_to_remove", f"previous_{model_related_string}" - - def object_specific_get_fields(self, previous_object: dict) -> dict: - if self.model == IndividualIdentity: - return { - "country__iso_code3": previous_object.get("country"), - "number": previous_object.get("number"), - "partner__name": previous_object.get("partner"), - } - elif self.model == Document: - return { - "document_number": previous_object.get("document_number"), - "country__iso_code3": previous_object.get("country"), - "type__key": previous_object.get("key"), - } - else: - return { - "bank_name": previous_object.get("bank_name"), - "bank_account_number": previous_object.get("bank_account_number"), - } - - def handle_individual_data_update( - self, - index: int, - object_in_program_encoded_id: Optional[str], - object_to_remove_id: str, - ) -> None: - self.individual_data[self.objects_to_remove_string][index]["value"] = object_in_program_encoded_id - self.individual_data[self.previous_objects_string][object_to_remove_id]["id"] = object_in_program_encoded_id - self.individual_data[self.previous_objects_string][object_to_remove_id][ - "individual" - ] = self.encoded_individual_id - if object_in_program_encoded_id != object_to_remove_id: - self.individual_data[self.previous_objects_string][object_in_program_encoded_id] = copy.deepcopy( - self.individual_data[self.previous_objects_string][object_to_remove_id] - ) - del self.individual_data[self.previous_objects_string][object_to_remove_id] - - def handle_objects_to_remove(self) -> None: - for index, object_to_remove in enumerate(self.individual_data.get(self.objects_to_remove_string, [])): - object_to_remove_id = object_to_remove.get("value") - previous_object = self.individual_data.get(self.previous_objects_string, {}).get(object_to_remove_id, {}) - if not previous_object: - continue - object_in_program = self.model.objects.filter( - individual=self.individual_in_program, - **self.object_specific_get_fields(previous_object), - ).first() - if object_in_program: - object_in_program_encoded_id = encode_id_base64(object_in_program.id, self.model.__name__) - self.handle_individual_data_update( - index, - object_in_program_encoded_id, - object_to_remove_id, - ) - - -class IndividualDataObjectsToEditHandler: - def __init__( - self, - individual_data: dict, - individual_in_program: Individual, - model: Any, - encoded_individual_id: Optional[str], - ) -> None: - self.individual_data = individual_data - self.model = model - self.objects_to_edit_string = self.object_specific_edit_fields() - self.individual_in_program = individual_in_program - self.encoded_individual_id = encoded_individual_id - - def object_specific_edit_fields(self) -> str: - model_related_string = { - Document: "documents", - IndividualIdentity: "identities", - BankAccountInfo: "payment_channels", - }[self.model] - return f"{model_related_string}_to_edit" - - def get_object_specific_fields(self, previous_value: dict) -> dict: - if self.model == IndividualIdentity: - return { - "country__iso_code3": previous_value.get("country"), - "number": previous_value.get("number"), - "partner__name": previous_value.get("partner"), - } - elif self.model == Document: - return { - "document_number": previous_value.get("number"), - "country__iso_code3": previous_value.get("country"), - } - else: - return { - "bank_name": previous_value.get("bank_name"), - "bank_account_number": previous_value.get("bank_account_number"), - } - - def handle_objects_to_edit(self) -> None: - for index, object_to_edit in enumerate(self.individual_data.get(self.objects_to_edit_string, [])): - object_in_program = self.model.objects.filter( - individual=self.individual_in_program, - **self.get_object_specific_fields(object_to_edit.get("previous_value", {})), - ).first() - if not object_in_program: - object_in_program = self.model.objects.filter( - individual=self.individual_in_program, - **self.get_object_specific_fields(object_to_edit.get("value", {})), - ).first() - if not object_in_program: - continue - object_in_program_encoded_id = encode_id_base64(object_in_program.id, self.model.__name__) - self.individual_data[self.objects_to_edit_string][index]["value"]["id"] = object_in_program_encoded_id - self.individual_data[self.objects_to_edit_string][index]["previous_value"][ - "id" - ] = object_in_program_encoded_id - if self.model != Document: - self.individual_data[self.objects_to_edit_string][index]["value"][ - "individual" - ] = self.encoded_individual_id - self.individual_data[self.objects_to_edit_string][index]["previous_value"][ - "individual" - ] = self.encoded_individual_id - - -def handle_payment_related_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Assign grievance tickets to representations. Applied for tickets connected to specific payment. - Handle TicketComplaintDetails, TicketSensitiveDetails, TicketPaymentVerificationDetails with related payment_obj - """ - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - # Fetch all objects of TicketComplaintDetails and TicketSensitiveDetails with non-null payment_obj - complaint_tickets_with_payments = TicketComplaintDetails.objects.select_related( - "household", - "individual", - ).filter( - payment_object_id__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - sensitive_tickets_with_payments = TicketSensitiveDetails.objects.select_related( - "household", - "individual", - ).filter( - payment_object_id__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - - complaint_and_sensitive_details_tickets = chain(complaint_tickets_with_payments, sensitive_tickets_with_payments) - - # Update household and individual fields based on payment_obj for TicketComplaintDetails and TicketSensitiveDetails - for ticket in complaint_and_sensitive_details_tickets: - household, individual, program = get_program_and_representations_for_payment(ticket) - ticket.household = household - ticket.individual = individual - if program: - ticket.ticket.programs.set([program]) - - # Perform a bulk update for the household and individual fields of TicketComplaintDetails and TicketSensitiveDetails - TicketComplaintDetails.objects.bulk_update(complaint_tickets_with_payments, ["household", "individual"]) - TicketSensitiveDetails.objects.bulk_update(sensitive_tickets_with_payments, ["household", "individual"]) - - # Update household_unicef_id for all related GrievanceTickets - # Fetch the GrievanceTickets related to the updated objects - grievance_tickets = GrievanceTicket.default_for_migrations_fix.filter( - Q(complaint_ticket_details__in=complaint_tickets_with_payments) - | Q(sensitive_ticket_details__in=sensitive_tickets_with_payments) - ).distinct() - # Update household_unicef_id for each GrievanceTicket using bulk_update - for grievance_ticket in grievance_tickets: - related_ticket = getattr(grievance_ticket, "complaint_ticket_details", None) or getattr( - grievance_ticket, "sensitive_ticket_details", None - ) - household_unicef_id = getattr(related_ticket.household, "unicef_id", None) - grievance_ticket.household_unicef_id = household_unicef_id - - GrievanceTicket.objects.bulk_update(grievance_tickets, ["household_unicef_id"]) - - # Update programs for TicketPaymentVerificationDetails with payment_obj - payment_verification_tickets = ( - TicketPaymentVerificationDetails.objects.select_related( - "payment_verification", - ) - .filter( - payment_verification__isnull=False, - payment_verification__payment_object_id__isnull=False, - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - .distinct() - ) - for payment_verification_ticket in payment_verification_tickets: - payment_obj = payment_verification_ticket.payment_verification.payment_obj - if isinstance(payment_obj, Payment): - program = payment_obj.parent.target_population.program - elif isinstance(payment_obj, PaymentRecord): - program = payment_obj.target_population.program - else: - program = None - if program: - payment_verification_ticket.ticket.programs.set([program]) - - GrievanceTicket.default_for_migrations_fix.filter( - Q(complaint_ticket_details__in=complaint_tickets_with_payments) - | Q(sensitive_ticket_details__in=sensitive_tickets_with_payments) - | Q(payment_verification_ticket_details__in=payment_verification_tickets) - ).update(is_original=False, is_migration_handled=True) - - -def get_program_and_representations_for_payment(ticket: Union[TicketComplaintDetails, TicketSensitiveDetails]) -> tuple: - if isinstance(ticket.payment_obj, Payment): - program = ticket.payment_obj.parent.target_population.program - elif isinstance(ticket.payment_obj, PaymentRecord): - program = ticket.payment_obj.target_population.program - else: - program = None - household_representation = ( - get_household_representation_per_program_by_old_household_id(program=program, old_household_id=ticket.household) - if ticket.household - else None - ) - individual_representation = ( - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ticket.individual, - ) - if ticket.individual - else None - ) - return household_representation, individual_representation, program diff --git a/src/hct_mis_api/one_time_scripts/migrate_grievance_to_representations.py b/src/hct_mis_api/one_time_scripts/migrate_grievance_to_representations.py deleted file mode 100644 index 86e60a1509..0000000000 --- a/src/hct_mis_api/one_time_scripts/migrate_grievance_to_representations.py +++ /dev/null @@ -1,2129 +0,0 @@ -import copy -import logging -from itertools import chain -from typing import Any, Optional, Union - -from django.db.models import Count, OuterRef, Q, QuerySet, Subquery -from django.utils import timezone - -from hct_mis_api.apps.accountability.models import Feedback, FeedbackMessage, Message -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.core.utils import decode_id_string, encode_id_base64 -from hct_mis_api.apps.grievance.models import ( - GrievanceDocument, - GrievanceTicket, - GrievanceTicketThrough, - TicketAddIndividualDetails, - TicketComplaintDetails, - TicketDeleteHouseholdDetails, - TicketDeleteIndividualDetails, - TicketHouseholdDataUpdateDetails, - TicketIndividualDataUpdateDetails, - TicketNeedsAdjudicationDetails, - TicketNegativeFeedbackDetails, - TicketNote, - TicketPaymentVerificationDetails, - TicketPositiveFeedbackDetails, - TicketReferralDetails, - TicketSensitiveDetails, - TicketSystemFlaggingDetails, -) -from hct_mis_api.apps.household.models import ( - BankAccountInfo, - Document, - Household, - Individual, - IndividualIdentity, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.payment.models import Payment, PaymentRecord -from hct_mis_api.apps.program.models import Program -from hct_mis_api.one_time_scripts.migrate_data_to_representations import ( - get_household_representation_per_program_by_old_household_id, - get_individual_representation_per_program_by_old_individual_id, -) - -logger = logging.getLogger(__name__) - -BATCH_SIZE = 100 - -ticket_grievance_ticket_field_name_mapping = { - TicketComplaintDetails: "complaint_ticket_details", - TicketSensitiveDetails: "sensitive_ticket_details", - TicketPaymentVerificationDetails: "payment_verification_ticket_details", - TicketIndividualDataUpdateDetails: "individual_data_update_ticket_details", - TicketHouseholdDataUpdateDetails: "household_data_update_ticket_details", - TicketAddIndividualDetails: "add_individual_ticket_details", - TicketDeleteIndividualDetails: "delete_individual_ticket_details", - TicketDeleteHouseholdDetails: "delete_household_ticket_details", - TicketSystemFlaggingDetails: "system_flagging_ticket_details", - TicketPositiveFeedbackDetails: "positive_feedback_ticket_details", - TicketNegativeFeedbackDetails: "negative_feedback_ticket_details", - TicketReferralDetails: "referral_ticket_details", - TicketNeedsAdjudicationDetails: "needs_adjudication_ticket_details", -} - - -def migrate_grievance_to_representations() -> None: - """ - Migrate grievance tickets and feedback into representations. - """ - model_list = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketPaymentVerificationDetails, - TicketIndividualDataUpdateDetails, - TicketHouseholdDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, - TicketNeedsAdjudicationDetails, - GrievanceTicket, - TicketNote, - GrievanceDocument, - Message, - Feedback, - FeedbackMessage, - ] - for model in model_list: - model._meta.get_field("created_at").auto_now_add = False - try: - migrate_grievance_tickets() - migrate_messages() - migrate_feedback() - migrate_linked_tickets() - finally: - for model in model_list: - model._meta.get_field("created_at").auto_now_add = True - - -def migrate_grievance_to_representations_per_business_area(business_area: Optional[BusinessArea] = None) -> None: - """ - Migrate grievance tickets and feedback into representations per business area. - """ - model_list = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketPaymentVerificationDetails, - TicketIndividualDataUpdateDetails, - TicketHouseholdDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, - TicketNeedsAdjudicationDetails, - GrievanceTicket, - TicketNote, - GrievanceDocument, - Message, - Feedback, - FeedbackMessage, - ] - for model in model_list: - model._meta.get_field("created_at").auto_now_add = False - try: - migrate_grievance_tickets(business_area) - migrate_messages(business_area) - migrate_feedback(business_area) - migrate_linked_tickets(business_area) - finally: - for model in model_list: - model._meta.get_field("created_at").auto_now_add = True - - -def migrate_grievance_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Migrate grievance tickets into representations. - """ - # print("Handle payment related tickets") - # handle_payment_related_tickets() - logger.info("Handle non payment related tickets") - handle_non_payment_related_tickets(business_area) - logger.info("Handle tickets not connected to any program") - handle_non_program_tickets(business_area) - - -def handle_non_payment_related_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Copy grievance tickets to representations. - Applied for tickets not connected to specific payment but connected to household or its individual. - """ - logger.info("Handle TicketComplaintDetails without payment") - handle_complaint_tickets_without_payments(business_area) - logger.info("Handle TicketSensitiveDetails without payment") - handle_sensitive_tickets_without_payments(business_area) - logger.info("Handle TicketHouseholdDataUpdateDetails") - handle_household_data_update_tickets(business_area) - logger.info("Handle TicketIndividualDataUpdateDetails") - handle_individual_data_update_tickets(business_area) - logger.info("Handle TicketAddIndividualDetails") - handle_add_individual_tickets(business_area) - logger.info("Handle TicketDeleteIndividualDetails") - handle_delete_individual_tickets(business_area) - logger.info("Handle TicketDeleteHouseholdDetails") - handle_delete_household_tickets(business_area) - logger.info("Handle TicketSystemFlaggingDetails") - handle_system_flagging_details_tickets(business_area) - logger.info("Handle TicketPositiveFeedbackDetails") - handle_positive_feedback_tickets(business_area) - logger.info("Handle TicketNegativeFeedbackDetails") - handle_negative_feedback_tickets(business_area) - logger.info("Handle TicketReferralDetails") - handle_referral_tickets(business_area) - logger.info("Handle TicketNeedsAdjudicationDetails") - handle_needs_adjudication_tickets(business_area) - - -def handle_complaint_tickets_without_payments(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - complaint_tickets_without_payments = TicketComplaintDetails.objects.select_related( - "ticket", - "household", - "individual", - ).filter( - payment_object_id__isnull=True, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_closed_tickets_with_household_and_individual(complaint_tickets_without_payments, TicketComplaintDetails) - handle_active_tickets_with_household_and_individual(complaint_tickets_without_payments, TicketComplaintDetails) - - complaint_tickets_without_payments_representations = TicketComplaintDetails.objects.filter( - payment_object_id__isnull=True, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_bulk_update_representations_household_unicef_id( - complaint_tickets_without_payments_representations, TicketComplaintDetails - ) - - -def handle_sensitive_tickets_without_payments(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - sensitive_tickets_without_payments = TicketSensitiveDetails.objects.select_related( - "ticket", - "household", - "individual", - ).filter( - payment_object_id__isnull=True, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_closed_tickets_with_household_and_individual(sensitive_tickets_without_payments, TicketSensitiveDetails) - handle_active_tickets_with_household_and_individual(sensitive_tickets_without_payments, TicketSensitiveDetails) - - sensitive_tickets_without_payments_representations = TicketSensitiveDetails.objects.filter( - payment_object_id__isnull=True, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs - ) - handle_bulk_update_representations_household_unicef_id( - sensitive_tickets_without_payments_representations, TicketSensitiveDetails - ) - - -def handle_closed_tickets_with_household_and_individual(tickets: QuerySet, ticket_class: Any) -> None: - """ - In case of closed complaint ticket, we need to copy the ticket to random representation of assigned - household/individual. - """ - logger.info("Handle closed tickets with household and individual") - closed_tickets = tickets.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = ticket_class.objects.filter(id__in=batched_ids).select_related( - "ticket", "household", "individual" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - household_representation = None - individual_representation = None - if closed_ticket.household: - if household_representation := closed_ticket.household.copied_to( - manager="original_and_repr_objects" - ).first(): - program = household_representation.program - if closed_ticket.individual: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=closed_ticket.individual, - ) - elif closed_ticket.individual: - if individual_representation := closed_ticket.individual.copied_to( - manager="original_and_repr_objects" - ).first(): - program = individual_representation.program - else: - program = None - - if program: - ( - ticket_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - ) = copy_closed_ticket_with_household_and_individual( - closed_ticket, program, household_representation, individual_representation - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, ticket_class) - - -def copy_closed_ticket_with_household_and_individual( - closed_ticket: Any, - program: Program, - household_representation: Optional[Household] = None, - individual_representation: Optional[Individual] = None, -) -> tuple: - ticket_copy = copy.deepcopy(closed_ticket) - ticket_copy.pk = None - ticket_copy.household = household_representation - ticket_copy.individual = individual_representation - - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, program, closed_ticket - ) - return ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_active_tickets_with_household_and_individual(tickets: QuerySet, ticket_class: Any) -> None: - """ - For active complaint tickets, we need to copy tickets for every household/individual representation - """ - logger.info("Handle active tickets with household and individual") - active_tickets = tickets.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = ticket_class.objects.filter(id__in=batched_ids).select_related( - "ticket", "household", "individual" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - if active_ticket.individual: - individual_representations = active_ticket.individual.copied_to( - manager="original_and_repr_objects" - ).all() - else: - individual_representations = Individual.objects.none() - if active_ticket.household: - household_representations = active_ticket.household.copied_to(manager="original_and_repr_objects").all() - else: - household_representations = Household.objects.none() - - if individual_representations or household_representations: - individual_programs = individual_representations.values_list("program", flat=True).distinct() - household_programs = household_representations.values_list("program", flat=True).distinct() - - all_programs = household_programs.union(individual_programs) - - for program in all_programs: - ( - ticket_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - ) = copy_active_ticket_with_household_and_individual(active_ticket, program) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, ticket_class) - - -def copy_active_ticket_with_household_and_individual(active_ticket: Any, program: Program) -> tuple: - ticket_copy = copy.deepcopy(active_ticket) - ticket_copy.pk = None - if ticket_copy.household: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=ticket_copy.household, - ) - ticket_copy.household = household_representation - - if ticket_copy.individual: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ticket_copy.individual, - ) - ticket_copy.individual = individual_representation - - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, program, active_ticket - ) - return ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_tickets_with_household(model: Any, business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_hh = model.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - logger.info(f"Tickets to handle: {tickets_with_hh.count()}") - - # Handle closed tickets - copy only for 1 random representation - closed_tickets = tickets_with_hh.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - closed_batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = model.objects.filter(id__in=closed_batched_ids).select_related("ticket", "household") - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if household_representation := closed_ticket.household.copied_to( - manager="original_and_repr_objects" - ).first(): - program = household_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - closed_ticket, program, household_representation=household_representation - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - # Handle active tickets - copy for all representations - active_tickets = tickets_with_hh.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - active_batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = model.objects.filter(id__in=active_batched_ids).select_related("ticket", "household") - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - household_representations = active_ticket.household.copied_to(manager="original_and_repr_objects").all() - household_programs = household_representations.values_list("program", flat=True).distinct() - - for program in household_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - active_ticket, program - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - tickets_with_hh_representation = ( - model.objects.select_related( - "ticket", - "household", - ) - .prefetch_related( - "household__copied_to", - ) - .filter(household__isnull=False, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs) - ) - handle_bulk_update_representations_household_unicef_id( - tickets_with_hh_representation, - model, - ) - - -def handle_tickets_delete_household_details(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_hh = TicketDeleteHouseholdDetails.objects.select_related( - "ticket", - "household", - ).filter(household__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - logger.info(f"Tickets to handle: {tickets_with_hh.count()}") - - # Handle closed tickets - copy only for 1 random representation - closed_tickets = tickets_with_hh.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - logger.info(f"Tickets to handle: {closed_count}") - for batch_start in range(0, closed_count, BATCH_SIZE): - closed_batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = TicketDeleteHouseholdDetails.objects.filter(id__in=closed_batched_ids).select_related( - "ticket", "household", "reason_household" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if household_representation := closed_ticket.household.copied_to( - manager="original_and_repr_objects" - ).first(): - program = household_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - closed_ticket, program, household_representation=household_representation - ) - ticket_copy.reason_household = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=closed_ticket.reason_household, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketDeleteHouseholdDetails - ) - - # Handle active tickets - copy for all representations - active_tickets = tickets_with_hh.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, active_count, BATCH_SIZE): - active_batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = TicketDeleteHouseholdDetails.objects.filter(id__in=active_batched_ids).select_related( - "ticket", "household", "reason_household" - ) - logger.info(f"Handling closed tickets with household and individuals: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - household_representations = active_ticket.household.copied_to(manager="original_and_repr_objects").all() - household_programs = household_representations.values_list("program", flat=True).distinct() - - for program in household_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_household( - active_ticket, program - ) - ticket_copy.reason_household = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=active_ticket.reason_household, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketDeleteHouseholdDetails - ) - - tickets_with_hh_representation = ( - TicketDeleteHouseholdDetails.objects.select_related( - "ticket", - "household", - ) - .prefetch_related( - "household__copied_to", - ) - .filter(household__isnull=False, ticket__is_original=False, ticket__is_migration_handled=False, **filter_kwargs) - ) - handle_bulk_update_representations_household_unicef_id( - tickets_with_hh_representation, - TicketDeleteHouseholdDetails, - ) - - -def copy_ticket_with_household( - active_ticket: Any, program: Program, household_representation: Optional[Household] = None -) -> tuple: - ticket = copy.deepcopy(active_ticket) - if hasattr(ticket, "role_reassign_data"): - ticket = handle_role_reassign_data(ticket, program) - if not household_representation: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=ticket.household, - ) - ticket.household = household_representation - - ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket(ticket, program, active_ticket) - return ticket, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_tickets_with_individual( - model: Any, individual_field_name: str = "individual", business_area: Optional[BusinessArea] = None -) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - tickets_with_ind = model.objects.select_related( - "ticket", - individual_field_name, - ).filter( - **{f"{individual_field_name}__isnull": False}, - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - logger.info(f"Tickets to handle: {tickets_with_ind.count()}") - - # Handle closed tickets - closed_tickets = tickets_with_ind.filter(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - closed_tickets_ids = list(closed_tickets.values_list("pk", flat=True)) - closed_count = len(closed_tickets_ids) - for batch_start in range(0, len(closed_tickets_ids), BATCH_SIZE): - batched_ids = closed_tickets_ids[batch_start : batch_start + BATCH_SIZE] - closed_tickets_batch = model.objects.select_related("ticket", individual_field_name).filter(id__in=batched_ids) - logger.info(f"Handling closed tickets with individual: {batch_start} of {closed_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for closed_ticket in closed_tickets_batch: - if individual_representation := ( - getattr(closed_ticket, individual_field_name).copied_to(manager="original_and_repr_objects").first() - ): - program = individual_representation.program - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_individual( - closed_ticket, - program, - individual_field_name=individual_field_name, - individual_representation=individual_representation, - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = closed_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - # Handle active tickets - active_tickets = tickets_with_ind.exclude(ticket__status=GrievanceTicket.STATUS_CLOSED).order_by("pk") - active_tickets_ids = list(active_tickets.values_list("pk", flat=True)) - active_count = len(active_tickets_ids) - logger.info(f"Tickets to handle: {active_count}") - for batch_start in range(0, len(active_tickets_ids), BATCH_SIZE): - batched_ids = active_tickets_ids[batch_start : batch_start + BATCH_SIZE] - active_tickets_batch = model.objects.select_related("ticket", individual_field_name).filter(id__in=batched_ids) - logger.info(f"Handling active tickets with individual: {batch_start} of {active_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for active_ticket in active_tickets_batch: - individual_representations = ( - getattr(active_ticket, individual_field_name).copied_to(manager="original_and_repr_objects").all() - ) - individual_programs = individual_representations.values_list("program", flat=True).distinct() - - for program in individual_programs.iterator(): - ticket_copy, grievance_ticket_data, notes_to_create, documents_to_create = copy_ticket_with_individual( - active_ticket, program, individual_field_name=individual_field_name - ) - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - grievance_ticket = active_ticket.ticket - grievance_ticket.is_migration_handled = True - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - -def copy_ticket_with_individual( - active_ticket: Any, - program: Program, - individual_field_name: str, - individual_representation: Optional[Individual] = None, -) -> tuple: - ticket = copy.deepcopy(active_ticket) - if hasattr(ticket, "role_reassign_data"): - ticket = handle_role_reassign_data(ticket, program) - if hasattr(active_ticket, "individual_data") and isinstance(active_ticket, TicketIndividualDataUpdateDetails): - ticket = handle_individual_data(ticket, program) - if not individual_representation: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=getattr(ticket, individual_field_name), - ) - setattr(ticket, individual_field_name, individual_representation) - - ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket(ticket, program, active_ticket) - return ticket, grievance_ticket_data, notes_to_create, documents_to_create - - -def handle_individual_data_update_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual(TicketIndividualDataUpdateDetails, business_area=business_area) - - -def handle_household_data_update_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_household(TicketHouseholdDataUpdateDetails, business_area=business_area) - - -def handle_add_individual_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_household(TicketAddIndividualDetails, business_area=business_area) - - -def handle_delete_individual_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual(TicketDeleteIndividualDetails, business_area=business_area) - - -def handle_delete_household_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_delete_household_details(business_area=business_area) - - -def handle_system_flagging_details_tickets(business_area: Optional[BusinessArea] = None) -> None: - handle_tickets_with_individual( - TicketSystemFlaggingDetails, individual_field_name="golden_records_individual", business_area=business_area - ) - - -def handle_positive_feedback_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - positive_feedback_tickets = TicketPositiveFeedbackDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(positive_feedback_tickets, TicketPositiveFeedbackDetails) - handle_active_tickets_with_household_and_individual(positive_feedback_tickets, TicketPositiveFeedbackDetails) - - positive_feedback_tickets_representations = TicketPositiveFeedbackDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_bulk_update_representations_household_unicef_id( - positive_feedback_tickets_representations, - TicketPositiveFeedbackDetails, - ) - - -def handle_negative_feedback_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - negative_feedback_tickets = TicketNegativeFeedbackDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(negative_feedback_tickets, TicketNegativeFeedbackDetails) - handle_active_tickets_with_household_and_individual(negative_feedback_tickets, TicketNegativeFeedbackDetails) - - negative_feedback_tickets_representations = TicketNegativeFeedbackDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_bulk_update_representations_household_unicef_id( - negative_feedback_tickets_representations, - TicketNegativeFeedbackDetails, - ) - - -def handle_referral_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - referral_tickets = TicketReferralDetails.objects.filter( - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - handle_closed_tickets_with_household_and_individual(referral_tickets, TicketReferralDetails) - handle_active_tickets_with_household_and_individual(referral_tickets, TicketReferralDetails) - - referral_tickets_representations = TicketReferralDetails.objects.filter( - ticket__is_original=False, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - - handle_bulk_update_representations_household_unicef_id( - referral_tickets_representations, - TicketReferralDetails, - ) - - -def handle_needs_adjudication_tickets(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - needs_adjudication_tickets = ( - TicketNeedsAdjudicationDetails.objects.select_related( - "ticket", - "golden_records_individual", - ) - .filter(ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs) - .order_by("pk") - ) - - PossibleDuplicateThrough = TicketNeedsAdjudicationDetails.possible_duplicates.through - SelectedIndividualThrough = TicketNeedsAdjudicationDetails.selected_individuals.through - needs_adjudication_tickets_ids = list(needs_adjudication_tickets.values_list("pk", flat=True)) - tickets_count = len(needs_adjudication_tickets_ids) - logger.info(f"Tickets to handle: {tickets_count}") - for batch_start in range(0, tickets_count, BATCH_SIZE): - batched_ids = needs_adjudication_tickets_ids[batch_start : batch_start + BATCH_SIZE] - needs_adjudication_tickets_batch = ( - TicketNeedsAdjudicationDetails.objects.filter(id__in=batched_ids) - .select_related( - "ticket", - "golden_records_individual", - ) - .prefetch_related("possible_duplicates", "selected_individuals") - ) - logger.info(f"Handling needs adjudication tickets: {batch_start} of {tickets_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - - new_possible_duplicates_to_create = [] - new_selected_individuals_to_create = [] - - for needs_adjudication_ticket in needs_adjudication_tickets_batch: - individuals = [ - needs_adjudication_ticket.golden_records_individual, - *needs_adjudication_ticket.possible_duplicates.all(), - ] - program_ids = ( - Individual.objects.filter(id__in=[individual.id for individual in individuals]) - .values( - "copied_to__program", - ) - .annotate(program_count=Count("id")) - .filter(program_count__gt=1) - .values_list("copied_to__program", flat=True) - ) - programs = Program.objects.filter(id__in=program_ids) - if not programs: - grievance_ticket = needs_adjudication_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - continue - - for program in programs: - needs_adjudication_ticket_copy = copy.deepcopy(needs_adjudication_ticket) - if hasattr(needs_adjudication_ticket_copy, "role_reassign_data"): - needs_adjudication_ticket_copy = handle_role_reassign_data(needs_adjudication_ticket_copy, program) - if hasattr(needs_adjudication_ticket_copy, "extra_data"): - needs_adjudication_ticket_copy = handle_extra_data(needs_adjudication_ticket_copy, program) - needs_adjudication_ticket_copy.pk = None - # Copy Grievance Ticket - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - needs_adjudication_ticket_copy, - program, - needs_adjudication_ticket, - ) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(needs_adjudication_ticket_copy) - - possible_duplicates = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual.id, - ) - for individual in individuals - if individual - ] - possible_duplicates = [individual for individual in possible_duplicates if individual] - needs_adjudication_ticket_copy.golden_records_individual = possible_duplicates.pop() - - # Handle selected_individuals - old_selected_individuals = needs_adjudication_ticket.selected_individuals.all() - selected_individuals = [ - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=individual, - ) - for individual in old_selected_individuals - ] - selected_individuals = [individual for individual in selected_individuals if individual] - - new_possible_duplicates_to_create.extend( - [ - PossibleDuplicateThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in possible_duplicates - ] - ) - new_selected_individuals_to_create.extend( - [ - SelectedIndividualThrough( - ticketneedsadjudicationdetails=needs_adjudication_ticket_copy, - individual=individual, - ) - for individual in selected_individuals - ] - ) - - grievance_ticket = needs_adjudication_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data( - old_grievance_tickets_to_update, objects_to_create_dict, TicketNeedsAdjudicationDetails - ) - - PossibleDuplicateThrough.objects.bulk_create(new_possible_duplicates_to_create) - SelectedIndividualThrough.objects.bulk_create(new_selected_individuals_to_create) - - -def migrate_messages(business_area: Optional[BusinessArea] = None) -> None: - logger.info("Handle Messages") - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - message_objects = ( - Message.objects.select_related( - "target_population", - "target_population__program", - ) - # .prefetch_related( - # "households", - # "households__copied_to", - # ) - .filter(is_original=True, is_migration_handled=False, **filter_kwargs).distinct() - ) - - message_objects_ids = list(message_objects.values_list("pk", flat=True)) - message_objects_count = len(message_objects_ids) - logger.info(f"Messages to handle: {message_objects_count}") - for batch_start in range(0, message_objects_count, BATCH_SIZE): - message_objects_batched_ids = message_objects_ids[batch_start : batch_start + BATCH_SIZE] - message_objects_batch = Message.objects.filter(id__in=message_objects_batched_ids).select_related( - "target_population", - "target_population__program", - ) - logger.info(f"Handling messages: {batch_start} of {message_objects_count}") - new_messages_to_create = [] - message_household_to_create = [] - old_messages_to_update = [] - for message in message_objects_batch: - if message.households.exists(): - if message.target_population: - program = message.target_population.program - message_copy, message_household = copy_message(message, program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - - message.is_migration_handled = True - message.migrated_at = timezone.now() - old_messages_to_update.append(message) - else: - programs = list(message.households.values_list("copied_to__program", flat=True).distinct()) - for program in programs: - message_copy, message_household = copy_message(message, program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - message.is_migration_handled = True - message.migrated_at = timezone.now() - old_messages_to_update.append(message) - Message.objects.bulk_create(new_messages_to_create) - MessageHouseholdRelation = Message.households.through - MessageHouseholdRelation.objects.bulk_create(message_household_to_create) - Message.objects.bulk_update(old_messages_to_update, ["is_migration_handled", "migrated_at"]) - logger.info("Handle Messages not connected to any program") - handle_non_program_messages(business_area) - - -def copy_message(active_message: Message, program: Program) -> tuple: - message = copy.deepcopy(active_message) - message.pk = None - message.is_original = False - message.copied_from = active_message - message.unicef_id = None - if isinstance(program, Program): - message.program = program - else: - message.program_id = program - - households_representations = [ - get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=household.id, - ) - for household in active_message.households.all().only("id") - ] - households_representations = [household for household in households_representations if household] - MessageHouseholdRelation = Message.households.through - message_household = [ - MessageHouseholdRelation(message=message, household_id=household.id) for household in households_representations - ] - return message, message_household - - -def migrate_feedback(business_area: Optional[BusinessArea] = None) -> None: - logger.info("Handle Feedback objects") - # Handle closed Feedback (Feedback related to a closed grievance ticket) OR Feedback with program - copy_feedback_to_specific_program(business_area) - # Handle active Feedback objects without program - - # (Feedback with active tickets OR Feedback not related to any ticket) AND without defined program - handle_active_feedback(business_area) - logger.info("Handle Feedback not connected to any program") - handle_non_program_feedback(business_area) - - -def copy_feedback_to_specific_program(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - feedback_objects_for_specific_program = ( - Feedback.objects.select_related( - "program", - "household_lookup", - "individual_lookup", - "linked_grievance", - "household_lookup__program", - "individual_lookup__program", - ) - .filter( - (Q(linked_grievance__status=GrievanceTicket.STATUS_CLOSED) | Q(program__isnull=False)) - & Q(is_original=True) - & Q(is_migration_handled=False) - ) - .filter(**filter_kwargs) - .distinct() - ) - logger.info("Handle Feedback objects with program or closed grievance ticket") - - feedback_objects_for_specific_program_ids = list(feedback_objects_for_specific_program.values_list("pk", flat=True)) - feedback_objects_for_specific_program_count = len(feedback_objects_for_specific_program_ids) - logger.info(f"Feedback objects to handle: {feedback_objects_for_specific_program_count}") - for batch_start in range(0, feedback_objects_for_specific_program_count, BATCH_SIZE): - feedback_objects_for_specific_program_batched_ids = feedback_objects_for_specific_program_ids[ - batch_start : batch_start + BATCH_SIZE - ] - feedback_objects_for_specific_program_batch = Feedback.objects.filter( - id__in=feedback_objects_for_specific_program_batched_ids - ).select_related( - "program", - "household_lookup", - "individual_lookup", - "linked_grievance", - "household_lookup__program", - "individual_lookup__program", - ) - logger.info( - f"Handling feedbacks to specific program: {batch_start} of {feedback_objects_for_specific_program_count}" - ) - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback_obj in feedback_objects_for_specific_program_batch: - household_representation = None - individual_representation = None - if feedback_obj.program: - program = feedback_obj.program - if feedback_obj.household_lookup: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=feedback_obj.household_lookup, - ) - if feedback_obj.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_obj.individual_lookup, - ) - elif feedback_obj.household_lookup: - if household_representation := feedback_obj.household_lookup.copied_to( - manager="original_and_repr_objects" - ).first(): - program = household_representation.program - if feedback_obj.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_obj.individual_lookup, - ) - elif feedback_obj.individual_lookup: - if individual_representation := feedback_obj.individual_lookup.copied_to( - manager="original_and_repr_objects" - ).first(): - program = individual_representation.program - else: - program = None - - if program: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback_obj, program, household_representation, individual_representation) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback_obj.is_migration_handled = True - feedback_obj.migrated_at = timezone.now() - old_feedbacks_to_update.append(feedback_obj) - if linked_grievance := feedback_obj.linked_grievance: - linked_grievance.is_migration_handled = True - linked_grievance.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(linked_grievance) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.objects.bulk_update(old_feedbacks_to_update, ["is_migration_handled", "migrated_at"]) - - -def handle_active_feedback(business_area: Optional[BusinessArea] = None) -> None: - if business_area: - filter_kwargs = {"business_area": business_area} - else: - filter_kwargs = {} - active_feedback_objects = ( - Feedback.objects.select_related( - "linked_grievance", - "program", - "household_lookup", - "individual_lookup", - "household_lookup__program", - "individual_lookup__program", - ) - .prefetch_related( - "feedback_messages", - ) - .filter( - (Q(linked_grievance__isnull=True) | ~Q(linked_grievance__status=GrievanceTicket.STATUS_CLOSED)) - & Q(program__isnull=True) - & Q(is_original=True) - & Q(is_migration_handled=False) - ) - .filter(**filter_kwargs) - .distinct() - ) - logger.info("Handle Feedback objects without program and without closed grievance ticket") - - active_feedback_objects_ids = list(active_feedback_objects.values_list("pk", flat=True)) - active_feedback_objects_count = len(active_feedback_objects_ids) - logger.info(f"Active Feedback objects to handle: {active_feedback_objects_count}") - for batch_start in range(0, active_feedback_objects_count, BATCH_SIZE): - active_feedback_objects_batched_ids = active_feedback_objects_ids[batch_start : batch_start + BATCH_SIZE] - active_feedback_objects_batch = Feedback.objects.filter( - id__in=active_feedback_objects_batched_ids - ).select_related( - "linked_grievance", - "program", - "household_lookup", - "individual_lookup", - "household_lookup__program", - "individual_lookup__program", - ) - logger.info(f"Handling active feedbacks: {batch_start} of {active_feedback_objects_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback_obj in active_feedback_objects_batch: - if feedback_obj.individual_lookup: - individual_representations = feedback_obj.individual_lookup.copied_to( - manager="original_and_repr_objects" - ).all() - else: - individual_representations = Individual.objects.none() - if feedback_obj.household_lookup: - household_representations = feedback_obj.household_lookup.copied_to( - manager="original_and_repr_objects" - ).all() - else: - household_representations = Household.objects.none() - if individual_representations or household_representations: - household_programs = household_representations.values_list("program", flat=True).distinct() - individual_programs = individual_representations.values_list("program", flat=True).distinct() - - all_programs = ( - Program.objects.filter(Q(id__in=household_programs) | Q(id__in=individual_programs)) - .distinct() - .iterator() - ) - - for program in all_programs: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback_obj, program) - - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback_obj.is_migration_handled = True - feedback_obj.migrated_at = timezone.now() - old_feedbacks_to_update.append(feedback_obj) - - if linked_grievance := feedback_obj.linked_grievance: - linked_grievance.is_migration_handled = True - linked_grievance.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(linked_grievance) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.objects.bulk_update(old_feedbacks_to_update, ["is_migration_handled", "migrated_at"]) - - -def copy_feedback( - feedback_obj: Feedback, - program: Program, - household_representation: Optional[Household] = None, - individual_representation: Optional[Individual] = None, -) -> tuple: - feedback_copy = copy.deepcopy(feedback_obj) - if not household_representation and feedback_copy.household_lookup: - household_representation = get_household_representation_per_program_by_old_household_id( - program=program, - old_household_id=feedback_copy.household_lookup, - ) - feedback_copy.household_lookup = household_representation - - if not individual_representation and feedback_copy.individual_lookup: - individual_representation = get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=feedback_copy.individual_lookup, - ) - feedback_copy.individual_lookup = individual_representation - - feedback_copy.pk = None - feedback_copy.is_original = False - feedback_copy.copied_from = feedback_obj - feedback_copy.unicef_id = None - if feedback_copy.linked_grievance: - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - feedback_copy, program, feedback_obj, related_grievance_field="linked_grievance" - ) - else: - grievance_ticket_data, notes_to_create, documents_to_create = {}, [], [] - - feedback_copy.program = program - messages_to_create = [] - for message in feedback_obj.feedback_messages.all(): - message_copy = copy.deepcopy(message) - message_copy.pk = None - message_copy.feedback = feedback_copy - messages_to_create.append(message_copy) - - return feedback_copy, grievance_ticket_data, notes_to_create, documents_to_create, messages_to_create - - -def copy_grievance_ticket( - ticket_copy: Any, - program: Program, - original_ticket: Any, - related_grievance_field: str = "ticket", -) -> tuple: - grievance_ticket = getattr(ticket_copy, related_grievance_field) - original_grievance_ticket_id = grievance_ticket.pk - grievance_ticket.pk = None - grievance_ticket.unicef_id = None - grievance_ticket.is_original = False - grievance_ticket.copied_from_id = original_grievance_ticket_id - - grievance_ticket_data = { - "grievance_ticket": grievance_ticket, - "program": program, - } - notes_to_create = [] - for note in getattr(original_ticket, related_grievance_field).ticket_notes.all(): - note.pk = None - note.ticket = grievance_ticket - notes_to_create.append(note) - - documents_to_create = [] - for document in getattr(original_ticket, related_grievance_field).support_documents.all(): - document.pk = None - document.grievance_ticket = grievance_ticket - documents_to_create.append(document) - - setattr(ticket_copy, related_grievance_field, grievance_ticket) - - return grievance_ticket_data, notes_to_create, documents_to_create - - -def migrate_linked_tickets(business_area: Optional[BusinessArea] = None) -> None: - logger.info(f"Handling linked tickets for business area: {business_area}") - - filter_params = {} - if business_area: - filter_params["business_area"] = business_area - - tickets_representations_ids = list( - GrievanceTicket.default_for_migrations_fix.filter(**filter_params, is_original=False).values_list( - "id", flat=True - ) - ) - tickets_representations_count = len(tickets_representations_ids) - logger.info(f"Tickets representations to handle: {tickets_representations_count}") - for batch_start in range(0, tickets_representations_count, BATCH_SIZE): - batched_ids = tickets_representations_ids[batch_start : batch_start + BATCH_SIZE] - tickets_representations = GrievanceTicket.default_for_migrations_fix.filter(id__in=batched_ids).select_related( - "copied_from" - ) - # Link all linked_tickets representations with current ticket_representation - linked_tickets_to_create = [] - for ticket_representation in tickets_representations: - original_ticket = ticket_representation.copied_from - linked_tickets_representations = GrievanceTicket.default_for_migrations_fix.filter( - copied_from__linked_tickets__in=[original_ticket] - ).distinct() - for linked_ticket_representation in linked_tickets_representations: - linked_tickets_to_create.extend( - [ - GrievanceTicketThrough( - main_ticket=ticket_representation, - linked_ticket=linked_ticket_representation, - ), - GrievanceTicketThrough( - main_ticket=linked_ticket_representation, - linked_ticket=ticket_representation, - ), - ] - ) - # Link all representations of the same ticket with current representation - for ticket_other_representation in original_ticket.copied_to(manager="default_for_migrations_fix").all(): - if ticket_other_representation.pk != ticket_representation.pk: - linked_tickets_to_create.extend( - [ - GrievanceTicketThrough( - main_ticket=ticket_representation, - linked_ticket=ticket_other_representation, - ), - GrievanceTicketThrough( - main_ticket=ticket_other_representation, - linked_ticket=ticket_representation, - ), - ] - ) - - GrievanceTicketThrough.objects.bulk_create(linked_tickets_to_create, ignore_conflicts=True) - - -def handle_grievance_ticket_data_creation(grievance_ticket_data: list) -> None: - """ - Function that bulk creates grievance tickets, add their linked tickets and programs relation. - grievance_ticket_data consists of 3 keys: - - grievance_ticket: GrievanceTicket object list - - program: Program for which GrievanceTicket is created ( in many-to-many relation "programs") - """ - GrievanceTicketProgram = GrievanceTicket.programs.through - - grievance_tickets = [gt["grievance_ticket"] for gt in grievance_ticket_data] - grievance_tickets_program = [] - for grievance_ticket in grievance_ticket_data: - program_id = ( - grievance_ticket["program"].pk - if isinstance(grievance_ticket["program"], Program) - else grievance_ticket["program"] - ) - grievance_tickets_program.append( - GrievanceTicketProgram(grievanceticket=grievance_ticket["grievance_ticket"], program_id=program_id) - ) - - GrievanceTicket.objects.bulk_create(grievance_tickets) - GrievanceTicketProgram.objects.bulk_create(grievance_tickets_program, ignore_conflicts=True) - - -def handle_bulk_create_paginated_data( - old_grievance_tickets_to_update: list, objects_to_create_dict: dict, model: Any -) -> None: - handle_grievance_ticket_data_creation(objects_to_create_dict["grievance_tickets"]) - TicketNote.objects.bulk_create(objects_to_create_dict["notes"]) - GrievanceDocument.objects.bulk_create(objects_to_create_dict["documents"]) - GrievanceTicket.objects.bulk_update(old_grievance_tickets_to_update, ["is_migration_handled", "migrated_at"]) - model.objects.bulk_create(objects_to_create_dict["tickets"]) - - -def handle_bulk_update_representations_household_unicef_id(query: QuerySet, model: Any) -> None: - related_name = ticket_grievance_ticket_field_name_mapping[model] - GrievanceTicket.default_for_migrations_fix.filter(**{f"{related_name}__in": query}).update( - household_unicef_id=Subquery( - GrievanceTicket.default_for_migrations_fix.filter(pk=OuterRef("pk")).values( - f"{related_name}__household__unicef_id" - )[:1] - ) - ) - - -def create_void_program(business_area: BusinessArea) -> Program: - return Program.all_objects.get_or_create( - name="Storage Program For Non-Program Grievance And Accountability", - business_area=business_area, - defaults=dict( - status=Program.DRAFT, - start_date=timezone.datetime.min, - end_date=timezone.datetime.max, - budget=0, - frequency_of_payments=Program.ONE_OFF, - sector=Program.CHILD_PROTECTION, - scope=Program.SCOPE_FOR_PARTNERS, - cash_plus=True, - population_goal=1, - is_visible=False, - ), - )[0] - - -def handle_non_program_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Handle tickets that are not connected to any program. They should be moved to dummy program. - Exclude payment-related-tickets that will be handled during sync. - """ - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_query = ( - Q(ticket__business_area=business_area) & Q(ticket__is_migration_handled=False) & Q(ticket__is_original=True) - ) - non_program_tickets_dict = { - TicketComplaintDetails: TicketComplaintDetails.objects.filter( - non_program_query & ~Q(payment_object_id__isnull=False) - ).order_by("id"), - TicketSensitiveDetails: TicketSensitiveDetails.objects.filter( - non_program_query & ~Q(payment_object_id__isnull=False) - ).order_by("id"), - TicketPaymentVerificationDetails: TicketPaymentVerificationDetails.objects.filter( - non_program_query - & ~(Q(payment_verification__isnull=False) & Q(payment_verification__payment_object_id__isnull=False)) - ).order_by("id"), - TicketHouseholdDataUpdateDetails: TicketHouseholdDataUpdateDetails.objects.filter( - non_program_query - ).order_by("id"), - TicketIndividualDataUpdateDetails: TicketIndividualDataUpdateDetails.objects.filter( - non_program_query - ).order_by("id"), - TicketAddIndividualDetails: TicketAddIndividualDetails.objects.filter(non_program_query).order_by("id"), - TicketDeleteIndividualDetails: TicketDeleteIndividualDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketDeleteHouseholdDetails: TicketDeleteHouseholdDetails.objects.filter(non_program_query).order_by("id"), - TicketSystemFlaggingDetails: TicketSystemFlaggingDetails.objects.filter(non_program_query).order_by("id"), - TicketPositiveFeedbackDetails: TicketPositiveFeedbackDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketNegativeFeedbackDetails: TicketNegativeFeedbackDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketNeedsAdjudicationDetails: TicketNeedsAdjudicationDetails.objects.filter(non_program_query).order_by( - "id" - ), - TicketReferralDetails: TicketReferralDetails.objects.filter(non_program_query).order_by("id"), - } - - void_program = create_void_program(business_area) # type: ignore[arg-type] - for model, query in non_program_tickets_dict.items(): - objects_ids = list(query.values_list("pk", flat=True)) - objects_count = len(objects_ids) - logger.info(f"Non-program tickets of type {model.__name__} to handle: {objects_count}") - for batch_start in range(0, objects_count, BATCH_SIZE): - objects_batched_ids = objects_ids[batch_start : batch_start + BATCH_SIZE] - objects_batch = model.objects.filter(id__in=objects_batched_ids).select_related("ticket") - logger.info(f"Handling non-program tickets of type {model.__name__}: {batch_start} of {objects_count}") - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - for non_program_ticket in objects_batch: - ticket_copy = copy.deepcopy(non_program_ticket) - ticket_copy.pk = None - non_program_ticket.pk = None - grievance_ticket_data, notes_to_create, documents_to_create = copy_grievance_ticket( - ticket_copy, void_program, non_program_ticket - ) - - objects_to_create_dict["tickets"].append(ticket_copy) - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["documents"].extend(documents_to_create) - objects_to_create_dict["notes"].extend(notes_to_create) - - grievance_ticket = non_program_ticket.ticket - grievance_ticket.is_migration_handled = True - grievance_ticket.migrated_at = timezone.now() - old_grievance_tickets_to_update.append(grievance_ticket) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, model) - - -def handle_non_program_feedback(business_area: Optional[BusinessArea] = None) -> None: - """ - Handle feedback that is not connected to any project. They should be moved to dummy program. - """ - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_feedback_objects = Feedback.objects.filter( - is_original=True, is_migration_handled=False, business_area=business_area - ) - if non_program_feedback_objects: - void_program = create_void_program(business_area) # type: ignore[arg-type] - - non_program_feedback_objects_ids = list(non_program_feedback_objects.values_list("pk", flat=True)) - non_program_feedback_objects_count = len(non_program_feedback_objects_ids) - logger.info(f"Non-program feedback objects to handle: {non_program_feedback_objects_count}") - for batch_start in range(0, non_program_feedback_objects_count, BATCH_SIZE): - non_program_feedback_objects_batched_ids = non_program_feedback_objects_ids[ - batch_start : batch_start + BATCH_SIZE - ] - non_program_feedback_objects_batch = Feedback.objects.filter( - id__in=non_program_feedback_objects_batched_ids - ).select_related("linked_grievance") - logger.info( - f"Handling non-program feedback objects: {batch_start} of {non_program_feedback_objects_count}" - ) - objects_to_create_dict = { - "notes": [], - "documents": [], - "grievance_tickets": [], - "tickets": [], - } - old_grievance_tickets_to_update = [] - old_feedbacks_to_update = [] - new_feedback_messages_to_create = [] - - for feedback in non_program_feedback_objects_batch: - ( - feedback_copy, - grievance_ticket_data, - notes_to_create, - documents_to_create, - messages_to_create, - ) = copy_feedback(feedback, void_program) - objects_to_create_dict["notes"].extend(notes_to_create) - objects_to_create_dict["documents"].extend(documents_to_create) - if grievance_ticket_data: - objects_to_create_dict["grievance_tickets"].append(grievance_ticket_data) - objects_to_create_dict["tickets"].append(feedback_copy) - new_feedback_messages_to_create.extend(messages_to_create) - - feedback.is_migration_handled = True - feedback.migrated_at = timezone.now() - old_feedbacks_to_update.append(feedback) - - handle_bulk_create_paginated_data(old_grievance_tickets_to_update, objects_to_create_dict, Feedback) - FeedbackMessage.objects.bulk_create(new_feedback_messages_to_create) - Feedback.objects.bulk_update(old_feedbacks_to_update, ["is_migration_handled", "migrated_at"]) - - -def handle_non_program_messages(business_area: Optional[BusinessArea] = None) -> None: - business_areas = [business_area] if business_area else BusinessArea.objects.all().iterator() - for business_area in business_areas: - non_program_messages = Message.objects.filter( - is_original=True, business_area=business_area, is_migration_handled=False - ) - if non_program_messages: - void_program = create_void_program(business_area) # type: ignore[arg-type] - - non_program_message_objects_ids = list(non_program_messages.values_list("pk", flat=True)) - non_program_message_objects_count = len(non_program_message_objects_ids) - logger.info(f"Non-program message objects to handle: {non_program_message_objects_count}") - for batch_start in range(0, non_program_message_objects_count, BATCH_SIZE): - non_program_message_objects_batched_ids = non_program_message_objects_ids[ - batch_start : batch_start + BATCH_SIZE - ] - non_program_message_objects_batch = Message.objects.filter( - id__in=non_program_message_objects_batched_ids - ) - logger.info( - f"Handling non-program message objects: {batch_start} of {non_program_message_objects_count}" - ) - new_messages_to_create = [] - message_household_to_create = [] - old_messages_to_update = [] - for message in non_program_message_objects_batch: - message_copy, message_household = copy_message(message, void_program) - new_messages_to_create.append(message_copy) - message_household_to_create.extend(message_household) - message.is_migration_handled = True - message.migrated_at = timezone.now() - old_messages_to_update.append(message) - Message.objects.bulk_create(new_messages_to_create) - MessageHouseholdRelation = Message.households.through - MessageHouseholdRelation.objects.bulk_create(message_household_to_create) - Message.objects.bulk_update(old_messages_to_update, ["is_migration_handled", "migrated_at"]) - - -def handle_role_reassign_data(ticket: Any, program: Program) -> Any: - """ - role_reassign_data structure: - { - role_uuid / "HEAD": { - "household": household_encoded_id, - "individual": individual_encoded_id, - "role": role - }, - ... - } - """ - - def retrieve_household_representation(household_from_json: Household, program: Program) -> Optional[Household]: - if ( - household_from_json_in_program := household_from_json.copied_to(manager="original_and_repr_objects") - .filter(program=program) - .first() - ): - encoded_id = encode_id_base64(household_from_json_in_program.id, "Household") - role_data["household"] = encoded_id - return household_from_json_in_program - - def retrieve_individual_representation(individual_from_json: Individual, program: Program) -> Optional[Individual]: - if ( - individual_from_json_in_program := individual_from_json.copied_to(manager="original_and_repr_objects") - .filter(program=program) - .first() - ): - encoded_id = encode_id_base64(individual_from_json_in_program.id, "Individual") - role_data["individual"] = encoded_id - return individual_from_json_in_program - - def retrieve_role_from_program(role_from_json: IndividualRoleInHousehold, program: Program) -> Optional[Individual]: - role_household_in_program = ( - role_from_json.household.copied_to(manager="original_and_repr_objects").filter(program=program).first() - ) - role_individual_in_program = ( - role_from_json.individual.copied_to(manager="original_and_repr_objects").filter(program=program).first() - ) - - role_from_json_in_program = IndividualRoleInHousehold.original_and_repr_objects.filter( - household=role_household_in_program, individual=role_individual_in_program - ).first() - return role_from_json_in_program - - if not ticket.role_reassign_data: - return ticket - - new_role_reassign_data = {} - for role_uuid, role_data in ticket.role_reassign_data.items(): - role_data_to_extend = {} - - household_from_json = Household.objects.filter(id=decode_id_string(role_data.get("household"))).first() - # Fetch correct household representation from JSON - household_from_json_in_program = ( - retrieve_household_representation(household_from_json, program) if household_from_json else None - ) - - individual_from_json = Individual.objects.filter(id=decode_id_string(role_data.get("individual"))).first() - # Fetch correct individual representation from JSON - individual_from_json_in_program = ( - retrieve_individual_representation(individual_from_json, program) if individual_from_json else None - ) - - if household_from_json_in_program and individual_from_json_in_program: - if role_uuid == "HEAD": - role_data_to_extend["HEAD"] = role_data - else: - role_from_json = IndividualRoleInHousehold.objects.filter(id=role_uuid).first() - # Fetch correct role representation from JSON - role_from_json_in_program = ( - retrieve_role_from_program(role_from_json, program) if role_from_json else None - ) - if role_from_json_in_program: - role_data_to_extend[str(role_from_json_in_program.id)] = role_data - - if role_data_to_extend: - new_role_reassign_data.update(role_data_to_extend) - - ticket.role_reassign_data = new_role_reassign_data - return ticket - - -def handle_extra_data(ticket: Any, program: Program) -> Any: - """ - extra_data structure: - { - "golden_records": [ - { - "dob": date_of_birth, - "full_name": full_name, - "hit_id": hit_id, - "location": location, - "proximity_to_score": proximity_to_score, - "score": score - }, - ... - ], - "possible_duplicate": [ - { - "dob": date_of_birth, - "full_name": full_name, - "hit_id": hit_id, - "location": location, - "proximity_to_score": proximity_to_score, - "score": score - }, - ... - ] - } - """ - - if not ticket.extra_data: - return ticket - - for list_data in ticket.extra_data.values(): - for ind_data in list_data: - id_found = False - hit_from_json = Individual.objects.filter(id=ind_data.get("hit_id")).first() - # Fetch correct individual representation from JSON - if hit_from_json: - hit_from_json_in_program = ( - hit_from_json.copied_to(manager="original_and_repr_objects").filter(program=program).first() - ) - if hit_from_json_in_program: - id_found = True - ind_data["hit_id"] = str(hit_from_json_in_program.id) - if id_found is False: - list_data.remove(ind_data) - - # ticket.save() - return ticket - - -def handle_individual_data( - ticket: TicketIndividualDataUpdateDetails, program: Program -) -> TicketIndividualDataUpdateDetails: - """ - individual_data consists of multiple values, but only some have ids. - These are: [documents/identities/payment_channels]_to_remove and _to_edit. - Structure of individual_data: - { - "_to_remove": [ - { - "approve_status": bool, - "value": "base64_id_of_object_to_remove" - } - ] - "_to_edit": [ - { - "approve_status": bool, - "previous_value": { - "id": base64_object_id, - (if not document) - "individual": base64_individual_id, - **other_object_specific_fields - }, - "value": { - "id": base64_object_id(the same as the one above), - (if not document) - "individual": base64_individual_id, - **other_object_specific_fields - } - } - ], - also for _to_remove objects there are corresponding previous_[documents/identities/payment_channels]. - { - "base64_object_id": { - "id": same as base64_object_id(same as value in _to_remove), - "individual" base64_document_individual_id, - **object specific data - } - } - } - """ - individual = ticket.individual - individual_in_program = individual.copied_to(manager="original_and_repr_objects").filter(program=program).first() - if not individual_in_program: - return ticket - - encoded_individual_id = encode_id_base64(individual_in_program.id, "Individual") - individual_data = ticket.individual_data - if not individual_data: - return ticket - - for model in (Document, IndividualIdentity, BankAccountInfo): - IndividualDataObjectsToEditHandler( - individual_data, - individual_in_program, - model, - encoded_individual_id, - ).handle_objects_to_edit() - IndividualDataObjectsToRemoveHandler( - individual_data, - individual_in_program, - model, - encoded_individual_id, - ).handle_objects_to_remove() - - ticket.individual_data = individual_data - # ticket.save(update_fields=["individual_data"]) - return ticket - - -class IndividualDataObjectsToRemoveHandler: - def __init__( - self, - individual_data: dict, - individual_in_program: Individual, - model: Any, - encoded_individual_id: Optional[str], - ) -> None: - self.individual_data = individual_data - self.model = model - self.objects_to_remove_string, self.previous_objects_string = self.object_specific_update_fields() - self.individual_in_program = individual_in_program - self.encoded_individual_id = encoded_individual_id - - def object_specific_update_fields(self) -> tuple[str, str]: - model_related_string = { - Document: "documents", - IndividualIdentity: "identities", - BankAccountInfo: "payment_channels", - }[self.model] - return f"{model_related_string}_to_remove", f"previous_{model_related_string}" - - def object_specific_get_fields(self, previous_object: dict) -> dict: - if self.model == IndividualIdentity: - return { - "country__iso_code3": previous_object.get("country"), - "number": previous_object.get("number"), - "partner__name": previous_object.get("partner"), - } - elif self.model == Document: - return { - "document_number": previous_object.get("document_number"), - "country__iso_code3": previous_object.get("country"), - "type__key": previous_object.get("key"), - } - else: - return { - "bank_name": previous_object.get("bank_name"), - "bank_account_number": previous_object.get("bank_account_number"), - } - - def handle_individual_data_update( - self, - index: int, - object_in_program_encoded_id: Optional[str], - object_to_remove_id: str, - ) -> None: - self.individual_data[self.objects_to_remove_string][index]["value"] = object_in_program_encoded_id - self.individual_data[self.previous_objects_string][object_to_remove_id]["id"] = object_in_program_encoded_id - self.individual_data[self.previous_objects_string][object_to_remove_id][ - "individual" - ] = self.encoded_individual_id - if object_in_program_encoded_id != object_to_remove_id: - self.individual_data[self.previous_objects_string][object_in_program_encoded_id] = copy.deepcopy( - self.individual_data[self.previous_objects_string][object_to_remove_id] - ) - del self.individual_data[self.previous_objects_string][object_to_remove_id] - - def handle_objects_to_remove(self) -> None: - for index, object_to_remove in enumerate(self.individual_data.get(self.objects_to_remove_string, [])): - object_to_remove_id = object_to_remove.get("value") - previous_object = self.individual_data.get(self.previous_objects_string, {}).get(object_to_remove_id, {}) - if not previous_object: - continue - object_in_program = self.model.original_and_repr_objects.filter( - individual=self.individual_in_program, - **self.object_specific_get_fields(previous_object), - ).first() - if object_in_program: - object_in_program_encoded_id = encode_id_base64(object_in_program.id, self.model.__name__) - self.handle_individual_data_update( - index, - object_in_program_encoded_id, - object_to_remove_id, - ) - - -class IndividualDataObjectsToEditHandler: - def __init__( - self, - individual_data: dict, - individual_in_program: Individual, - model: Any, - encoded_individual_id: Optional[str], - ) -> None: - self.individual_data = individual_data - self.model = model - self.objects_to_edit_string = self.object_specific_edit_fields() - self.individual_in_program = individual_in_program - self.encoded_individual_id = encoded_individual_id - - def object_specific_edit_fields(self) -> str: - model_related_string = { - Document: "documents", - IndividualIdentity: "identities", - BankAccountInfo: "payment_channels", - }[self.model] - return f"{model_related_string}_to_edit" - - def get_object_specific_fields(self, previous_value: dict) -> dict: - if self.model == IndividualIdentity: - return { - "country__iso_code3": previous_value.get("country"), - "number": previous_value.get("number"), - "partner__name": previous_value.get("partner"), - } - elif self.model == Document: - return { - "document_number": previous_value.get("number"), - "country__iso_code3": previous_value.get("country"), - } - else: - return { - "bank_name": previous_value.get("bank_name"), - "bank_account_number": previous_value.get("bank_account_number"), - } - - def handle_objects_to_edit(self) -> None: - for index, object_to_edit in enumerate(self.individual_data.get(self.objects_to_edit_string, [])): - object_in_program = self.model.original_and_repr_objects.filter( - individual=self.individual_in_program, - **self.get_object_specific_fields(object_to_edit.get("previous_value", {})), - ).first() - if not object_in_program: - object_in_program = self.model.original_and_repr_objects.filter( - individual=self.individual_in_program, - **self.get_object_specific_fields(object_to_edit.get("value", {})), - ).first() - if not object_in_program: - continue - object_in_program_encoded_id = encode_id_base64(object_in_program.id, self.model.__name__) - self.individual_data[self.objects_to_edit_string][index]["value"]["id"] = object_in_program_encoded_id - self.individual_data[self.objects_to_edit_string][index]["previous_value"][ - "id" - ] = object_in_program_encoded_id - if self.model != Document: - self.individual_data[self.objects_to_edit_string][index]["value"][ - "individual" - ] = self.encoded_individual_id - self.individual_data[self.objects_to_edit_string][index]["previous_value"][ - "individual" - ] = self.encoded_individual_id - - -def handle_payment_related_tickets(business_area: Optional[BusinessArea] = None) -> None: - """ - Assign grievance tickets to representations. Applied for tickets connected to specific payment. - Handle TicketComplaintDetails, TicketSensitiveDetails, TicketPaymentVerificationDetails with related payment_obj - """ - if business_area: - filter_kwargs = {"ticket__business_area": business_area} - else: - filter_kwargs = {} - # Fetch all objects of TicketComplaintDetails and TicketSensitiveDetails with non-null payment_obj - complaint_tickets_with_payments = TicketComplaintDetails.objects.select_related( - "household", - "individual", - ).filter( - payment_object_id__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - sensitive_tickets_with_payments = TicketSensitiveDetails.objects.select_related( - "household", - "individual", - ).filter( - payment_object_id__isnull=False, ticket__is_original=True, ticket__is_migration_handled=False, **filter_kwargs - ) - - complaint_and_sensitive_details_tickets = chain(complaint_tickets_with_payments, sensitive_tickets_with_payments) - - # Update household and individual fields based on payment_obj for TicketComplaintDetails and TicketSensitiveDetails - for ticket in complaint_and_sensitive_details_tickets: - household, individual, program = get_program_and_representations_for_payment(ticket) - ticket.household = household - ticket.individual = individual - if program: - ticket.ticket.programs.set([program]) - - # Perform a bulk update for the household and individual fields of TicketComplaintDetails and TicketSensitiveDetails - TicketComplaintDetails.objects.bulk_update(complaint_tickets_with_payments, ["household", "individual"]) - TicketSensitiveDetails.objects.bulk_update(sensitive_tickets_with_payments, ["household", "individual"]) - - # Update household_unicef_id for all related GrievanceTickets - # Fetch the GrievanceTickets related to the updated objects - grievance_tickets = GrievanceTicket.default_for_migrations_fix.filter( - Q(complaint_ticket_details__in=complaint_tickets_with_payments) - | Q(sensitive_ticket_details__in=sensitive_tickets_with_payments) - ).distinct() - # Update household_unicef_id for each GrievanceTicket using bulk_update - for grievance_ticket in grievance_tickets: - related_ticket = getattr(grievance_ticket, "complaint_ticket_details", None) or getattr( - grievance_ticket, "sensitive_ticket_details", None - ) - household_unicef_id = getattr(related_ticket.household, "unicef_id", None) - grievance_ticket.household_unicef_id = household_unicef_id - - GrievanceTicket.objects.bulk_update(grievance_tickets, ["household_unicef_id"]) - - # Update programs for TicketPaymentVerificationDetails with payment_obj - payment_verification_tickets = ( - TicketPaymentVerificationDetails.objects.select_related( - "payment_verification", - ) - .filter( - payment_verification__isnull=False, - payment_verification__payment_object_id__isnull=False, - ticket__is_original=True, - ticket__is_migration_handled=False, - **filter_kwargs, - ) - .distinct() - ) - for payment_verification_ticket in payment_verification_tickets: - payment_obj = payment_verification_ticket.payment_verification.payment_obj - if isinstance(payment_obj, Payment): - program = payment_obj.parent.target_population.program - elif isinstance(payment_obj, PaymentRecord): - program = payment_obj.target_population.program - else: - program = None - if program: - payment_verification_ticket.ticket.programs.set([program]) - - GrievanceTicket.default_for_migrations_fix.filter( - Q(complaint_ticket_details__in=complaint_tickets_with_payments) - | Q(sensitive_ticket_details__in=sensitive_tickets_with_payments) - | Q(payment_verification_ticket_details__in=payment_verification_tickets) - ).update(is_original=False, is_migration_handled=True) - - -def get_program_and_representations_for_payment(ticket: Union[TicketComplaintDetails, TicketSensitiveDetails]) -> tuple: - if isinstance(ticket.payment_obj, Payment): - program = ticket.payment_obj.parent.target_population.program - elif isinstance(ticket.payment_obj, PaymentRecord): - program = ticket.payment_obj.target_population.program - else: - program = None - household_representation = ( - get_household_representation_per_program_by_old_household_id(program=program, old_household_id=ticket.household) - if ticket.household - else None - ) - individual_representation = ( - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=ticket.individual, - ) - if ticket.individual - else None - ) - return household_representation, individual_representation, program - - -def delete_representations_from_ba(business_area: BusinessArea) -> None: - GrievanceTicket.default_for_migrations_fix.filter(business_area=business_area, is_original=False).delete() - GrievanceTicket.objects.filter(business_area=business_area).update(is_migration_handled=False, migrated_at=None) - Feedback.original_and_repr_objects.filter(business_area=business_area, is_original=False).delete() - Feedback.objects.filter(business_area=business_area).update(is_migration_handled=False, migrated_at=None) - Message.original_and_repr_objects.filter(business_area=business_area, is_original=False).delete() - Message.objects.filter(business_area=business_area).update(is_migration_handled=False, migrated_at=None) diff --git a/src/hct_mis_api/one_time_scripts/populate_existing_representations_with_migrated_at_data.py b/src/hct_mis_api/one_time_scripts/populate_existing_representations_with_migrated_at_data.py deleted file mode 100644 index 3d306b6d12..0000000000 --- a/src/hct_mis_api/one_time_scripts/populate_existing_representations_with_migrated_at_data.py +++ /dev/null @@ -1,46 +0,0 @@ -import logging - -from django.utils import timezone - -from hct_mis_api.apps.accountability.models import Feedback, Message -from hct_mis_api.apps.grievance.models import GrievanceTicket -from hct_mis_api.apps.household.models import ( - Household, - Individual, - IndividualRoleInHousehold, -) - -logger = logging.getLogger(__name__) - - -def accountability_populate_existing_representations_with_migrated_at_data() -> None: - now = timezone.now() - Feedback.objects.filter(migrated_at__isnull=True, is_migration_handled=True, is_original=True).update( - migrated_at=now - ) - Message.objects.filter(migrated_at__isnull=True, is_migration_handled=True, is_original=True).update( - migrated_at=now - ) - - -def grievance_populate_existing_representations_with_migrated_at_data() -> None: - GrievanceTicket.objects.filter(migrated_at__isnull=True, is_migration_handled=True, is_original=True).update( - migrated_at=timezone.now() - ) - - -def household_populate_existing_representations_with_migrated_at_data() -> None: - now = timezone.now() - logger.info("Updating Households") - Household.objects.filter(migrated_at__isnull=True, is_migration_handled=True, is_original=True).update( - migrated_at=now - ) - logger.info("Updating Individuals") - Individual.objects.filter( - migrated_at__isnull=True, is_migration_handled=False, is_original=True, copied_to__isnull=False - ).update(migrated_at=now, is_migration_handled=True) - - logger.info("Updating IndividualRoleInHouseholds") - IndividualRoleInHousehold.objects.filter( - migrated_at__isnull=True, is_migration_handled=False, is_original=True, copied_to__isnull=False - ).update(migrated_at=now, is_migration_handled=True) diff --git a/src/hct_mis_api/one_time_scripts/sync_representations.py b/src/hct_mis_api/one_time_scripts/sync_representations.py deleted file mode 100644 index f7ae6b4eb6..0000000000 --- a/src/hct_mis_api/one_time_scripts/sync_representations.py +++ /dev/null @@ -1,1185 +0,0 @@ -import copy -import logging -import os -from typing import Any, List, Tuple, Union - -from django.core.files.base import ContentFile -from django.db import models -from django.db.models import Q, QuerySet -from django.db.models.fields.files import ImageFieldFile - -from hct_mis_api.apps.accountability.models import Feedback, FeedbackMessage, Message -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.grievance.models import ( - GrievanceDocument, - GrievanceTicket, - GrievanceTicketThrough, - TicketAddIndividualDetails, - TicketComplaintDetails, - TicketDeleteHouseholdDetails, - TicketDeleteIndividualDetails, - TicketHouseholdDataUpdateDetails, - TicketIndividualDataUpdateDetails, - TicketNeedsAdjudicationDetails, - TicketNegativeFeedbackDetails, - TicketNote, - TicketPaymentVerificationDetails, - TicketPositiveFeedbackDetails, - TicketReferralDetails, - TicketSensitiveDetails, - TicketSystemFlaggingDetails, -) -from hct_mis_api.apps.household.models import ( - BankAccountInfo, - Document, - Household, - Individual, - IndividualIdentity, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation -from hct_mis_api.one_time_scripts.migrate_data_for_sync import ( - copy_bank_account_info_per_individual_fast, - copy_document_per_individual_fast, - copy_individual_identity_per_individual_fast, - copy_individual_representation, - copy_individual_sync, - copy_roles_sync, - get_ignored_hhs, - get_individual_representation_per_program_by_old_individual_id, - migrate_data_to_representations_per_business_area, -) -from hct_mis_api.one_time_scripts.migrate_grievance_for_sync import ( - handle_extra_data, - handle_individual_data, - handle_role_reassign_data, - migrate_feedback, - migrate_grievance_to_representations_per_business_area, - migrate_messages, -) - -logger = logging.getLogger(__name__) - - -MODEL_CLASS_UPDATE_DATE_COMPARE_FIELD_MAP = { - HouseholdSelection: ("updated_at", "migrated_at"), - Household: ("updated_at", "migrated_at"), - Individual: ("updated_at", "migrated_at"), - IndividualRoleInHousehold: ("updated_at", "migrated_at"), - BankAccountInfo: ("updated_at", "individual__migrated_at"), - Document: ("updated_at", "individual__migrated_at"), - IndividualIdentity: ("modified", "individual__migrated_at"), - GrievanceTicket: ("updated_at", "migrated_at"), - Message: ("updated_at", "migrated_at"), - Feedback: ("updated_at", "migrated_at"), - FeedbackMessage: ("updated_at", "feedback__migrated_at"), - TicketNote: ("updated_at", "ticket__migrated_at"), - TicketComplaintDetails: ("updated_at", "ticket__migrated_at"), - TicketSensitiveDetails: ("updated_at", "ticket__migrated_at"), - TicketHouseholdDataUpdateDetails: ("updated_at", "ticket__migrated_at"), - TicketIndividualDataUpdateDetails: ("updated_at", "ticket__migrated_at"), - TicketAddIndividualDetails: ("updated_at", "ticket__migrated_at"), - TicketDeleteIndividualDetails: ("updated_at", "ticket__migrated_at"), - TicketDeleteHouseholdDetails: ("updated_at", "ticket__migrated_at"), - TicketSystemFlaggingDetails: ("updated_at", "ticket__migrated_at"), - TicketNeedsAdjudicationDetails: ("updated_at", "ticket__migrated_at"), - TicketPaymentVerificationDetails: ("updated_at", "ticket__migrated_at"), - TicketPositiveFeedbackDetails: ("updated_at", "ticket__migrated_at"), - TicketNegativeFeedbackDetails: ("updated_at", "ticket__migrated_at"), - TicketReferralDetails: ("updated_at", "ticket__migrated_at"), - GrievanceDocument: ( - "updated_at", - "grievance_ticket__migrated_at", - ), -} - - -ONE_TO_ONE_GREVIANCE_MODELS = [ - TicketComplaintDetails, - TicketSensitiveDetails, - TicketHouseholdDataUpdateDetails, - TicketIndividualDataUpdateDetails, - TicketAddIndividualDetails, - TicketDeleteIndividualDetails, - TicketDeleteHouseholdDetails, - TicketSystemFlaggingDetails, - TicketNeedsAdjudicationDetails, - TicketPaymentVerificationDetails, - TicketPositiveFeedbackDetails, - TicketNegativeFeedbackDetails, - TicketReferralDetails, -] - - -def update_representation_regular_fields( - fields_to_update: List[str], original: models.Model, representation: models.Model -) -> None: - for field in fields_to_update: - original_field = getattr(original, field) - if isinstance(original_field, ImageFieldFile) and original_field and original_field.name: - try: - file_copy = ContentFile(original_field.read()) - name_and_extension = os.path.splitext(original_field.name) - file_copy.name = f"{name_and_extension[0]}{original.id}{name_and_extension[1]}" - representation.file = file_copy - setattr(representation, field, file_copy) - except FileNotFoundError: - logger.info(f"File not found for {original_field.name}") - else: - setattr(representation, field, getattr(original, field)) - if fields_to_update: - representation.save(update_fields=fields_to_update) - - -def update_representation_relation_fields( - fields_to_compare: List[str], original: models.Model, representation: models.Model -) -> None: - relation_fields_to_update = [] - for relation_field in fields_to_compare: - if getattr(original, relation_field) != getattr(representation, relation_field): - relation_fields_to_update.append(relation_field) - setattr(representation, relation_field, getattr(original, relation_field)) - if relation_fields_to_update: - representation.save(update_fields=relation_fields_to_update) - - -def update_ticket_json_fields(ticket: models.Model, program: Program) -> None: - if hasattr(ticket, "role_reassign_data"): - ticket = handle_role_reassign_data(ticket, program) - if hasattr(ticket, "individual_data"): - ticket = handle_individual_data(ticket, program) # type: ignore - if hasattr(ticket, "extra_data"): - handle_extra_data(ticket, program) - - ticket.save() - - -def update_household_representations(original: Household, representations: QuerySet[Household]) -> None: - regular_fields_to_compare = [ - "version", - "last_sync_at", - "withdrawn", - "withdrawn_date", - "consent_sign", # ImageField - "consent", - "consent_sharing", - "residence_status", - "country_origin", - "country", - "address", - "zip_code", - "admin_area", - "admin1", - "admin2", - "admin3", - "admin4", - "geopoint", - "size", - "female_age_group_0_5_count", - "female_age_group_6_11_count", - "female_age_group_12_17_count", - "female_age_group_18_59_count", - "female_age_group_60_count", - "pregnant_count", - "male_age_group_0_5_count", - "male_age_group_6_11_count", - "male_age_group_12_17_count", - "male_age_group_18_59_count", - "male_age_group_60_count", - "female_age_group_0_5_disabled_count", - "female_age_group_6_11_disabled_count", - "female_age_group_12_17_disabled_count", - "female_age_group_18_59_disabled_count", - "female_age_group_60_disabled_count", - "male_age_group_0_5_disabled_count", - "male_age_group_6_11_disabled_count", - "male_age_group_12_17_disabled_count", - "male_age_group_18_59_disabled_count", - "male_age_group_60_disabled_count", - "children_count", - "male_children_count", - "female_children_count", - "children_disabled_count", - "male_children_disabled_count", - "female_children_disabled_count", - "returnee", - "flex_fields", - "first_registration_date", - "last_registration_date", - "fchild_hoh", - "child_hoh", - "start", - "deviceid", - "name_enumerator", - "org_enumerator", - "org_name_enumerator", - "village", - "registration_method", - "collect_individual_data", - "currency", - "unhcr_id", - "user_fields", - "detail_id", - "registration_id", - "total_cash_received_usd", - "total_cash_received", - "family_id", - ] - - # relation_fields_to_compare = [ - # "representatives", # through="household.IndividualRoleInHousehold" what if changed?, - # "head_of_household", # models.OneToOneField("Individual", related_name="heading_household", on_delete=models.CASCADE) - # ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - if original.head_of_household != representation.head_of_household.copied_from: - logger.info(f"Updating field head_of_household for {representation}") - new_head_of_household_representation = copy_individual_representation( - program=representation.program, individual=original.head_of_household - ) - representation.head_of_household = new_head_of_household_representation - representation.save(update_fields=["head_of_household"]) - - # representatives handled in IndividualRoleInHousehold - - -def update_individual_representations(original: Individual, representations: QuerySet[Individual]) -> None: - regular_fields_to_compare = [ - "version", - "last_sync_at", - "duplicate", - "duplicate_date", - "withdrawn", - "withdrawn_date", - "individual_id", - "photo", # ImageField - "full_name", - "given_name", - "middle_name", - "family_name", - "sex", - "birth_date", - "estimated_birth_date", - "marital_status", - "phone_no", - "phone_no_valid", - "phone_no_alternative", - "phone_no_alternative_valid", - "email", - "payment_delivery_phone_no", - "relationship", - "disability", - "work_status", - "first_registration_date", - "last_registration_date", - "flex_fields", - "user_fields", - "enrolled_in_nutrition_programme", - "administration_of_rutf", - "deduplication_golden_record_status", - "deduplication_batch_status", - "deduplication_golden_record_results", # ? - "deduplication_batch_results", # ? - "imported_individual_id", # ? - "sanction_list_possible_match", - "sanction_list_confirmed_match", - "pregnant", - "observed_disability", - "seeing_disability", - "hearing_disability", - "physical_disability", - "memory_disability", - "selfcare_disability", - "comms_disability", - "who_answers_phone", - "who_answers_alt_phone", - "fchild_hoh", - "child_hoh", - "detail_id", - "registration_id", - "disability_certificate_picture", # ImageField - "preferred_language", - "relationship_confirmed", - "age_at_registration", - "vector_column", - ] - # relation_fields_to_compare = [ - # "household", - # ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - -def update_individual_role_in_household_representations( - original: IndividualRoleInHousehold, representations: QuerySet[IndividualRoleInHousehold] -) -> None: - regular_fields_to_compare = [ - "last_sync_at", - "role", - ] - # relation_fields_to_compare = [ - # "individual", - # ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - if original.individual != representation.individual.copied_from: - if original.individual is None: - representation.individual = None - else: - individual_representation = copy_individual_representation( - program=representation.household.program, individual=original.individual - ) - representation.individual = individual_representation - representation.save(update_fields=["individual"]) - - -def update_bank_account_info_representations( - original: BankAccountInfo, representations: QuerySet[BankAccountInfo] -) -> None: - regular_fields_to_compare = [ - "last_sync_at", - "bank_name", - "bank_account_number", - "debit_card_number", - ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - -def update_document_representations(original: Document, representations: QuerySet[Document]) -> None: - regular_fields_to_compare = [ - "last_sync_at", - "document_number", - "photo", # ImageField - "status", - "cleared", - "cleared_date", - "issuance_date", - "expiry_date", - ] - relation_fields_to_compare = [ - "type", # models.ForeignKey("DocumentType", related_name="documents", on_delete=models.CASCADE) - "country", # models.ForeignKey("Country", related_name="documents", on_delete=models.CASCADE) - "cleared_by", # models.ForeignKey("account.User", null=True, on_delete=models.SET_NULL) - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_representation_relation_fields(relation_fields_to_compare, original, representation) - - -def update_individual_identity_representations( - original: IndividualIdentity, representations: QuerySet[IndividualIdentity] -) -> None: - regular_fields_to_compare = [ - "number", - ] - relation_fields_to_compare = [ - "partner", # models.ForeignKey("account.Partner",related_name="individual_identities",null=True,on_delete=models.PROTECT,) - "country", # models.ForeignKey("geo.Country", null=True, on_delete=models.PROTECT) - ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_representation_relation_fields(relation_fields_to_compare, original, representation) - - -def update_grievance_ticket_representations( - original: GrievanceTicket, representations: QuerySet[GrievanceTicket] -) -> None: - regular_fields_to_compare = [ - "user_modified", - "last_notification_sent", - "status", - "category", - "issue_type", - "description", - "area", - "language", - "consent", - "extras", - "ignored", - "household_unicef_id", - "priority", - "urgency", - "comments", - ] - relation_fields_to_compare = [ - "assigned_to", - "admin2", - "partner", - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_representation_relation_fields(relation_fields_to_compare, original, representation) - - # sync linked "linked_tickets" = models.ManyToManyField('self', blank=True)" - linked_tickets_ids = list( - original.linked_tickets(manager="default_for_migrations_fix").distinct().values_list("pk", flat=True) - ) - linked_tickets = [ - GrievanceTicketThrough(main_ticket=representation, linked_ticket_id=lt) for lt in linked_tickets_ids - ] - linked_tickets.extend( - [GrievanceTicketThrough(linked_ticket=representation, main_ticket_id=lt) for lt in linked_tickets_ids] - ) - linked_tickets.extend( - [ - GrievanceTicketThrough(main_ticket=representation, linked_ticket_id=original.id), - GrievanceTicketThrough(linked_ticket=representation, main_ticket_id=original.id), - ] - ) - - GrievanceTicketThrough.objects.bulk_create(linked_tickets, ignore_conflicts=True) - - -def update_ticket_note_representations(original: TicketNote, representations: QuerySet[TicketNote]) -> None: - regular_fields_to_compare = [ - "description", - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - -def update_message_representations(original: Message, representations: QuerySet[Message]) -> None: - regular_fields_to_compare = [ - "title", - "body", - "number_of_recipients", - "sampling_type", - "full_list_arguments", - "random_sampling_arguments", - "sample_size", - ] - # relation_fields_to_compare = [ - # "households", - # "target_population", - # ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - # Only create so no need to track related fields - - -def update_feedback_representations(original: Feedback, representations: QuerySet[Feedback]) -> None: - regular_fields_to_compare = [ - "issue_type", - "description", - "comments", - "area", - "language", - "consent", - ] - # relation_fields_to_compare = [ - # "household_lookup", # "household.Household", - # "individual_lookup", # "household.Individual", - # "admin2", # models.ForeignKey("geo.Area" - # "linked_grievance", # can not be changed - # ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_representation_relation_fields(["admin2"], original, representation) - - original_individual_lookup = original.individual_lookup - representation_individual_lookup = ( - representation.individual_lookup and representation.individual_lookup.copied_from - ) - - if original_individual_lookup != representation_individual_lookup: - if original.individual_lookup is None: - representation.individual_lookup = None - else: - representation.individual_lookup = ( - original.individual_lookup.copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first() - ) - representation.save(update_fields=["individual_lookup"]) - - original_household_lookup = original.household_lookup - representation_household_lookup = ( - representation.household_lookup and representation.household_lookup.copied_from - ) - - if original_household_lookup != representation_household_lookup: - if original.household_lookup is None: - representation.household_lookup = None - else: - representation.household_lookup = ( - original.household_lookup.copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first() - ) - representation.save(update_fields=["household_lookup"]) - - -def update_feedback_message_representations( - original: FeedbackMessage, representations: QuerySet[FeedbackMessage] -) -> None: - regular_fields_to_compare = [ - "description", - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - -def update_ticket_payment_details_representations( - original: Union[TicketComplaintDetails, TicketSensitiveDetails], - representations: QuerySet[Union[TicketComplaintDetails, TicketSensitiveDetails]], -) -> None: - relation_fields_to_compare = [ - "payment_object_id", - "payment_content_type", # models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) - ] - for representation in representations: - update_representation_relation_fields(relation_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_household_data_update_details_representations( - original: TicketHouseholdDataUpdateDetails, representations: QuerySet[TicketHouseholdDataUpdateDetails] -) -> None: - regular_fields_to_compare = [ - "household_data", - ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_individual_data_update_details_representations( - original: TicketIndividualDataUpdateDetails, representations: QuerySet[TicketIndividualDataUpdateDetails] -) -> None: - regular_fields_to_compare = [ - # "individual_data", # handled in update_ticket_json_fields - # "role_reassign_data", # handled in update_ticket_json_fields - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_add_individual_details_representations( - original: TicketAddIndividualDetails, representations: QuerySet[TicketAddIndividualDetails] -) -> None: - regular_fields_to_compare = [ - # "individual_data", # handled in update_ticket_json_fields - "approve_status" - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_delete_individual_details_representations( - original: TicketDeleteIndividualDetails, representations: QuerySet[TicketDeleteIndividualDetails] -) -> None: - regular_fields_to_compare = [ - # "role_reassign_data", # handled in update_ticket_json_fields - "approve_status" - ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_delete_household_details_representations( - original: TicketDeleteHouseholdDetails, representations: QuerySet[TicketDeleteHouseholdDetails] -) -> None: - regular_fields_to_compare = [ - # "role_reassign_data", # handled in update_ticket_json_fields - "approve_status" - ] - # relation_fields_to_compare = [ - # "reason_household", - # ] - - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - original_reason_household = original.reason_household - representation_reason_household = ( - representation.reason_household and representation.reason_household.copied_from - ) - if original_reason_household != representation_reason_household: - if original.reason_household is None: - representation.reason_household = None - else: - representation.reason_household = ( - original.reason_household.copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first() - ) - representation.save(update_fields=["reason_household"]) - - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_system_flagging_details_representations( - original: TicketSystemFlaggingDetails, representations: QuerySet[TicketSystemFlaggingDetails] -) -> None: - regular_fields_to_compare = [ - "approve_status", - # "role_reassign_data", # handled in update_ticket_json_fields - ] - # relation_fields_to_compare = [ - # "golden_records_individual", # models.ForeignKey("household.Individual", on_delete=models.CASCADE) - # "sanction_list_individual", # "sanction_list.SanctionListIndividual", - # ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - - if original.golden_records_individual != representation.golden_records_individual.copied_from: - if original.golden_records_individual is None: - representation.golden_records_individual = None - else: - representation.golden_records_individual = ( - original.golden_records_individual.copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first() - ) - representation.save(update_fields=["golden_records_individual"]) - - if original.sanction_list_individual != representation.sanction_list_individual.copied_from: - representation.sanction_list_individual = original.sanction_list_individual - representation.save(update_fields=["sanction_list_individual"]) - - update_ticket_json_fields(representation, representation.program) - - -def update_ticket_needs_adjudication_details_representations( - original: TicketNeedsAdjudicationDetails, representations: QuerySet[TicketNeedsAdjudicationDetails] -) -> None: - regular_fields_to_compare = [ - "is_multiple_duplicates_version", - # "role_reassign_data", # handled in update_ticket_json_fields - # "extra_data", # handled in update_ticket_json_fields - "score_min", - "score_max", - "is_cross_area", - ] - relation_fields_fk_to_compare = [ - "golden_records_individual", # models.ForeignKey("household.Individual", on_delete=models.CASCADE) - "possible_duplicate", # models.ForeignKey("household.Individual", on_delete=models.CASCADE) - "selected_individual", # models.ForeignKey("household.Individual", on_delete=models.CASCADE) - ] - relation_fields_m2m_to_compare = [ - "possible_duplicates", # models.ManyToManyField("household.Individual", related_name="possible_duplicates") - "selected_individuals", # models.ManyToManyField("household.Individual", related_name="selected_individuals") - ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - for field in relation_fields_fk_to_compare: - original_field = getattr(original, field) - representation_original_field = ( - getattr(representation, field, None) and getattr(representation, field).copied_from - ) - if original_field != representation_original_field: - if getattr(original, field) is None: - setattr(representation, field, None) - else: - setattr( - representation, - field, - getattr(original, field) - .copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first(), - ) - representation.save(update_fields=["field"]) - - for field in relation_fields_m2m_to_compare: - original_field = getattr(original, field) - representation_original_field = ( - getattr(representation, field, None) and getattr(representation, field).copied_from - ) - - if original_field != representation_original_field: - if getattr(original, field) is None: - setattr(representation, field, None) - else: - setattr( - representation, - field, - getattr(original, field) - .copied_to(manager="original_and_repr_objects") - .filter(program=representation.program) - .first(), - ) - representation.save(update_fields=["field"]) - - -def update_ticket_payment_verification_details_representations( - original: TicketPaymentVerificationDetails, representations: QuerySet[TicketPaymentVerificationDetails] -) -> None: - regular_fields_to_compare = [ - "payment_verification_status", - "new_status", - "old_received_amount", - "new_received_amount", - "approve_status", - ] - # relation_fields_to_compare = [ - # "payment_verifications", # cannot change - # "payment_verification", # cannot change - # ] - for representation in representations: - update_representation_regular_fields(regular_fields_to_compare, original, representation) - update_ticket_json_fields(representation, representation.program) - - -MODEL_CLASS_UPDATE_FUNCTION_MAP = { - HouseholdSelection: lambda x, y: None, # no regular fields to update - Household: update_household_representations, - Individual: update_individual_representations, - IndividualRoleInHousehold: update_individual_role_in_household_representations, - BankAccountInfo: update_bank_account_info_representations, - Document: update_document_representations, - IndividualIdentity: update_individual_identity_representations, - GrievanceTicket: update_grievance_ticket_representations, - Message: update_message_representations, - Feedback: update_feedback_representations, - FeedbackMessage: update_feedback_message_representations, - TicketComplaintDetails: update_ticket_payment_details_representations, - TicketSensitiveDetails: update_ticket_payment_details_representations, - TicketHouseholdDataUpdateDetails: update_ticket_household_data_update_details_representations, - TicketIndividualDataUpdateDetails: update_ticket_individual_data_update_details_representations, - TicketAddIndividualDetails: update_ticket_add_individual_details_representations, - TicketDeleteIndividualDetails: update_ticket_delete_individual_details_representations, - TicketDeleteHouseholdDetails: update_ticket_delete_household_details_representations, - TicketSystemFlaggingDetails: update_ticket_system_flagging_details_representations, - TicketNeedsAdjudicationDetails: update_ticket_needs_adjudication_details_representations, - TicketPaymentVerificationDetails: update_ticket_payment_verification_details_representations, - TicketPositiveFeedbackDetails: lambda x, y: None, # no regular fields to update - TicketNegativeFeedbackDetails: lambda x, y: None, # no regular fields to update - TicketReferralDetails: lambda x, y: None, # no regular fields to update - TicketNote: update_ticket_note_representations, -} - - -def sync_representations() -> None: - for business_area in BusinessArea.objects.all(): - logger.info("----- NEW BUSINESS AREA -----") - logger.info(f"Handling business area: {business_area}") - sync_representations_per_business_area(business_area=business_area) - - -def sync_representations_per_business_area(business_area: BusinessArea) -> None: - for model, compare_fields in MODEL_CLASS_UPDATE_DATE_COMPARE_FIELD_MAP.items(): - logger.info(f"Handling MODEL: {model}") - sync_new_objects(business_area, model) - sync_removed_objects(business_area, model) - sync_modified_objects(business_area, model, compare_fields) - - -def sync_modified_objects(business_area: BusinessArea, model: Any, compare_fields: Tuple[str, str]) -> None: - logger.info(f"Handling modified objects for model: {model}") - - if model == GrievanceDocument: - modified_original_objects = model.objects.filter( - **{ - "grievance_ticket__business_area": business_area, - "grievance_ticket__copied_to__isnull": False, - "grievance_ticket__is_original": True, - "grievance_ticket__is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - elif model == FeedbackMessage: - modified_original_objects = model.objects.filter( - **{ - "feedback__business_area": business_area, - "feedback__copied_to__isnull": False, - "feedback__is_original": True, - "feedback__is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - elif model in ONE_TO_ONE_GREVIANCE_MODELS + [TicketNote]: - modified_original_objects = model.objects.filter( - **{ - "ticket__business_area": business_area, - "ticket__copied_to__isnull": False, - "ticket__is_original": True, - "ticket__is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - elif model == IndividualRoleInHousehold: - modified_original_objects = model.original_and_repr_objects.filter( - **{ - "household__business_area": business_area, - "copied_to__isnull": False, - "is_original": True, - "is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - elif model == HouseholdSelection: - return # only create/delete - - elif model == GrievanceTicket: - modified_original_objects = model.default_for_migrations_fix.filter( - **{ - "business_area": business_area, - "copied_to__isnull": False, - "is_original": True, - "is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - elif model in [BankAccountInfo, Document, IndividualIdentity]: - modified_original_objects = model.original_and_repr_objects.filter( - **{ - "individual__business_area": business_area, - "copied_to__isnull": False, - "is_original": True, - "is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - else: - modified_original_objects = model.original_and_repr_objects.filter( - **{ - "business_area": business_area, - "copied_to__isnull": False, - "is_original": True, - "is_migration_handled": True, - compare_fields[0] + "__gt": models.F(compare_fields[1]), - } - ) - - logger.info(f"{model} Modified originals count: {modified_original_objects.count()}") - - for modified_object in modified_original_objects: - if model in ONE_TO_ONE_GREVIANCE_MODELS: - ticket_representations = modified_object.ticket.copied_to(manager="default_for_migration_fix").all() - related_name = model._meta.get_field("ticket").remote_field.get_accessor_name() - representations = model.objects.get( - id__in=ticket_representations.values_list(related_name, flat=True) - ).prefetch_related(related_name) - - elif model == FeedbackMessage: - feedback_representations = modified_object.feedback.copied_to(manager="original_and_repr_objects").all() - representations = FeedbackMessage.objects.filter( - id__in=feedback_representations.values_list("feedback_messages", flat=True), - created_at=modified_object.created_at, - ) - - elif model == GrievanceDocument: - ticket_representation = modified_object.greivance_ticket.copied_to( - manager="original_and_repr_objects" - ).all() - representations = GrievanceDocument.objects.filter( - id__in=ticket_representation.values_list("documents", flat=True), - created_at=modified_object.created_at, - ) - - elif model == TicketNote: - ticket_representation = modified_object.ticket.copied_to(manager="default_for_migrations_fix").all() - representations = TicketNote.objects.filter( - id__in=ticket_representation.values_list("ticket_notes", flat=True), - created_at=modified_object.created_at, - ) - - elif model == GrievanceTicket: - representations = modified_object.copied_to(manager="default_for_migrations_fix").all() - - else: - representations = modified_object.copied_to(manager="original_and_repr_objects").all() - - logger.info(f"Updating {representations.count()} representations for {modified_object}") - MODEL_CLASS_UPDATE_FUNCTION_MAP[model](modified_object, representations) - - -def sync_removed_objects(business_area: BusinessArea, model: Any) -> None: - logger.info(f"Handling removed objects for model: {model}") - - related_objects_to_remove = None - - if model in ONE_TO_ONE_GREVIANCE_MODELS + [ - FeedbackMessage, - TicketNote, - GrievanceTicket, - GrievanceDocument, - Message, - Feedback, - ]: - return # no soft delete - - elif model == HouseholdSelection: - return # handled in removed Household - - if model == IndividualRoleInHousehold: - q = Q(copied_from__isnull=True) | Q(copied_from__is_removed=True) - filter_kwargs = dict( - household__business_area=business_area, - is_original=False, - ) - representations_of_removed_objects = model.original_and_repr_objects.filter(q, **filter_kwargs) - - elif model in [BankAccountInfo, Document, IndividualIdentity]: - q = Q(copied_from__isnull=True) | Q(copied_from__is_removed=True) - filter_kwargs = dict( - individual__business_area=business_area, - is_original=False, - ) - representations_of_removed_objects = model.original_and_repr_objects.filter(q, **filter_kwargs) - - else: - q = Q(copied_from__isnull=True) | Q(copied_from__is_removed=True) - filter_kwargs = dict( - business_area=business_area, - is_original=False, - ) - representations_of_removed_objects = model.original_and_repr_objects.filter(q, **filter_kwargs) - - removed_objects_count = representations_of_removed_objects.count() - logger.info(f"Representations to be removed count: {removed_objects_count}") - if related_objects_to_remove: - logger.info( - f"Representations related objects {related_objects_to_remove.model} to be removed count: {related_objects_to_remove.count()}" - ) - related_objects_to_remove.delete() - representations_of_removed_objects.delete() - - -def sync_new_objects(business_area: BusinessArea, model: Any) -> None: - logger.info(f"Handling new objects for model: {model}") - originals_manager = "default_for_migrations_fix" if model == GrievanceTicket else "original_and_repr_objects" - - q = Q() - if model in ONE_TO_ONE_GREVIANCE_MODELS: - return # handled in new GrievanceTicket - - elif model == HouseholdSelection: - q = Q( - target_population__status__in=[ - TargetPopulation.STATUS_READY_FOR_PAYMENT_MODULE, - TargetPopulation.STATUS_READY_FOR_CASH_ASSIST, - ] - ) | Q(household__withdrawn=False) - filter_kwargs = dict( - household__business_area=business_area, - is_original=True, - is_migration_handled=False, - ) - - elif model == Individual: - filter_kwargs = dict( - business_area=business_area, - copied_to__isnull=True, - is_original=True, - is_migration_handled=False, - ) - - elif model == IndividualRoleInHousehold: - filter_kwargs = dict( - household__business_area=business_area, - is_original=True, - is_migration_handled=False, - copied_to__isnull=True, - ) - - elif model in [BankAccountInfo, Document, IndividualIdentity]: - filter_kwargs = dict( - individual__business_area=business_area, - individual__is_original=True, - individual__is_migration_handled=True, - is_original=True, - copied_to__isnull=True, - ) - - elif model == FeedbackMessage: - originals_manager = "objects" - filter_kwargs = dict( - feedback__business_area=business_area, - feedback__is_original=True, - feedback__is_migration_handled=True, - created_at__gt=models.F("feedback__migrated_at"), - ) - - elif model == TicketNote: - originals_manager = "objects" - filter_kwargs = dict( - ticket__business_area=business_area, - ticket__is_original=True, - ticket__is_migration_handled=True, - created_at__gt=models.F("ticket__migrated_at"), - ) - - elif model == GrievanceDocument: - originals_manager = "objects" - filter_kwargs = dict( - grievance_ticket__business_area=business_area, - grievance_ticket__is_original=True, - grievance_ticket__is_migration_handled=True, - created_at__gt=models.F("grievance_ticket__migrated_at"), - ) - - else: - filter_kwargs = dict( - business_area=business_area, - copied_to__isnull=True, - is_original=True, - is_migration_handled=False, - ) - - new_objects = getattr(model, originals_manager).filter(q, **filter_kwargs).order_by("id") - - if business_area.name == "Afghanistan" and model in [ - Household, - Individual, - IndividualRoleInHousehold, - BankAccountInfo, - Document, - IndividualIdentity, - ]: - hhs_to_ignore = get_ignored_hhs() - inds_to_ignore = list( - Individual.objects.filter( - Q(household__in=hhs_to_ignore) | Q(households_and_roles__household__in=hhs_to_ignore) - ).values_list("id", flat=True) - ) - - logger.info(f"Households to ignore count: {len(hhs_to_ignore)}") - logger.info(f"Individuals to ignore count: {len(inds_to_ignore)}") - - if model == Household and hhs_to_ignore: - new_objects = new_objects.exclude(id__in=hhs_to_ignore) - elif model == Individual and inds_to_ignore: - new_objects = new_objects.exclude(id__in=inds_to_ignore) - elif model == IndividualRoleInHousehold and hhs_to_ignore: - new_objects = new_objects.exclude(household__in=hhs_to_ignore) - elif model in [BankAccountInfo, Document, IndividualIdentity] and inds_to_ignore: - new_objects = new_objects.exclude(individual__in=inds_to_ignore) - - new_objects_count = new_objects.count() - logger.info(f"New objects count: {new_objects_count}") - - if new_objects_count: - if model == HouseholdSelection: - migrate_data_to_representations_per_business_area(business_area) - - elif model == Household: - migrate_data_to_representations_per_business_area(business_area) - - elif model == Individual: - copy_individual_sync(list(new_objects.values_list("id", flat=True))) - - elif model == IndividualRoleInHousehold: - copy_roles_sync(list(new_objects.values_list("id", flat=True))) - - elif model == BankAccountInfo: - bank_accounts_info_to_create = [] - for obj in new_objects: - programs = list( - obj.individual.copied_to(manager="original_and_repr_objects") - .all() - .values_list("program", flat=True) - ) - for program in programs: - bank_account_info_to_create = copy_bank_account_info_per_individual_fast( - [obj], - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=obj.individual_id, - ), # type: ignore - ) - bank_accounts_info_to_create.extend(bank_account_info_to_create) - if bank_accounts_info_to_create: - BankAccountInfo.objects.bulk_create(bank_accounts_info_to_create, ignore_conflicts=True) - - elif model == Document: - documents = [] - for obj in new_objects: - programs = list( - obj.individual.copied_to(manager="original_and_repr_objects") - .all() - .values_list("program", flat=True) - ) - for program in programs: - document = copy_document_per_individual_fast( - [obj], - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=obj.individual_id, - ), # type: ignore - ) - documents.extend(document) - if documents: - Document.objects.bulk_create(documents, ignore_conflicts=True) - - elif model == IndividualIdentity: - individual_identities_to_create = [] - for obj in new_objects: - programs = list( - obj.individual.copied_to(manager="original_and_repr_objects") - .all() - .values_list("program", flat=True) - ) - for program in programs: - individual_identity_to_create = copy_individual_identity_per_individual_fast( - [obj], - get_individual_representation_per_program_by_old_individual_id( - program=program, - old_individual_id=obj.individual_id, - ), # type: ignore - ) - individual_identities_to_create.extend(individual_identity_to_create) - if individual_identities_to_create: - IndividualIdentity.objects.bulk_create(individual_identities_to_create, ignore_conflicts=True) - - elif model == GrievanceTicket: - migrate_grievance_to_representations_per_business_area(business_area=business_area) - - elif model == Message: - migrate_messages(business_area=business_area) - - elif model == Feedback: - migrate_feedback(business_area=business_area) - - elif model == FeedbackMessage: - feedback_messages_to_create = [] - for obj in new_objects: - for feedback_representation in obj.feedback.copied_to(manager="original_and_repr_objects").all(): - message_copy = copy.deepcopy(obj) - message_copy.pk = None - message_copy.feedback = feedback_representation - feedback_messages_to_create.append(message_copy) - if feedback_messages_to_create: - FeedbackMessage.objects.bulk_create(feedback_messages_to_create, ignore_conflicts=True) - - elif model == TicketNote: - ticket_notes_to_create = [] - for obj in new_objects: - for ticket_representation in obj.ticket.copied_to(manager="default_for_migrations_fix").all(): - note_copy = copy.deepcopy(obj) - note_copy.pk = None - note_copy.ticket = ticket_representation - ticket_notes_to_create.append(note_copy) - if ticket_notes_to_create: - TicketNote.objects.bulk_create(ticket_notes_to_create, ignore_conflicts=True) - - elif model == GrievanceDocument: - documents_to_create = [] - for obj in new_objects: - for ticket_representation in obj.grievance_ticket.copied_to(manager="default_for_migrations_fix").all(): - document_copy = copy.deepcopy(obj) - document_copy.pk = None - document_copy.grievance_ticket = ticket_representation - documents_to_create.append(document_copy) - if documents_to_create: - GrievanceDocument.bulk_create(documents_to_create, ignore_conflicts=True) diff --git a/src/hct_mis_api/urls.py b/src/hct_mis_api/urls.py index 8408cdcb2d..e9b1e45e1a 100644 --- a/src/hct_mis_api/urls.py +++ b/src/hct_mis_api/urls.py @@ -20,7 +20,6 @@ from hct_mis_api.apps.core.views import ( UploadFile, homepage, - hope_redirect, logout_view, schema, trigger_error, @@ -36,7 +35,6 @@ path("fields_attributes/", all_fields_attributes, name="fields_attributes"), path("_health", homepage), path("explorer/", include("explorer.urls")), - path("hope-redirect", hope_redirect), path("graphql", csrf_exempt(FileUploadGraphQLView.as_view(graphiql=True))), path("graphql/schema.graphql", schema), path("logout", logout_view, name="logout"), diff --git a/tests/selenium/filters/test_filters.py b/tests/selenium/filters/test_filters.py index c69402b31c..c3c861a781 100644 --- a/tests/selenium/filters/test_filters.py +++ b/tests/selenium/filters/test_filters.py @@ -13,11 +13,15 @@ from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, + PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) -from hct_mis_api.apps.payment.models import PaymentPlan, PaymentVerificationPlan +from hct_mis_api.apps.payment.models import GenericPayment, PaymentPlan +from hct_mis_api.apps.payment.models import PaymentVerification as PV +from hct_mis_api.apps.payment.models import PaymentVerificationPlan from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory from hct_mis_api.apps.registration_data.models import ImportData, RegistrationDataImport @@ -45,6 +49,7 @@ def create_payment_plan() -> None: tp2 = TargetPopulation.objects.all()[1] pp = PaymentPlan.objects.update_or_create( + name="Test Payment Plan 1", unicef_id="PP-0060-22-11223344", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp, @@ -56,16 +61,16 @@ def create_payment_plan() -> None: status_date=datetime.now(), status=PaymentPlan.Status.ACCEPTED, created_by=User.objects.first(), - program=tp.program, total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_id=tp.program.id, + program_cycle=tp.program.cycles.first(), ) pp[0].unicef_id = "PP-0060-22-11223344" pp[0].save() PaymentPlan.objects.update_or_create( + name="Test Payment Plan 2", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp2, start_date=datetime.now(), @@ -76,11 +81,10 @@ def create_payment_plan() -> None: status_date=datetime.now(), status=PaymentPlan.Status.ACCEPTED, created_by=User.objects.first(), - program=tp2.program, total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_id=tp2.program.id, + program_cycle=tp2.program.cycles.first(), ) @@ -157,8 +161,9 @@ def add_household() -> None: household.save() -@pytest.fixture -def add_payment_verification() -> None: +def payment_verification_creator( + channel: str = PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL, payment_plan_id: str = "PP-0060-22-11223344" +) -> PV: registration_data_import = RegistrationDataImportFactory( imported_by=User.objects.first(), business_area=BusinessArea.objects.first() ) @@ -172,36 +177,46 @@ def add_payment_verification() -> None: {"registration_data_import": registration_data_import}, ) - cash_plan = CashPlanFactory( - ca_id="PP-0000-00-11223344", - name="TEST", - program=program, - business_area=BusinessArea.objects.first(), - ) - cash_plan2 = CashPlanFactory( - ca_id="PP-0000-01-00000000", + payment_plan = PaymentPlanFactory( name="TEST", - program=program, + status=PaymentPlan.Status.FINISHED, + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), + start_date=datetime.now() - relativedelta(months=1), + end_date=datetime.now() + relativedelta(months=1), ) - target_population = TargetPopulation.objects.first() + payment_plan.unicef_id = payment_plan_id + payment_plan.save() - PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, - entitlement_quantity="21.36", - delivered_quantity="21.36", + entitlement_quantity=21.36, + delivered_quantity=21.36, currency="PLN", + status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL + pv_summary = PaymentVerificationSummaryFactory(payment_plan=payment_plan) + pv_summary.activation_date = datetime.now() - relativedelta(months=1) + pv_summary.save() + payment_verification_plan = PaymentVerificationPlanFactory( + payment_plan=payment_plan, + verification_channel=channel, ) - PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan2, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL + pv = PaymentVerificationFactory( + payment=payment, + payment_verification_plan=payment_verification_plan, + status=PV.STATUS_PENDING, ) + return pv + + +@pytest.fixture +def add_payment_verification() -> None: + payment_verification_creator(payment_plan_id="PP-0060-22-11223344") + payment_verification_creator(payment_plan_id="PP-0000-00-11223344") @pytest.fixture @@ -512,7 +527,6 @@ def test_filters_happy_path_search_filter( create_targeting: None, create_rdi: None, add_payment_verification: None, - create_payment_plan: None, add_household: None, add_grievance_tickets: None, filters: Filters, diff --git a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py index d914af7b51..32b50224ff 100644 --- a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py +++ b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py @@ -23,14 +23,10 @@ create_household_and_individuals, ) from hct_mis_api.apps.household.models import HOST, Household, Individual -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) from tests.selenium.drawer.test_drawer import get_program_with_dct_type_and_name from tests.selenium.helpers.date_time_format import FormatTime from tests.selenium.page_object.admin_panel.admin_panel import AdminPanel @@ -85,28 +81,18 @@ def household_social_worker() -> Household: @pytest.fixture -def hh_with_payment_record(household_without_disabilities: Household) -> PaymentRecord: - targeting_criteria = TargetingCriteriaFactory() - - target_population = TargetPopulationFactory( - created_by=User.objects.first(), - targeting_criteria=targeting_criteria, - business_area=household_without_disabilities.business_area, - ) - cash_plan = CashPlanFactory( +def hh_with_payment_record(household_without_disabilities: Household) -> Payment: + payment_plan = PaymentPlanFactory( program=household_without_disabilities.program, business_area=household_without_disabilities.business_area, ) - cash_plan.save() - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household_without_disabilities, - target_population=target_population, delivered_quantity_usd=None, business_area=household_without_disabilities.business_area, ) - payment_record.save() - return payment_record + return payment def find_text_of_label(element: WebElement) -> str: @@ -907,9 +893,9 @@ def test_grievance_tickets_create_new_tickets_Grievance_Complaint_Payment_Relate pageGrievanceTickets: GrievanceTickets, pageGrievanceNewTicket: NewTicket, pageGrievanceDetailsPage: GrievanceDetailsPage, - hh_with_payment_record: PaymentRecord, + hh_with_payment_record: Payment, ) -> None: - payment_id = PaymentRecord.objects.first().unicef_id + payment_id = Payment.objects.first().unicef_id pageGrievanceTickets.getNavGrievance().click() assert "Grievance Tickets" in pageGrievanceTickets.getGrievanceTitle().text pageGrievanceTickets.getButtonNewTicket().click() diff --git a/tests/selenium/managerial_console/test_managerial_console.py b/tests/selenium/managerial_console/test_managerial_console.py index ac55b56385..ea53f9988e 100644 --- a/tests/selenium/managerial_console/test_managerial_console.py +++ b/tests/selenium/managerial_console/test_managerial_console.py @@ -13,7 +13,7 @@ from hct_mis_api.apps.core.models import BusinessArea, DataCollectingType from hct_mis_api.apps.payment.fixtures import ApprovalProcessFactory, PaymentPlanFactory from hct_mis_api.apps.payment.models import PaymentPlan -from hct_mis_api.apps.program.fixtures import ProgramFactory +from hct_mis_api.apps.program.fixtures import ProgramCycleFactory, ProgramFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.targeting.fixtures import ( TargetingCriteriaFactory, @@ -59,9 +59,10 @@ def create_program( @pytest.fixture def create_payment_plan(create_active_test_program: Program, second_test_program: Program) -> PaymentPlan: + program_cycle_second = ProgramCycleFactory(program=second_test_program) PaymentPlanFactory( target_population=TargetPopulationFactory(program=second_test_program), - program=second_test_program, + program_cycle=program_cycle_second, status=PaymentPlan.Status.IN_APPROVAL, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) @@ -73,6 +74,7 @@ def create_payment_plan(create_active_test_program: Program, second_test_program ) tp = TargetPopulation.objects.get(program__name="Test Programm") payment_plan = PaymentPlan.objects.update_or_create( + name="Test Payment Plan", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp, currency="USD", @@ -81,12 +83,10 @@ def create_payment_plan(create_active_test_program: Program, second_test_program status_date=datetime.now(), status=PaymentPlan.Status.IN_APPROVAL, created_by=User.objects.first(), - program=tp.program, program_cycle=tp.program.cycles.first(), total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_id=tp.program.id, )[0] approval_user = UserFactory() approval_date = timezone.datetime(2000, 10, 10, tzinfo=timezone.utc) @@ -117,23 +117,24 @@ def test_managerial_console_smoke_test( pageManagerialConsole.getReleaseButton().click() program = Program.objects.filter(name="Test Programm").first() + program_cycle = ProgramCycleFactory(program=program) PaymentPlanFactory( - program=program, + program_cycle=program_cycle, status=PaymentPlan.Status.IN_APPROVAL, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) PaymentPlanFactory( - program=program, + program_cycle=program_cycle, status=PaymentPlan.Status.IN_AUTHORIZATION, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) PaymentPlanFactory( - program=program, + program_cycle=program_cycle, status=PaymentPlan.Status.IN_REVIEW, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) PaymentPlanFactory( - program=program, + program_cycle=program_cycle, status=PaymentPlan.Status.ACCEPTED, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) diff --git a/tests/selenium/payment_module/test_payment_plans.py b/tests/selenium/payment_module/test_payment_plans.py index a381b9d080..f41dc9d830 100644 --- a/tests/selenium/payment_module/test_payment_plans.py +++ b/tests/selenium/payment_module/test_payment_plans.py @@ -147,6 +147,7 @@ def create_payment_plan(create_targeting: None) -> PaymentPlan: end_date=datetime.now() + relativedelta(days=15), ) payment_plan = PaymentPlan.objects.update_or_create( + name="Test Payment Plan", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp, program_cycle=cycle, @@ -156,11 +157,9 @@ def create_payment_plan(create_targeting: None) -> PaymentPlan: status_date=datetime.now(), status=PaymentPlan.Status.ACCEPTED, created_by=User.objects.first(), - program=tp.program, total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_id=tp.program.id, ) yield payment_plan[0] @@ -188,7 +187,6 @@ def create_payment_plan_open(social_worker_program: Program) -> PaymentPlan: payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.PREPARING, is_follow_up=False, - program=social_worker_program, program_cycle=program_cycle, business_area=social_worker_program.business_area, dispersion_start_date=datetime.now().date(), @@ -213,7 +211,6 @@ def create_payment_plan_open(social_worker_program: Program) -> PaymentPlan: PaymentPlanFactory( status=PaymentPlan.Status.LOCKED, - program=social_worker_program, program_cycle=program_cycle, business_area=social_worker_program.business_area, dispersion_start_date=datetime.now().date(), @@ -234,7 +231,6 @@ def payment_plan_create(program: Program, status: str = PaymentPlan.Status.LOCKE ) payment_plan = PaymentPlanFactory( - program=program, is_follow_up=False, status=status, program_cycle=program_cycle, diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index e96146b9a7..f2e707e72c 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -14,10 +14,8 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, PaymentVerificationSummaryFactory, @@ -29,10 +27,6 @@ from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program, ProgramCycle from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) from tests.selenium.page_object.grievance.details_grievance_page import ( GrievanceDetailsPage, ) @@ -115,7 +109,7 @@ def payment_verification_multiple_verification_plans(number_verification_plans: households.append(household) payment_plan = PaymentPlanFactory( - program=program, + program_cycle=program.cycles.first(), status=PaymentPlan.Status.FINISHED, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) @@ -127,18 +121,18 @@ def payment_verification_multiple_verification_plans(number_verification_plans: business_area=BusinessArea.objects.first(), household=hh, head_of_household=household.head_of_household, - entitlement_quantity=Decimal("21.36"), - delivered_quantity=Decimal("21.36"), + entitlement_quantity=Decimal(21.36), + delivered_quantity=Decimal(21.36), currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) ) - PaymentVerificationSummaryFactory(payment_plan_obj=payment_plan) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) for payment in payments: payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=payment_plan, + payment_plan=payment_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL, ) @@ -165,7 +159,7 @@ def empty_payment_verification(social_worker_program: Program) -> None: ) payment_plan = PaymentPlanFactory( - program=program, + program_cycle=program.cycles.first(), status=PaymentPlan.Status.FINISHED, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) @@ -174,12 +168,12 @@ def empty_payment_verification(social_worker_program: Program) -> None: business_area=BusinessArea.objects.first(), household=household, head_of_household=household.head_of_household, - entitlement_quantity=Decimal("21.36"), - delivered_quantity=Decimal("21.36"), + entitlement_quantity=Decimal(21.36), + delivered_quantity=Decimal(21.36), currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - PaymentVerificationSummaryFactory(payment_plan_obj=payment_plan) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) @pytest.fixture @@ -206,42 +200,36 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA {"registration_data_import": registration_data_import}, ) - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( name="TEST", - program=program, + status=PaymentPlan.Status.FINISHED, + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), start_date=datetime.now() - relativedelta(months=1), end_date=datetime.now() + relativedelta(months=1), ) - targeting_criteria = TargetingCriteriaFactory() + payment_plan.unicef_id = "PP-0000-00-1122334" + payment_plan.save() - target_population = TargetPopulationFactory( - created_by=User.objects.first(), - targeting_criteria=targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, - entitlement_quantity="21.36", - delivered_quantity="21.36", + entitlement_quantity=21.36, + delivered_quantity=21.36, currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) + pv_summary = PaymentVerificationSummaryFactory(payment_plan=payment_plan) + pv_summary.activation_date = datetime.now() - relativedelta(months=1) + pv_summary.save() payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, + payment_plan=payment_plan, verification_channel=channel, ) - - pv_summary = cash_plan.get_payment_verification_summary - pv_summary.activation_date = datetime.now() - relativedelta(months=1) - pv_summary.save() - pv = PaymentVerificationFactory( - payment_obj=payment_record, + payment=payment, payment_verification_plan=payment_verification_plan, status=PV.STATUS_PENDING, ) diff --git a/tests/selenium/people/test_people.py b/tests/selenium/people/test_people.py index 9cfb64faca..8162009ddc 100644 --- a/tests/selenium/people/test_people.py +++ b/tests/selenium/people/test_people.py @@ -7,7 +7,6 @@ from dateutil.relativedelta import relativedelta from selenium.webdriver.common.by import By -from hct_mis_api.apps.account.models import User from hct_mis_api.apps.core.fixtures import DataCollectingTypeFactory from hct_mis_api.apps.core.models import BusinessArea, DataCollectingType from hct_mis_api.apps.household.fixtures import ( @@ -15,14 +14,10 @@ create_individual_document, ) from hct_mis_api.apps.household.models import HOST, SEEING, Individual -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.payment.models import GenericPayment, PaymentRecord from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) from tests.selenium.page_object.filters import Filters from tests.selenium.page_object.grievance.details_grievance_page import ( GrievanceDetailsPage, @@ -64,33 +59,24 @@ def add_people(social_worker_program: Program) -> List: def add_people_with_payment_record(add_people: List) -> PaymentRecord: program = Program.objects.filter(name="Worker Program").first() - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( name="TEST", - program=program, + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), start_date=datetime.now() - relativedelta(months=1), end_date=datetime.now() + relativedelta(months=1), ) - - targeting_criteria = TargetingCriteriaFactory() - - target_population = TargetPopulationFactory( - created_by=User.objects.first(), - targeting_criteria=targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - payment_record = PaymentRecordFactory( + payment = PaymentFactory( household=add_people[1], - parent=cash_plan, - target_population=target_population, - entitlement_quantity="21.36", - delivered_quantity="21.36", + parent=payment_plan, + entitlement_quantity=21.36, + delivered_quantity=21.36, currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - add_people[1].total_cash_received_usd = "21.36" + add_people[1].total_cash_received_usd = 21.36 add_people[1].save() - return payment_record + return payment def get_program_with_dct_type_and_name( diff --git a/tests/selenium/people/test_people_periodic_data_update.py b/tests/selenium/people/test_people_periodic_data_update.py index 5e78a9f67d..2ef0f5f582 100644 --- a/tests/selenium/people/test_people_periodic_data_update.py +++ b/tests/selenium/people/test_people_periodic_data_update.py @@ -5,7 +5,6 @@ import pytest from dateutil.relativedelta import relativedelta -from hct_mis_api.apps.account.models import User from hct_mis_api.apps.core.fixtures import DataCollectingTypeFactory, create_afghanistan from hct_mis_api.apps.core.models import ( BusinessArea, @@ -15,7 +14,7 @@ ) from hct_mis_api.apps.household.fixtures import create_household_and_individuals from hct_mis_api.apps.household.models import HOST, SEEING, Individual -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.payment.models import GenericPayment from hct_mis_api.apps.periodic_data_update.fixtures import ( PeriodicDataUpdateTemplateFactory, @@ -32,10 +31,6 @@ from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) from tests.selenium.page_object.people.people import People from tests.selenium.page_object.people.people_details import PeopleDetails from tests.selenium.page_object.programme_population.individuals import Individuals @@ -87,32 +82,22 @@ def date_attribute(program: Program) -> FlexibleAttribute: @pytest.fixture def individual(add_people: Individual) -> Individual: program = Program.objects.filter(name="Test Program").first() - - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( name="TEST", - program=program, + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), start_date=datetime.now() - relativedelta(months=1), end_date=datetime.now() + relativedelta(months=1), ) - - targeting_criteria = TargetingCriteriaFactory() - - target_population = TargetPopulationFactory( - created_by=User.objects.first(), - targeting_criteria=targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - PaymentRecordFactory( + PaymentFactory( household=add_people.household, - parent=cash_plan, - target_population=target_population, - entitlement_quantity="21.36", - delivered_quantity="21.36", + parent=payment_plan, + entitlement_quantity=21.36, + delivered_quantity=21.36, currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - add_people.total_cash_received_usd = "21.36" + add_people.total_cash_received_usd = 21.36 add_people.save() return add_people diff --git a/tests/selenium/program_details/test_program_details.py b/tests/selenium/program_details/test_program_details.py index 9a32c31119..e80fbed420 100644 --- a/tests/selenium/program_details/test_program_details.py +++ b/tests/selenium/program_details/test_program_details.py @@ -169,7 +169,6 @@ def get_program_without_cycle_end_date( ) program_cycle = ProgramCycle.objects.get(program=program) PaymentPlanFactory( - program=program, program_cycle=program_cycle, total_entitled_quantity_usd=Decimal(1234.99), total_delivered_quantity_usd=Decimal(50.01), @@ -212,6 +211,7 @@ def create_payment_plan(standard_program: Program) -> PaymentPlan: program_cycle=cycle, ) payment_plan = PaymentPlan.objects.update_or_create( + name="Test Payment Plan", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), target_population=tp, start_date=datetime.now(), @@ -222,11 +222,9 @@ def create_payment_plan(standard_program: Program) -> PaymentPlan: status_date=datetime.now(), status=PaymentPlan.Status.ACCEPTED, created_by=User.objects.first(), - program=tp.program, total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_id=tp.program.id, program_cycle=cycle, ) yield payment_plan[0] diff --git a/tests/unit/apps/core/test_exchange_rates.py b/tests/unit/apps/core/test_exchange_rates.py index 6312604c00..24fc924d04 100644 --- a/tests/unit/apps/core/test_exchange_rates.py +++ b/tests/unit/apps/core/test_exchange_rates.py @@ -1,10 +1,8 @@ import os from datetime import datetime, timedelta -from decimal import Decimal from typing import Any from unittest import mock -from django.core.management import call_command from django.test import TestCase from django.utils import timezone @@ -13,18 +11,6 @@ from hct_mis_api.apps.core.exchange_rates import ExchangeRateClientAPI, ExchangeRates from hct_mis_api.apps.core.exchange_rates.api import ExchangeRateClientDummy -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import ( - RealCashPlanFactory, - RealPaymentRecordFactory, - RealProgramFactory, - ServiceProviderFactory, -) -from hct_mis_api.apps.payment.models import PaymentRecord -from tests.unit.apps.core.test_files.exchange_rates_api_response import ( - EXCHANGE_RATES_API_RESPONSE, -) EXCHANGE_RATES_WITH_HISTORICAL_DATA = { "ROWSET": { @@ -224,63 +210,3 @@ def test_get_exchange_rate_for_currency_code( exchange_rates_client = ExchangeRates() exchange_rate = exchange_rates_client.get_exchange_rate_for_currency_code(currency_code, dispersion_date) self.assertEqual(expected_result, exchange_rate) - - -@mock.patch.dict(os.environ, {"EXCHANGE_RATES_API_KEY": "TEST_API_KEY"}) -class TestFixExchangeRatesCommand(TestCase): - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - business_area = BusinessArea.objects.create( - code="0060", - name="Afghanistan", - long_name="THE ISLAMIC REPUBLIC OF AFGHANISTAN", - region_code="64", - region_name="SAR", - has_data_sharing_agreement=True, - ) - create_household( - household_args={"size": 2, "business_area": business_area}, - ) - ServiceProviderFactory.create_batch(3) - program = RealProgramFactory() - cash_plans_with_currency = ( - ( - "PLN", - RealCashPlanFactory(program=program, dispersion_date=timezone.make_aware(datetime(2021, 4, 4))), - ), # x_rate == 3.973 - ( - "AFN", - RealCashPlanFactory(program=program, dispersion_date=timezone.make_aware(datetime(2020, 3, 3))), - ), # x_rate == 76.55 - ( - "USD", - RealCashPlanFactory(program=program, dispersion_date=timezone.make_aware(datetime(2020, 3, 3))), - ), # x_rate == 1 - ) - for currency, cash_plan in cash_plans_with_currency: - RealPaymentRecordFactory( - parent=cash_plan, - currency=currency, - delivered_quantity=200, - ) - - @requests_mock.Mocker() - def test_modify_delivered_quantity_in_usd(self, mocker: Any) -> None: - mocker.register_uri( - "GET", - "https://uniapis.unicef.org/biapi/v1/exchangerates?history=yes", - json=EXCHANGE_RATES_API_RESPONSE, - ) - - call_command("fixexchangerates", "--silent") - - all_payment_records = PaymentRecord.objects.all() - - expected_results = { - "PLN": Decimal("50.34"), - "AFN": Decimal("2.61"), - "USD": Decimal("200"), - } - for payment_record in all_payment_records: - self.assertEqual(expected_results[payment_record.currency], payment_record.delivered_quantity_usd) diff --git a/tests/unit/apps/core/test_hope_redirect.py b/tests/unit/apps/core/test_hope_redirect.py deleted file mode 100644 index 34f401ef9b..0000000000 --- a/tests/unit/apps/core/test_hope_redirect.py +++ /dev/null @@ -1,197 +0,0 @@ -from hct_mis_api.apps.account.fixtures import BusinessAreaFactory, UserFactory -from hct_mis_api.apps.core.base_test_case import APITestCase -from hct_mis_api.apps.core.hope_redirect import HopeRedirect, get_hope_redirect -from hct_mis_api.apps.household.fixtures import create_household_and_individuals -from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, - PaymentVerificationFactory, - PaymentVerificationPlanFactory, -) -from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan -from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) - - -class TestHopeRedirect(APITestCase): - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - cls.user = UserFactory.create() - business_area = BusinessAreaFactory( - code="0060", - name="Afghanistan", - long_name="THE ISLAMIC REPUBLIC OF AFGHANISTAN", - region_code="64", - region_name="SAR", - slug="afghanistan", - has_data_sharing_agreement=True, - ) - program = ProgramFactory(id="e6537f1e-27b5-4179-a443-d42498fb0478") - CashPlanFactory( - id="0272dd2d-c41e-435d-9587-6ba280678c54", - ca_id="B4M-21-CSH-00004", - business_area=business_area, - program=program, - ) - - household, _ = create_household_and_individuals( - { - "id": "01780fad-9fa9-4e27-b3cd-7187c13452e5", - "unicef_id": "HH-21-0000.8129", - "business_area": business_area, - }, - [ - { - "full_name": "Jenna Franklin", - "given_name": "Jenna", - "family_name": "Franklin", - "phone_no": "001-296-358-5428-607", - "birth_date": "1969-11-29", - "id": "001A2C2D-22CA-4538-A36F-D454AF5EDD3E", - "unicef_id": "IND-21-0002.2658", - }, - ], - ) - - cash_plan = CashPlanFactory( - name="TEST", - program=program, - business_area=business_area, - ) - payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, status=PaymentVerificationPlan.STATUS_ACTIVE - ) - - target_population = TargetPopulationFactory( - id="6FFB6BB7-3D43-4ECE-BB0E-21FDE209AFAF", - created_by=cls.user, - targeting_criteria=(TargetingCriteriaFactory()), - business_area=business_area, - ) - payment_record = PaymentRecordFactory( - parent=cash_plan, - household=household, - target_population=target_population, - ca_id="P8F-21-CSH-00031-0000006", - currency="PLN", - ) - PaymentVerificationFactory( - id="a76bfe6f-c767-4b7f-9671-6df10b8095cc", - payment_verification_plan=payment_verification_plan, - payment_obj=payment_record, - status=PaymentVerification.STATUS_PENDING, - ) - - cls.create_user_role_with_permissions(cls.user, [], business_area) - - def test_redirect_to_household_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_registrationgroup") - - expected_url = "/afghanistan/population/household" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_household_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_registrationgroup", - "HH-21-0000.8129", - "01780fad-9fa9-4e27-b3cd-7187c13452e5", - ) - - expected_url = ( - "/afghanistan/population/household/SG91c2Vob2xkTm9kZTowMTc4MGZhZC05ZmE5LTRlMjctYjNjZC03MTg3YzEzNDUyZTU=" - ) - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_individual_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_individual") - - expected_url = "/afghanistan/population/individuals" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_individual_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_individual", - "IND-21-0002.2658", - "001A2C2D-22CA-4538-A36F-D454AF5EDD3E", - ) - - expected_url = ( - "/afghanistan/population/individuals/SW5kaXZpZHVhbE5vZGU6MDAxYTJjMmQtMjJjYS00NTM4LWEzNmYtZDQ1NGFmNWVkZDNl" - ) - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_program_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_program") - - expected_url = "/afghanistan/programs" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_program_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_program", - "e6537f1e-27b5-4179-a443-d42498fb0478", - "e6537f1e-27b5-4179-a443-d42498fb0478", - ) - - expected_url = "/afghanistan/programs/UHJvZ3JhbU5vZGU6ZTY1MzdmMWUtMjdiNS00MTc5LWE0NDMtZDQyNDk4ZmIwNDc4" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_cash_plan_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_cashplan") - - expected_url = "/afghanistan/payment-verification" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_cash_plan_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_cashplan", - "B4M-21-CSH-00004", - "", - "e6537f1e-27b5-4179-a443-d42498fb0478", - ) - - expected_url = "/afghanistan/cashplans/Q2FzaFBsYW5Ob2RlOjAyNzJkZDJkLWM0MWUtNDM1ZC05NTg3LTZiYTI4MDY3OGM1NA==" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_payment_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_payment") - - expected_url = "/afghanistan/payment-verification" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_payment_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_payment", - "P8F-21-CSH-00031-0000006", - "", - "d442576f-2664-430d-81f9-38a1be362053", - ) - - expected_url = "/afghanistan/verification-records/UGF5bWVudFZlcmlmaWNhdGlvbk5vZGU6YTc2YmZlNmYtYzc2Ny00YjdmLTk2NzEtNmRmMTBiODA5NWNj" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_target_population_list(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect(self.user, "progres_targetpopulation") - - expected_url = "/afghanistan/target-population" - self.assertEqual(expected_url, hope_redirect.url()) - - def test_redirect_to_target_population_details(self) -> None: - hope_redirect: HopeRedirect = get_hope_redirect( - self.user, - "progres_targetpopulation", - "Brazil%20Demo-CAR", - "6FFB6BB7-3D43-4ECE-BB0E-21FDE209AFAF", - ) - - expected_url = "/afghanistan/target-population/VGFyZ2V0UG9wdWxhdGlvbk5vZGU6NmZmYjZiYjctM2Q0My00ZWNlLWJiMGUtMjFmZGUyMDlhZmFm" - self.assertEqual(expected_url, hope_redirect.url()) diff --git a/tests/unit/apps/dashboard/test_services.py b/tests/unit/apps/dashboard/test_services.py index a0f409afe6..015fd0f55c 100644 --- a/tests/unit/apps/dashboard/test_services.py +++ b/tests/unit/apps/dashboard/test_services.py @@ -56,7 +56,7 @@ def test_refresh_data(afghanistan: BusinessAreaFactory, populate_dashboard_cache data: ReturnDict = DashboardDataCache.refresh_data(afghanistan.slug) assert len(data) > 0 assert all(re.match(r"^[A-Z]{3}$", item["currency"]) for item in data) - assert sum(item["payments"] for item in data) == 8 + assert sum(item["payments"] for item in data) == 5 all_fields = DashboardHouseholdSerializer().get_fields().keys() assert data[0].keys() >= all_fields cache_key = DashboardDataCache.get_cache_key(afghanistan.slug) diff --git a/tests/unit/apps/grievance/snapshots/snap_test_grievance_create_sensitive_ticket.py b/tests/unit/apps/grievance/snapshots/snap_test_grievance_create_sensitive_ticket.py index 3b3ab61a4c..a5bc7d8ef0 100644 --- a/tests/unit/apps/grievance/snapshots/snap_test_grievance_create_sensitive_ticket.py +++ b/tests/unit/apps/grievance/snapshots/snap_test_grievance_create_sensitive_ticket.py @@ -72,7 +72,7 @@ 'fullName': 'John Doe' }, 'paymentRecord': { - 'fullName': 'John Doe second Individual' + 'fullName': 'John Doe Second Individual' } } }, @@ -91,7 +91,7 @@ 'fullName': 'John Doe' }, 'paymentRecord': { - 'fullName': 'John Doe second Individual' + 'fullName': 'John Doe Second Individual' } } } diff --git a/tests/unit/apps/grievance/test_filter_already_existing_tickets.py b/tests/unit/apps/grievance/test_filter_already_existing_tickets.py index 6e00ce4627..ceb871822b 100644 --- a/tests/unit/apps/grievance/test_filter_already_existing_tickets.py +++ b/tests/unit/apps/grievance/test_filter_already_existing_tickets.py @@ -21,7 +21,7 @@ ) from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -97,19 +97,19 @@ def setUpTestData(cls) -> None: {"given_name": "Jane", "family_name": "XDoe", "middle_name": "", "full_name": "Jane XDoe"}, ) program = ProgramFactory(business_area=cls.business_area) - cash_plan = CashPlanFactory(program=program, business_area=cls.business_area) - cls.payment_record = PaymentRecordFactory( + payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=cls.business_area) + cls.payment = PaymentFactory( household=cls.household_1, - full_name=cls.individuals_1[0].full_name, + collector=cls.individuals_1[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) - cls.payment_record2 = PaymentRecordFactory( - household=cls.household_1, - full_name=cls.individuals_1[0].full_name, + cls.payment2 = PaymentFactory( + household=cls.household_2, + collector=cls.individuals_2[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) grievance_1 = GrievanceTicketFactory( @@ -130,7 +130,7 @@ def setUpTestData(cls) -> None: cls.ticket = SensitiveGrievanceTicketWithoutExtrasFactory( household=cls.household_1, individual=cls.individuals_1[0], - payment_obj=cls.payment_record, + payment_obj=cls.payment, ticket=grievance_1, ) SensitiveGrievanceTicketWithoutExtrasFactory( diff --git a/tests/unit/apps/grievance/test_grievance_create_complaint_ticket.py b/tests/unit/apps/grievance/test_grievance_create_complaint_ticket.py index 970a861af8..20ca10680e 100644 --- a/tests/unit/apps/grievance/test_grievance_create_complaint_ticket.py +++ b/tests/unit/apps/grievance/test_grievance_create_complaint_ticket.py @@ -14,7 +14,7 @@ from hct_mis_api.apps.geo.fixtures import AreaFactory, AreaTypeFactory from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program @@ -66,22 +66,26 @@ def setUpTestData(cls) -> None: {"size": 1, "business_area": cls.business_area}, {"given_name": "John", "family_name": "Doe", "middle_name": "", "full_name": "John Doe"}, ) + cls.household2, cls.individuals2 = create_household( + {"size": 1, "business_area": cls.business_area}, + {"given_name": "John", "family_name": "Doe", "middle_name": "", "full_name": "John Doe second Individual"}, + ) cls.program = ProgramFactory(status=Program.ACTIVE, business_area=cls.business_area) cls.update_partner_access_to_program(partner, cls.program) - cash_plan = CashPlanFactory(program=cls.program, business_area=cls.business_area) - cls.payment_record = PaymentRecordFactory( + payment_plan = PaymentPlanFactory(program_cycle=cls.program.cycles.first(), business_area=cls.business_area) + cls.payment = PaymentFactory( household=cls.household, - full_name=cls.individuals[0].full_name, + collector=cls.individuals[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) - cls.second_payment_record = PaymentRecordFactory( - household=cls.household, - full_name=f"{cls.individuals[0].full_name} second Individual", + cls.second_payment = PaymentFactory( + household=cls.household2, + collector=cls.individuals2[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) super().setUpTestData() @@ -101,7 +105,7 @@ def test_create_complaint_ticket(self, _: Any, permissions: List[Permissions]) - input_data = self._create_variables( household=self.id_to_base64(self.household.id, "HouseholdNode"), individual=self.id_to_base64(self.individuals[0].id, "IndividualNode"), - payment_records=[self.id_to_base64(self.payment_record.id, "PaymentRecordNode")], + payment_records=[self.id_to_base64(self.payment.id, "PaymentNode")], ) self.snapshot_graphql_request( @@ -110,15 +114,15 @@ def test_create_complaint_ticket(self, _: Any, permissions: List[Permissions]) - variables=input_data, ) - def test_create_a_ticket_per_payment_record(self) -> None: + def test_create_a_ticket_per_payment(self) -> None: self.create_user_role_with_permissions(self.user, [Permissions.GRIEVANCES_CREATE], self.business_area) input_data = self._create_variables( household=self.id_to_base64(self.household.id, "HouseholdNode"), individual=self.id_to_base64(self.individuals[0].id, "IndividualNode"), payment_records=[ - self.id_to_base64(self.payment_record.id, "PaymentRecordNode"), - self.id_to_base64(self.second_payment_record.id, "PaymentRecordNode"), + self.id_to_base64(self.payment.id, "PaymentNode"), + self.id_to_base64(self.second_payment.id, "PaymentNode"), ], ) @@ -169,8 +173,8 @@ def test_create_complaint_ticket_with_two_payment_records(self, _: Any, permissi household=self.id_to_base64(self.household.id, "HouseholdNode"), individual=self.id_to_base64(self.individuals[0].id, "IndividualNode"), payment_records=[ - self.id_to_base64(self.payment_record.id, "PaymentRecordNode"), - self.id_to_base64(self.second_payment_record.id, "PaymentRecordNode"), + self.id_to_base64(self.payment.id, "PaymentNode"), + self.id_to_base64(self.second_payment.id, "PaymentNode"), ], ) @@ -194,7 +198,7 @@ def test_create_complaint_ticket_without_household(self, _: Any, permissions: Li input_data = self._create_variables( individual=self.id_to_base64(self.individuals[0].id, "IndividualNode"), - payment_records=[self.id_to_base64(self.payment_record.id, "PaymentRecordNode")], + payment_records=[self.id_to_base64(self.payment.id, "PaymentNode")], ) self.snapshot_graphql_request( @@ -217,7 +221,7 @@ def test_create_complaint_ticket_without_individual(self, _: Any, permissions: L input_data = self._create_variables( household=self.id_to_base64(self.household.id, "HouseholdNode"), - payment_records=[self.id_to_base64(self.payment_record.id, "PaymentRecordNode")], + payment_records=[self.id_to_base64(self.payment.id, "PaymentNode")], ) self.snapshot_graphql_request( diff --git a/tests/unit/apps/grievance/test_grievance_create_sensitive_ticket.py b/tests/unit/apps/grievance/test_grievance_create_sensitive_ticket.py index 68c4f1e56b..c59e45900d 100644 --- a/tests/unit/apps/grievance/test_grievance_create_sensitive_ticket.py +++ b/tests/unit/apps/grievance/test_grievance_create_sensitive_ticket.py @@ -14,7 +14,7 @@ from hct_mis_api.apps.geo.fixtures import AreaFactory, AreaTypeFactory from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program @@ -63,24 +63,28 @@ def setUpTestData(cls) -> None: ) cls.admin_area = AreaFactory(name="City Test", area_type=area_type, p_code="asfdsfg") - cls.household, cls.individuals = create_household( + cls.household1, cls.individuals1 = create_household( {"size": 1, "business_area": cls.business_area}, {"given_name": "John", "family_name": "Doe", "middle_name": "", "full_name": "John Doe"}, ) + cls.household2, cls.individuals2 = create_household( + {"size": 1, "business_area": cls.business_area}, + {"given_name": "John", "family_name": "Doe", "middle_name": "", "full_name": "John Doe Second Individual"}, + ) cls.program = ProgramFactory(status=Program.ACTIVE, business_area=cls.business_area) - cash_plan = CashPlanFactory(program=cls.program, business_area=cls.business_area) - cls.payment_record = PaymentRecordFactory( - household=cls.household, - full_name=cls.individuals[0].full_name, + payment_plan = PaymentPlanFactory(program_cycle=cls.program.cycles.first(), business_area=cls.business_area) + cls.payment = PaymentFactory( + household=cls.household1, + collector=cls.individuals1[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) - cls.second_payment_record = PaymentRecordFactory( - household=cls.household, - full_name=f"{cls.individuals[0].full_name} second Individual", + cls.second_payment = PaymentFactory( + household=cls.household2, + collector=cls.individuals2[0], business_area=cls.business_area, - parent=cash_plan, + parent=payment_plan, currency="PLN", ) cls.update_partner_access_to_program(partner, cls.program) @@ -111,8 +115,8 @@ def test_create_sensitive_ticket(self, _: Any, permissions: List[Permissions]) - "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode"), - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode"), + "household": self.id_to_base64(self.household1.id, "HouseholdNode"), + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode"), } } }, @@ -150,8 +154,8 @@ def test_create_sensitive_ticket_wrong_extras(self, _: Any, permissions: List[Pe "extras": { "category": { "grievanceComplaintTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode"), - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode"), + "household": self.id_to_base64(self.household1.id, "HouseholdNode"), + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode"), } } }, @@ -188,9 +192,9 @@ def test_create_sensitive_ticket_without_issue_type(self, _: Any, permissions: L "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode"), - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode"), - "paymentRecord": [self.id_to_base64(self.payment_record.id, "PaymentRecordNode")], + "household": self.id_to_base64(self.household1.id, "HouseholdNode"), + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode"), + "paymentRecord": [self.id_to_base64(self.payment.id, "PaymentNode")], } } }, @@ -228,11 +232,11 @@ def test_create_sensitive_ticket_with_two_payment_records(self, _: Any, permissi "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode"), - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode"), + "household": self.id_to_base64(self.household1.id, "HouseholdNode"), + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode"), "paymentRecord": [ - self.id_to_base64(self.payment_record.id, "PaymentRecordNode"), - self.id_to_base64(self.second_payment_record.id, "PaymentRecordNode"), + self.id_to_base64(self.payment.id, "PaymentNode"), + self.id_to_base64(self.second_payment.id, "PaymentNode"), ], } } @@ -271,8 +275,8 @@ def test_create_sensitive_ticket_without_payment_record(self, _: Any, permission "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode"), - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode"), + "household": self.id_to_base64(self.household1.id, "HouseholdNode"), + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode"), } } }, @@ -310,7 +314,7 @@ def test_create_sensitive_ticket_without_household(self, _: Any, permissions: Li "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "individual": self.id_to_base64(self.individuals[0].id, "IndividualNode") + "individual": self.id_to_base64(self.individuals1[0].id, "IndividualNode") } } }, @@ -348,7 +352,7 @@ def test_create_sensitive_ticket_without_individual(self, _: Any, permissions: L "extras": { "category": { "sensitiveGrievanceTicketExtras": { - "household": self.id_to_base64(self.household.id, "HouseholdNode") + "household": self.id_to_base64(self.household1.id, "HouseholdNode") } } }, diff --git a/tests/unit/apps/grievance/test_grievance_update_payment_verification_ticket.py b/tests/unit/apps/grievance/test_grievance_update_payment_verification_ticket.py index fa5c77ecc7..ee861abc38 100644 --- a/tests/unit/apps/grievance/test_grievance_update_payment_verification_ticket.py +++ b/tests/unit/apps/grievance/test_grievance_update_payment_verification_ticket.py @@ -15,18 +15,15 @@ from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household_and_individuals from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) class TestGrievanceUpdatePaymentVerificationTicketQuery(APITestCase): @@ -74,11 +71,11 @@ def setUpTestData(cls) -> None: cls.program = ProgramFactory(id="e6537f1e-27b5-4179-a443-d42498fb0478", status=Program.ACTIVE) cls.update_partner_access_to_program(partner, cls.program) - CashPlanFactory( + PaymentPlanFactory( id="0272dd2d-c41e-435d-9587-6ba280678c54", - ca_id="B4M-21-CSH-00004", + unicef_id="B4M-21-CSH-00004", business_area=cls.business_area, - program=cls.program, + program_cycle=cls.program.cycles.first(), ) household, _ = create_household_and_individuals( @@ -100,32 +97,25 @@ def setUpTestData(cls) -> None: ], ) - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( name="TEST", - program=cls.program, + program_cycle=cls.program.cycles.first(), business_area=cls.business_area, ) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, status=PaymentVerificationPlan.STATUS_ACTIVE - ) - - target_population = TargetPopulationFactory( - id="6FFB6BB7-3D43-4ECE-BB0E-21FDE209AFAF", - created_by=cls.user, - targeting_criteria=(TargetingCriteriaFactory()), - business_area=cls.business_area, + payment_plan=payment_plan, status=PaymentVerificationPlan.STATUS_ACTIVE ) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, - target_population=target_population, - ca_id="P8F-21-CSH-00031-123123", + unicef_id="P8F-21-CSH-00031-123123", currency="PLN", ) payment_verification = PaymentVerificationFactory( id="a76bfe6f-c767-4b7f-9671-6df10b8095cc", payment_verification_plan=payment_verification_plan, - payment_obj=payment_record, + payment=payment, status=PaymentVerification.STATUS_RECEIVED_WITH_ISSUES, ) cls.ticket = TicketPaymentVerificationDetailsFactory(payment_verification=payment_verification) diff --git a/tests/unit/apps/household/test_dashboard_queries.py b/tests/unit/apps/household/test_dashboard_queries.py index e7c4cb1e82..1e4c230147 100644 --- a/tests/unit/apps/household/test_dashboard_queries.py +++ b/tests/unit/apps/household/test_dashboard_queries.py @@ -9,12 +9,7 @@ from hct_mis_api.apps.core.fixtures import create_afghanistan from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, -) +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -167,47 +162,47 @@ def setUpTestData(cls) -> None: "male_age_group_60_count": 0, }, ) - cash_plan1 = CashPlanFactory(program=cls.program_one) + payment_plan1 = PaymentPlanFactory(program_cycle=cls.program_one.cycles.first()) delivery_date = timezone.datetime(2021, 10, 10, tzinfo=utc) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date, household=household1, delivered_quantity_usd=100, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date, household=household2, delivered_quantity_usd=100, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date, household=household3, delivered_quantity_usd=100, currency="PLN", ) - payment_plan1 = PaymentPlanFactory(program=cls.program_two) + payment_plan2 = PaymentPlanFactory(program_cycle=cls.program_two.cycles.first()) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date, delivered_quantity_usd=100, household=household1, currency="PLN", ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date, delivered_quantity_usd=100, household=household2, currency="PLN", ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date, delivered_quantity_usd=100, household=household4, diff --git a/tests/unit/apps/household/test_detecting_paid_hhs_loaded_via_sf.py b/tests/unit/apps/household/test_detecting_paid_hhs_loaded_via_sf.py index dd5d67ea91..bc2fe0eafd 100644 --- a/tests/unit/apps/household/test_detecting_paid_hhs_loaded_via_sf.py +++ b/tests/unit/apps/household/test_detecting_paid_hhs_loaded_via_sf.py @@ -10,7 +10,7 @@ from hct_mis_api.apps.household.management.commands.detect_paid_households import ( find_paid_households, ) -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory class TestDetectingAlreadyPaidHouseholds(TestCase): @@ -31,7 +31,7 @@ def setUpTestData(cls) -> None: has_data_sharing_agreement=True, ) - cls.cash_plan = CashPlanFactory(business_area=cls.business_area) + cls.payment_plan = PaymentPlanFactory(business_area=cls.business_area) cls.document_type = DocumentTypeFactory(key="tax_id") ## @@ -50,11 +50,11 @@ def setUpTestData(cls) -> None: ) cls.household_2.storage_obj = None cls.household_2.save() - PaymentRecordFactory( + PaymentFactory( household=cls.household_2, - full_name=cls.individuals_2[0].full_name, + collector=cls.individuals_2[0], business_area=cls.business_area, - parent=cls.cash_plan, + parent=cls.payment_plan, currency="PLN", ) cls.individuals_2[0].documents.add( diff --git a/tests/unit/apps/household/test_filter_individuals_by_program.py b/tests/unit/apps/household/test_filter_individuals_by_program.py index 399468522e..599cbe59ae 100644 --- a/tests/unit/apps/household/test_filter_individuals_by_program.py +++ b/tests/unit/apps/household/test_filter_individuals_by_program.py @@ -1,4 +1,5 @@ from typing import Any, List +from unittest import mock from parameterized import parameterized @@ -10,6 +11,9 @@ from hct_mis_api.apps.program.fixtures import ProgramFactory +@mock.patch( + "hct_mis_api.apps.registration_data.signals.increment_registration_data_import_version_cache", return_value=None +) class TestFilterIndividualsByProgram(APITestCase): QUERY = """ query AllIndividuals($program: ID){ @@ -112,7 +116,7 @@ def setUpTestData(cls) -> None: ("without_permission", []), ] ) - def test_individual_query_all(self, _: Any, permissions: List[Permissions]) -> None: + def test_individual_query_all(self, _mock: Any, _: Any, permissions: List[Permissions]) -> None: self.create_user_role_with_permissions(self.user, permissions, self.business_area, self.program1) headers = { diff --git a/tests/unit/apps/household/test_household_admin.py b/tests/unit/apps/household/test_household_admin.py index 53612c2549..e1cc9ba7b1 100644 --- a/tests/unit/apps/household/test_household_admin.py +++ b/tests/unit/apps/household/test_household_admin.py @@ -122,7 +122,7 @@ def mock_message_user(*args: Any, **kwargs: Any) -> None: ) self.assertIsNotNone(self.household.withdrawn_date) self.assertEqual( - self.household.user_fields["withdrawn_tag"], + self.household.internal_data["withdrawn_tag"], tag, ) self.assertEqual( @@ -155,7 +155,7 @@ def mock_message_user(*args: Any, **kwargs: Any) -> None: ) self.assertIsNotNone(self.household2.withdrawn_date) self.assertEqual( - self.household2.user_fields["withdrawn_tag"], + self.household2.internal_data["withdrawn_tag"], tag, ) self.assertEqual( diff --git a/tests/unit/apps/household/test_household_delivered_quantities_query.py b/tests/unit/apps/household/test_household_delivered_quantities_query.py index 1aa78e2a4a..4a180c7a0a 100644 --- a/tests/unit/apps/household/test_household_delivered_quantities_query.py +++ b/tests/unit/apps/household/test_household_delivered_quantities_query.py @@ -10,13 +10,8 @@ from hct_mis_api.apps.core.fixtures import create_afghanistan from hct_mis_api.apps.geo import models as geo_models from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, -) -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -54,17 +49,17 @@ def setUpTestData(cls) -> None: household.program = program household.save() - PaymentRecordFactory( - parent=CashPlanFactory(program=program), + PaymentFactory( + parent=PaymentPlanFactory(program_cycle=program.cycles.first()), currency="AFG", delivered_quantity_usd=50, delivered_quantity=100, household=household, - status=PaymentRecord.STATUS_SUCCESS, + status=Payment.STATUS_SUCCESS, ) PaymentFactory( - parent=PaymentPlanFactory(program=program), + parent=PaymentPlanFactory(program_cycle=program.cycles.first()), currency="AFG", delivered_quantity_usd=33, delivered_quantity=133, diff --git a/tests/unit/apps/household/test_household_status_endpoint.py b/tests/unit/apps/household/test_household_status_endpoint.py index 6b59193b44..c83fe3fd79 100644 --- a/tests/unit/apps/household/test_household_status_endpoint.py +++ b/tests/unit/apps/household/test_household_status_endpoint.py @@ -21,7 +21,7 @@ ROLE_NO_ROLE, PendingIndividualRoleInHousehold, ) -from hct_mis_api.apps.payment.fixtures import PaymentRecordFactory +from hct_mis_api.apps.payment.fixtures import PaymentFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation @@ -185,7 +185,9 @@ def test_getting_individual_with_status_paid(self) -> None: document_type = DocumentTypeFactory(key=IDENTIFICATION_TYPE_TO_KEY_MAPPING[IDENTIFICATION_TYPE_TAX_ID]) document = PendingDocumentFactory(individual=individual, type=document_type) tax_id = document.document_number - payment_record = PaymentRecordFactory(household=household, currency="PLN") + payment = PaymentFactory( + household=household, currency="PLN", delivery_date=datetime.date.today(), delivered_quantity=1 + ) response = self.api_client.get(f"/api/hh-status?tax_id={tax_id}") self.assertEqual(response.status_code, 200) @@ -193,7 +195,7 @@ def test_getting_individual_with_status_paid(self) -> None: self.assertIsNotNone(data["info"]) info = data["info"] self.assertEqual(info["status"], "paid") - self.assertEqual(info["date"], _time(payment_record.updated_at)) + self.assertEqual(datetime.datetime.fromisoformat(info["date"].replace("Z", "")).date(), payment.delivery_date) def test_getting_non_existent_household(self) -> None: response = self.api_client.get("/api/hh-status?registration_id=non-existent") diff --git a/tests/unit/apps/payment/services/test_dashboard_service.py b/tests/unit/apps/payment/services/test_dashboard_service.py index 686cbd9095..295cf562b6 100644 --- a/tests/unit/apps/payment/services/test_dashboard_service.py +++ b/tests/unit/apps/payment/services/test_dashboard_service.py @@ -10,11 +10,9 @@ from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.household.models import Household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, FinancialServiceProviderFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, generate_delivery_mechanisms, ) from hct_mis_api.apps.payment.models import DeliveryMechanism, GenericPayment @@ -81,9 +79,9 @@ def setUp(self) -> None: household_args={"size": 2, "business_area": business_area, "admin_area": admin_area3, "program": program}, ) - cash_plan = CashPlanFactory(program=program, business_area=business_area) - PaymentRecordFactory( - parent=cash_plan, + payment_plan1 = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=business_area) + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household1, delivery_type=self.dm_cash, @@ -93,8 +91,8 @@ def setUp(self) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household2, delivery_type=self.dm_voucher, @@ -104,8 +102,8 @@ def setUp(self) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 11, 10, tzinfo=utc), household=household3, delivery_type=self.dm_cash, @@ -116,9 +114,9 @@ def setUp(self) -> None: currency="PLN", ) - payment_plan = PaymentPlanFactory(program=program, business_area=business_area) + payment_plan2 = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=business_area) PaymentFactory( - parent=payment_plan, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), delivery_type=self.dm_cash, delivered_quantity=10 + num, @@ -130,7 +128,7 @@ def setUp(self) -> None: financial_service_provider=fsp, ) PaymentFactory( - parent=payment_plan, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), delivery_type=self.dm_voucher, delivered_quantity=20 + num, @@ -142,7 +140,7 @@ def setUp(self) -> None: financial_service_provider=fsp, ) PaymentFactory( - parent=payment_plan, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 11, 10, tzinfo=utc), delivery_type=self.dm_cash, delivered_quantity=30 + num, diff --git a/tests/unit/apps/payment/snapshots/snap_test_create_payment_verification_mutation.py b/tests/unit/apps/payment/snapshots/snap_test_create_payment_verification_mutation.py index 05eaeac891..0e096a0c8b 100644 --- a/tests/unit/apps/payment/snapshots/snap_test_create_payment_verification_mutation.py +++ b/tests/unit/apps/payment/snapshots/snap_test_create_payment_verification_mutation.py @@ -31,7 +31,7 @@ 'data': { 'createPaymentVerificationPlan': { 'paymentPlan': { - 'id': 'Q2FzaFBsYW5Ob2RlOjBlMjkyN2FmLWM4NGQtNDg1Mi1iYjBiLTc3M2VmZTA1OWUwNQ==' + 'id': 'UGF5bWVudFBsYW5Ob2RlOjBlMjkyN2FmLWM4NGQtNDg1Mi1iYjBiLTc3M2VmZTA1OWUwNQ==' } } } diff --git a/tests/unit/apps/payment/snapshots/snap_test_delete_verification_mutation.py b/tests/unit/apps/payment/snapshots/snap_test_delete_verification_mutation.py index 8e9a381bf0..45c37c3a84 100644 --- a/tests/unit/apps/payment/snapshots/snap_test_delete_verification_mutation.py +++ b/tests/unit/apps/payment/snapshots/snap_test_delete_verification_mutation.py @@ -51,7 +51,7 @@ 'data': { 'deletePaymentVerificationPlan': { 'paymentPlan': { - 'objType': 'CashPlan', + 'objType': 'PaymentPlan', 'verificationPlans': { 'edges': [ { diff --git a/tests/unit/apps/payment/snapshots/snap_test_discard_verification_mutation.py b/tests/unit/apps/payment/snapshots/snap_test_discard_verification_mutation.py index 907003123a..e4c8a935dc 100644 --- a/tests/unit/apps/payment/snapshots/snap_test_discard_verification_mutation.py +++ b/tests/unit/apps/payment/snapshots/snap_test_discard_verification_mutation.py @@ -11,7 +11,7 @@ 'data': { 'discardPaymentVerificationPlan': { 'paymentPlan': { - 'objType': 'CashPlan', + 'objType': 'PaymentPlan', 'verificationPlans': { 'edges': [ { diff --git a/tests/unit/apps/payment/test_action_payment_plan_mutation.py b/tests/unit/apps/payment/test_action_payment_plan_mutation.py index 1313472b56..a4c9290de9 100644 --- a/tests/unit/apps/payment/test_action_payment_plan_mutation.py +++ b/tests/unit/apps/payment/test_action_payment_plan_mutation.py @@ -22,7 +22,6 @@ FinancialServiceProviderFactory, PaymentFactory, PaymentPlanFactory, - RealProgramFactory, generate_delivery_mechanisms, ) from hct_mis_api.apps.payment.models import ( @@ -30,6 +29,7 @@ DeliveryMechanism, PaymentPlan, ) +from hct_mis_api.apps.program.fixtures import ProgramCycleFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory @@ -96,7 +96,9 @@ def setUpTestData(cls) -> None: ) cls.business_area = BusinessArea.objects.get(slug="afghanistan") - cls.payment_plan = PaymentPlanFactory.create(business_area=cls.business_area, program=RealProgramFactory()) + cls.payment_plan = PaymentPlanFactory.create( + business_area=cls.business_area, program_cycle=ProgramCycleFactory() + ) cls.registration_data_import = RegistrationDataImportFactory(business_area=cls.business_area) household, individuals = create_household_and_individuals( household_data={ diff --git a/tests/unit/apps/payment/test_all_payment_plan_queries.py b/tests/unit/apps/payment/test_all_payment_plan_queries.py index a680775e29..f9274d3b5b 100644 --- a/tests/unit/apps/payment/test_all_payment_plan_queries.py +++ b/tests/unit/apps/payment/test_all_payment_plan_queries.py @@ -35,24 +35,20 @@ def create_child_payment_plans(pp: PaymentPlan) -> None: fpp1 = PaymentPlanFactory( id="56aca38c-dc16-48a9-ace4-70d88b41d462", - dispersion_start_date=datetime(2020, 8, 10), - dispersion_end_date=datetime(2020, 12, 10), is_follow_up=True, source_payment_plan=pp, - program__cycle__start_date=timezone.datetime(2020, 9, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2020, 11, 10, tzinfo=utc).date(), + dispersion_start_date=datetime(2020, 8, 10), + dispersion_end_date=datetime(2020, 12, 10), ) fpp1.unicef_id = "PP-0060-20-00000003" fpp1.save() fpp2 = PaymentPlanFactory( id="5b04f7c3-579a-48dd-a232-424daaefffe7", - dispersion_start_date=datetime(2020, 8, 10), - dispersion_end_date=datetime(2020, 12, 10), is_follow_up=True, source_payment_plan=pp, - program__cycle__start_date=timezone.datetime(2020, 9, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2020, 11, 10, tzinfo=utc).date(), + dispersion_start_date=datetime(2020, 8, 10), + dispersion_end_date=datetime(2020, 12, 10), ) fpp2.unicef_id = "PP-0060-20-00000004" fpp2.save() @@ -236,7 +232,6 @@ def setUpTestData(cls) -> None: ) program_cycle = program.cycles.first() cls.pp = PaymentPlanFactory( - program=program, program_cycle=program_cycle, dispersion_start_date=datetime(2020, 8, 10), dispersion_end_date=datetime(2020, 12, 10), @@ -276,7 +271,6 @@ def setUpTestData(cls) -> None: # create hard conflicted payment cls.pp_conflicted = PaymentPlanFactory( - program=program, program_cycle=program_cycle, status=PaymentPlan.Status.LOCKED, dispersion_start_date=cls.pp.dispersion_start_date + relativedelta(months=2), @@ -468,7 +462,6 @@ def test_payment_node_with_legacy_data(self) -> None: cycle__end_date=timezone.datetime(2023, 11, 10, tzinfo=utc).date(), ) new_pp = PaymentPlanFactory( - program=program, program_cycle=program.cycles.first(), dispersion_start_date=datetime(2023, 8, 10), dispersion_end_date=datetime(2023, 12, 10), diff --git a/tests/unit/apps/payment/test_all_payment_records.py b/tests/unit/apps/payment/test_all_payment_records.py deleted file mode 100644 index f06f4d9628..0000000000 --- a/tests/unit/apps/payment/test_all_payment_records.py +++ /dev/null @@ -1,102 +0,0 @@ -import itertools - -from hct_mis_api.apps.account.fixtures import UserFactory -from hct_mis_api.apps.account.permissions import Permissions -from hct_mis_api.apps.core.base_test_case import APITestCase -from hct_mis_api.apps.core.fixtures import create_afghanistan -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.core.utils import encode_id_base64 -from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory - - -class TestAllPaymentRecords(APITestCase): - ALL_PAYMENT_RECORDS_QUERY = """ - query AllPaymentRecords($cashPlan: ID, $household: ID, $businessArea: String, $programId: String) { - allPaymentRecords(parent: $cashPlan, household: $household, businessArea: $businessArea, programId: $programId) { - totalCount - edgeCount - } - } - """ - - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - create_afghanistan() - cls.user = UserFactory.create() - (cls.household1, _) = create_household(household_args={"size": 1}) - (cls.household2, _) = create_household(household_args={"size": 1}) - (cls.household3, _) = create_household(household_args={"size": 1}) - business_area = BusinessArea.objects.get(slug="afghanistan") - cls.cash_plan1 = CashPlanFactory(funds_commitment="123456", exchange_rate=None) - cls.cash_plan2 = CashPlanFactory(funds_commitment="123456", exchange_rate=None) - cls.cash_plan3 = CashPlanFactory(funds_commitment="123456", exchange_rate=None) - PaymentRecordFactory.create_batch( - 2, - business_area=business_area, - household=cls.household1, - parent=cls.cash_plan1, - currency="PLN", - ) - PaymentRecordFactory.create_batch( - 1, - business_area=business_area, - household=cls.household1, - parent=cls.cash_plan2, - currency="PLN", - ) - PaymentRecordFactory.create_batch( - 2, - business_area=business_area, - household=cls.household2, - parent=cls.cash_plan1, - currency="PLN", - ) - PaymentRecordFactory.create_batch( - 2, - business_area=business_area, - household=cls.household2, - parent=cls.cash_plan3, - currency="PLN", - ) - cls.create_user_role_with_permissions( - cls.user, [Permissions.PROGRAMME_VIEW_LIST_AND_DETAILS], BusinessArea.objects.get(slug="afghanistan") - ) - - def test_fetch_payment_records_filter_by_household(self) -> None: - for household in [self.household1, self.household2, self.household3]: - self.snapshot_graphql_request( - request_string=self.ALL_PAYMENT_RECORDS_QUERY, - context={"user": self.user}, - variables={ - "household": encode_id_base64(household.pk, "Household"), - "businessArea": "afghanistan", - }, - ) - - def test_fetch_payment_records_filter_by_cash_plan(self) -> None: - for cash_plan in [self.cash_plan1, self.cash_plan2, self.cash_plan3]: - self.snapshot_graphql_request( - request_string=self.ALL_PAYMENT_RECORDS_QUERY, - context={"user": self.user}, - variables={ - "cashPlan": encode_id_base64(cash_plan.pk, "CashPlan"), - "businessArea": "afghanistan", - }, - ) - - def test_fetch_payment_records_filter_by_cash_plan_and_household_and_program(self) -> None: - households = [self.household1, self.household2, self.household3] - cash_plans = [self.cash_plan1, self.cash_plan2, self.cash_plan3] - for household, cash_plan in itertools.product(households, cash_plans): - self.snapshot_graphql_request( - request_string=self.ALL_PAYMENT_RECORDS_QUERY, - context={"user": self.user}, - variables={ - "household": encode_id_base64(household.pk, "Household"), - "cashPlan": encode_id_base64(cash_plan.pk, "CashPlan"), - "businessArea": "afghanistan", - "programId": encode_id_base64(cash_plan.program.pk, "Household"), - }, - ) diff --git a/tests/unit/apps/payment/test_build_snapshot.py b/tests/unit/apps/payment/test_build_snapshot.py index 70fb24e049..f03ab177fd 100644 --- a/tests/unit/apps/payment/test_build_snapshot.py +++ b/tests/unit/apps/payment/test_build_snapshot.py @@ -34,10 +34,7 @@ def setUpTestData(cls) -> None: program = RealProgramFactory() program_cycle = program.cycles.first() cls.pp = PaymentPlanFactory( - program=program, program_cycle=program_cycle, - dispersion_start_date=datetime(2020, 8, 10), - dispersion_end_date=datetime(2020, 12, 10), is_follow_up=False, ) cls.pp.unicef_id = "PP-01" @@ -114,7 +111,6 @@ def test_batching(self) -> None: program = RealProgramFactory() program_cycle = program.cycles.first() pp = PaymentPlanFactory( - program=program, program_cycle=program_cycle, dispersion_start_date=datetime(2020, 8, 10), dispersion_end_date=datetime(2020, 12, 10), diff --git a/tests/unit/apps/payment/test_build_summary.py b/tests/unit/apps/payment/test_build_summary.py index 572cc14557..efb6ae2d6a 100644 --- a/tests/unit/apps/payment/test_build_summary.py +++ b/tests/unit/apps/payment/test_build_summary.py @@ -4,7 +4,8 @@ from hct_mis_api.apps.core.fixtures import create_afghanistan from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, + PaymentPlanFactory, + PaymentVerificationSummaryFactory, create_payment_verification_plan_with_status, ) from hct_mis_api.apps.payment.models import ( @@ -33,51 +34,52 @@ def setUpTestData(cls) -> None: targeting_criteria=TargetingCriteriaFactory(), business_area=cls.business_area, ) - cls.cash_plan = CashPlanFactory( + cls.payment_plan = PaymentPlanFactory( name="TEST", - program=cls.program, + program_cycle=cls.program.cycles.first(), business_area=cls.business_area, ) + PaymentVerificationSummaryFactory(payment_plan=cls.payment_plan) def test_status_pending_when_zero_verifications(self) -> None: - build_summary(self.cash_plan) + build_summary(self.payment_plan) - summary = self.cash_plan.get_payment_verification_summary + summary = self.payment_plan.payment_verification_summary self.assertEqual(summary.status, PaymentVerificationSummary.STATUS_PENDING) def test_status_active_when_at_least_one_active_verification(self) -> None: self._create_verification_with_status(PaymentVerificationPlan.STATUS_ACTIVE) - build_summary(self.cash_plan) + build_summary(self.payment_plan) - summary = self.cash_plan.get_payment_verification_summary + summary = self.payment_plan.payment_verification_summary self.assertEqual(summary.status, PaymentVerificationSummary.STATUS_ACTIVE) def test_status_finished_when_all_verifications_finished(self) -> None: self._create_verification_with_status(PaymentVerificationPlan.STATUS_FINISHED) - build_summary(self.cash_plan) + build_summary(self.payment_plan) - summary = self.cash_plan.get_payment_verification_summary + summary = self.payment_plan.payment_verification_summary self.assertEqual(summary.status, PaymentVerificationSummary.STATUS_FINISHED) def test_status_pending_when_add_and_removed_verification(self) -> None: payment_verification_plan = self._create_verification_with_status(PaymentVerificationPlan.STATUS_PENDING) payment_verification_plan.delete() - build_summary(self.cash_plan) + build_summary(self.payment_plan) - summary = self.cash_plan.get_payment_verification_summary + summary = self.payment_plan.payment_verification_summary self.assertEqual(summary.status, PaymentVerificationSummary.STATUS_PENDING) def test_query_number(self) -> None: - with self.assertNumQueries(3): - build_summary(self.cash_plan) + with self.assertNumQueries(2): + build_summary(self.payment_plan) def _create_verification_with_status(self, status: str) -> PaymentVerificationPlan: return create_payment_verification_plan_with_status( - self.cash_plan, + self.payment_plan, self.user, self.business_area, self.program, diff --git a/tests/unit/apps/payment/test_chart_total_transferred_cash_by_country.py b/tests/unit/apps/payment/test_chart_total_transferred_cash_by_country.py index eeac008b95..202f146328 100644 --- a/tests/unit/apps/payment/test_chart_total_transferred_cash_by_country.py +++ b/tests/unit/apps/payment/test_chart_total_transferred_cash_by_country.py @@ -10,10 +10,9 @@ from hct_mis_api.apps.account.permissions import Permissions from hct_mis_api.apps.core.base_test_case import APITestCase from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, generate_delivery_mechanisms, ) from hct_mis_api.apps.payment.models import DeliveryMechanism @@ -41,30 +40,27 @@ def setUpTestData(cls) -> None: dm_voucher = DeliveryMechanism.objects.get(code="voucher") cls.partner = PartnerFactory(name="Test1") cls.user = UserFactory(partner=cls.partner) - (household, _) = create_household(household_args={"size": 1}) - cash_plan = CashPlanFactory(funds_commitment="123456", exchange_rate=None) + payment_plan = PaymentPlanFactory(exchange_rate=None) chosen_business_areas = ("afghanistan", "botswana", "angola") delivery_date = timezone.datetime(2021, 10, 10, tzinfo=utc) for business_area_slug in chosen_business_areas: business_area = BusinessArea.objects.get(slug=business_area_slug) - PaymentRecordFactory.create_batch( + PaymentFactory.create_batch( 3, delivery_date=delivery_date, business_area=business_area, delivery_type=dm_cash, delivered_quantity_usd=200.20, - parent=cash_plan, - household=household, + parent=payment_plan, currency="PLN", ) - PaymentRecordFactory.create_batch( + PaymentFactory.create_batch( 3, delivery_date=delivery_date, business_area=business_area, delivery_type=dm_voucher, delivered_quantity_usd=100.00, - parent=cash_plan, - household=household, + parent=payment_plan, currency="PLN", ) diff --git a/tests/unit/apps/payment/test_create_cash_plan_from_reconciliation.py b/tests/unit/apps/payment/test_create_cash_plan_from_reconciliation.py deleted file mode 100644 index 9afe1b1126..0000000000 --- a/tests/unit/apps/payment/test_create_cash_plan_from_reconciliation.py +++ /dev/null @@ -1,67 +0,0 @@ -from io import BytesIO - -from hct_mis_api.apps.core.base_test_case import APITestCase -from hct_mis_api.apps.core.fixtures import create_afghanistan -from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices -from hct_mis_api.apps.payment.fixtures import generate_delivery_mechanisms -from hct_mis_api.apps.payment.services.create_cash_plan_from_reconciliation import ( - CreateCashPlanReconciliationService, - ValidationError, -) - - -class TestCreateCashPlanFromReconciliation(APITestCase): - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - cls.business_area = create_afghanistan() - generate_delivery_mechanisms() - - def test_parse_header_assign_indexes(self) -> None: - column_mapping = { - CreateCashPlanReconciliationService.COLUMN_PAYMENT_ID: "Payment ID", - CreateCashPlanReconciliationService.COLUMN_PAYMENT_STATUS: "Reconciliation status", - CreateCashPlanReconciliationService.COLUMN_DELIVERED_AMOUNT: "Delivered Amount", - CreateCashPlanReconciliationService.COLUMN_ENTITLEMENT_QUANTITY: "Entitlement Quantity", - } - header_row = ["Payment ID", "Reconciliation status", "Delivered Amount", "Entitlement Quantity"] - column_index_mapping = { - CreateCashPlanReconciliationService.COLUMN_PAYMENT_ID: 0, - CreateCashPlanReconciliationService.COLUMN_PAYMENT_STATUS: 1, - CreateCashPlanReconciliationService.COLUMN_DELIVERED_AMOUNT: 2, - CreateCashPlanReconciliationService.COLUMN_ENTITLEMENT_QUANTITY: 3, - } - service = CreateCashPlanReconciliationService( - self.business_area, BytesIO(), column_mapping, {}, "HRVN", DeliveryMechanismChoices.DELIVERY_TYPE_CASH, "" - ) - service._parse_header(header_row) - - self.assertEqual(service.column_index_mapping, column_index_mapping) - - def test_parse_header_raise_validation_error(self) -> None: - column_mapping = { - CreateCashPlanReconciliationService.COLUMN_PAYMENT_ID: "id", - CreateCashPlanReconciliationService.COLUMN_PAYMENT_STATUS: "status", - CreateCashPlanReconciliationService.COLUMN_DELIVERED_AMOUNT: "amount", - CreateCashPlanReconciliationService.COLUMN_ENTITLEMENT_QUANTITY: "NOT_A_COLUMN", - } - header_row = ["id", "status", "amount", "Entitlement Quantity"] - service = CreateCashPlanReconciliationService( - self.business_area, BytesIO(), column_mapping, {}, "HRVN", DeliveryMechanismChoices.DELIVERY_TYPE_CASH, "" - ) - with self.assertRaises(ValidationError): - service._parse_header(header_row) - - def test_parse_header_raise_validation_error2(self) -> None: - column_mapping = { - CreateCashPlanReconciliationService.COLUMN_PAYMENT_ID: "id", - CreateCashPlanReconciliationService.COLUMN_PAYMENT_STATUS: "status", - CreateCashPlanReconciliationService.COLUMN_DELIVERED_AMOUNT: "amount", - "NOT_A_COLUMN": "Entitlement Quantity", - } - header_row = ["id", "status", "amount", "Entitlement Quantity"] - service = CreateCashPlanReconciliationService( - self.business_area, BytesIO(), column_mapping, {}, "HRVN", DeliveryMechanismChoices.DELIVERY_TYPE_CASH, "" - ) - with self.assertRaises(ValidationError): - service._parse_header(header_row) diff --git a/tests/unit/apps/payment/test_create_payment_verification_mutation.py b/tests/unit/apps/payment/test_create_payment_verification_mutation.py index 53ff998044..9149b13330 100644 --- a/tests/unit/apps/payment/test_create_payment_verification_mutation.py +++ b/tests/unit/apps/payment/test_create_payment_verification_mutation.py @@ -8,8 +8,12 @@ from hct_mis_api.apps.core.fixtures import create_afghanistan from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.fixtures import ( + PaymentFactory, + PaymentPlanFactory, + PaymentVerificationSummaryFactory, +) +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program @@ -35,10 +39,11 @@ def setUpTestData(cls) -> None: cls.active_program = ProgramFactory(status=Program.ACTIVE) cls.finished_program = ProgramFactory(status=Program.FINISHED) - cls.cash_plan = CashPlanFactory.create( + cls.payment_plan = PaymentPlanFactory.create( id="0e2927af-c84d-4852-bb0b-773efe059e05", business_area=cls.business_area, ) + PaymentVerificationSummaryFactory.create(payment_plan=cls.payment_plan) @parameterized.expand( [ @@ -49,20 +54,20 @@ def setUpTestData(cls) -> None: def test_create_cash_plan_payment_verification(self, _: Any, permissions: List[Permissions]) -> None: self.create_user_role_with_permissions(self.user, permissions, self.business_area) (household, _) = create_household(household_args={"size": 1}) - PaymentRecordFactory.create( - parent=self.cash_plan, - business_area=self.cash_plan.business_area, + PaymentFactory.create( + parent=self.payment_plan, + business_area=self.payment_plan.business_area, delivered_quantity=1000, delivered_quantity_usd=None, household=household, - status=PaymentRecord.STATUS_SUCCESS, + status=Payment.STATUS_SUCCESS, currency="PLN", ) # after .create(...), newly created PaymentRecord does not have `head_of_household` set # logic needs it to check record.head_of_household.phone_no # hence the below - assert PaymentRecord.objects.count() == 1 - PaymentRecord.objects.all().update(head_of_household=household.head_of_household) + assert Payment.objects.count() == 1 + Payment.objects.all().update(collector=household.head_of_household) self.snapshot_graphql_request( request_string=self.MUTATION, @@ -74,7 +79,7 @@ def test_create_cash_plan_payment_verification(self, _: Any, permissions: List[P }, variables={ "input": { - "cashOrPaymentPlanId": self.id_to_base64(self.cash_plan.id, "CashPlanNode"), + "cashOrPaymentPlanId": self.id_to_base64(self.payment_plan.id, "PaymentPlanNode"), "sampling": "FULL_LIST", "fullListArguments": {"excludedAdminAreas": []}, "verificationChannel": "MANUAL", @@ -89,7 +94,7 @@ def test_create_cash_plan_payment_verification_when_invalid_arguments(self) -> N self.create_user_role_with_permissions(self.user, [Permissions.PAYMENT_VERIFICATION_CREATE], self.business_area) defaults = { - "cashOrPaymentPlanId": self.id_to_base64(self.cash_plan.id, "CashPlanNode"), + "cashOrPaymentPlanId": self.id_to_base64(self.payment_plan.id, "PaymentPlanNode"), "businessAreaSlug": "afghanistan", } @@ -172,7 +177,7 @@ def test_can_t_create_cash_plan_payment_verification_when_there_are_not_availabl }, variables={ "input": { - "cashOrPaymentPlanId": self.id_to_base64(self.cash_plan.id, "CashPlanNode"), + "cashOrPaymentPlanId": self.id_to_base64(self.payment_plan.id, "PaymentPlanNode"), "sampling": "FULL_LIST", "fullListArguments": {"excludedAdminAreas": []}, "verificationChannel": "MANUAL", @@ -196,7 +201,7 @@ def test_create_cash_plan_payment_verification_when_program_is_finished(self) -> }, variables={ "input": { - "cashOrPaymentPlanId": self.id_to_base64(self.cash_plan.id, "CashPlanNode"), + "cashOrPaymentPlanId": self.id_to_base64(self.payment_plan.id, "PaymentPlanNode"), "sampling": "FULL_LIST", "fullListArguments": {"excludedAdminAreas": []}, "verificationChannel": "MANUAL", diff --git a/tests/unit/apps/payment/test_dashboard_queries.py b/tests/unit/apps/payment/test_dashboard_queries.py index d6f7434514..b81534f076 100644 --- a/tests/unit/apps/payment/test_dashboard_queries.py +++ b/tests/unit/apps/payment/test_dashboard_queries.py @@ -17,19 +17,12 @@ from hct_mis_api.apps.geo.fixtures import AreaFactory, AreaTypeFactory from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, FinancialServiceProviderFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, generate_delivery_mechanisms, ) -from hct_mis_api.apps.payment.models import ( - DeliveryMechanism, - GenericPayment, - Payment, - PaymentRecord, -) +from hct_mis_api.apps.payment.models import DeliveryMechanism, GenericPayment, Payment from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -243,9 +236,9 @@ def setUpTestData(cls) -> None: "program": program1, }, ) - cash_plan1 = CashPlanFactory(program=program1, business_area=business_area) - PaymentRecordFactory( - parent=cash_plan1, + payment_plan1 = PaymentPlanFactory(program_cycle=program1.cycles.first(), business_area=business_area) + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household1_admin1, delivery_type=cls.dm_cash, @@ -255,8 +248,8 @@ def setUpTestData(cls) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household1_admin2, delivery_type=cls.dm_voucher, @@ -266,8 +259,8 @@ def setUpTestData(cls) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household3_admin2, delivery_type=cls.dm_voucher, @@ -277,8 +270,8 @@ def setUpTestData(cls) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 11, 10, tzinfo=utc), household=household1_admin3, delivery_type=cls.dm_cash, @@ -288,8 +281,8 @@ def setUpTestData(cls) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household3_admin3, delivery_type=cls.dm_voucher, @@ -299,8 +292,8 @@ def setUpTestData(cls) -> None: business_area=business_area, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), household=household4_admin3, delivery_type=cls.dm_voucher, @@ -311,9 +304,9 @@ def setUpTestData(cls) -> None: currency="PLN", ) - payment_plan1 = PaymentPlanFactory(program=program1, business_area=business_area) + payment_plan2 = PaymentPlanFactory(program_cycle=program1.cycles.first(), business_area=business_area) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), delivery_type=cls.dm_cash, delivered_quantity=10 + num, @@ -325,7 +318,7 @@ def setUpTestData(cls) -> None: financial_service_provider=fsp, ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), delivery_type=cls.dm_voucher, delivered_quantity=20 + num, @@ -337,7 +330,7 @@ def setUpTestData(cls) -> None: financial_service_provider=fsp, ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=timezone.datetime(2021, 11, 10, tzinfo=utc), delivery_type=cls.dm_cash, delivered_quantity=30 + num, @@ -377,7 +370,7 @@ def test_chart_total_transferred_by_country(self) -> None: for index, ba_name in enumerate(resp_data["labels"]): ba = BusinessArea.objects.get(slug=ba_name.lower()) - qs_success_payment_record = PaymentRecord.objects.filter(business_area=ba) + qs_success_payment_record = Payment.objects.filter(business_area=ba) qs_success_payment = Payment.objects.filter(business_area=ba) payment_records_cash = qs_success_payment_record.filter(delivery_type=self.dm_cash) payment_records_voucher = qs_success_payment_record.filter(delivery_type=self.dm_voucher) diff --git a/tests/unit/apps/payment/test_delete_verification_mutation.py b/tests/unit/apps/payment/test_delete_verification_mutation.py index bc6b1f1ee5..31f1d9b0ef 100644 --- a/tests/unit/apps/payment/test_delete_verification_mutation.py +++ b/tests/unit/apps/payment/test_delete_verification_mutation.py @@ -9,7 +9,8 @@ from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, + PaymentPlanFactory, + PaymentVerificationSummaryFactory, create_payment_verification_plan_with_status, ) from hct_mis_api.apps.payment.models import PaymentVerificationPlan @@ -52,12 +53,13 @@ def setUpTestData(cls) -> None: targeting_criteria=(TargetingCriteriaFactory()), business_area=cls.business_area, ) - cls.cash_plan = CashPlanFactory( + cls.payment_plan = PaymentPlanFactory( name="TEST", - program=cls.program, + program_cycle=cls.program.cycles.first(), business_area=cls.business_area, ) - cls.verification = cls.cash_plan.payment_verification_plan.first() + PaymentVerificationSummaryFactory(payment_plan=cls.payment_plan) + cls.verification = cls.payment_plan.payment_verification_plans.first() @parameterized.expand( [ @@ -103,7 +105,7 @@ def test_delete_active_verification_plan(self, _: Any, permissions: List[Permiss def create_pending_payment_verification_plan(self) -> PaymentVerificationPlan: return create_payment_verification_plan_with_status( - self.cash_plan, + self.payment_plan, self.user, self.business_area, self.program, @@ -113,7 +115,7 @@ def create_pending_payment_verification_plan(self) -> PaymentVerificationPlan: def create_active_payment_verification_plan(self) -> PaymentVerificationPlan: return create_payment_verification_plan_with_status( - self.cash_plan, + self.payment_plan, self.user, self.business_area, self.program, diff --git a/tests/unit/apps/payment/test_discard_verification_mutation.py b/tests/unit/apps/payment/test_discard_verification_mutation.py index 5433f490e0..a27ba762b0 100644 --- a/tests/unit/apps/payment/test_discard_verification_mutation.py +++ b/tests/unit/apps/payment/test_discard_verification_mutation.py @@ -10,18 +10,15 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.fixtures import EntitlementCardFactory, create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) class TestDiscardVerificationMutation(APITestCase): @@ -59,20 +56,15 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=cls.business_area) program.admin_areas.set(Area.objects.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=cls.user, - targeting_criteria=targeting_criteria, - business_area=cls.business_area, - ) - cash_plan = CashPlanFactory( + payment_plan = PaymentPlanFactory( name="TEST", - program=program, + program_cycle=program.cycles.first(), business_area=cls.business_area, ) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL + payment_plan=payment_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL ) payment_verification_plan.status = PaymentVerificationPlan.STATUS_ACTIVE payment_verification_plan.save() @@ -90,20 +82,19 @@ def setUpTestData(cls) -> None: household.programs.add(program) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, - target_population=target_population, currency="PLN", ) PaymentVerificationFactory( payment_verification_plan=payment_verification_plan, - payment_obj=payment_record, + payment=payment, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=household) - cls.cash_plan = cash_plan - cls.verification = cash_plan.payment_verification_plan.first() + cls.payment_plan = payment_plan + cls.verification = payment_plan.payment_verification_plans.first() @parameterized.expand( [ diff --git a/tests/unit/apps/payment/test_exclude_households.py b/tests/unit/apps/payment/test_exclude_households.py index 53787f2caf..6b4fbbcc95 100644 --- a/tests/unit/apps/payment/test_exclude_households.py +++ b/tests/unit/apps/payment/test_exclude_households.py @@ -199,7 +199,6 @@ def test_exclude_all_households(self) -> None: def test_exclude_payment_error_when_payment_has_hard_conflicts(self) -> None: finished_payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.FINISHED, - program=self.program, is_follow_up=False, program_cycle=self.program_cycle, ) @@ -259,8 +258,8 @@ def test_exclude_individuals_people_program(self, get_exchange_rate_mock: Any) - self.program.data_collecting_type = people_dct self.program.save(update_fields=["data_collecting_type"]) self.payment_plan.background_action_status = PaymentPlan.BackgroundActionStatus.EXCLUDE_BENEFICIARIES - self.payment_plan.program = self.program - self.payment_plan.save(update_fields=["background_action_status", "program"]) + self.payment_plan.program_cycle = self.program.cycles.first() + self.payment_plan.save(update_fields=["background_action_status", "program_cycle"]) ind_unicef_id_1 = Individual.objects.get(id=self.individual_1.id).unicef_id ind_unicef_id_2 = Individual.objects.get(id=self.individual_2.id).unicef_id diff --git a/tests/unit/apps/payment/test_export_xlsx_verification_mutation.py b/tests/unit/apps/payment/test_export_xlsx_verification_mutation.py index 13723bcad2..644faedc82 100644 --- a/tests/unit/apps/payment/test_export_xlsx_verification_mutation.py +++ b/tests/unit/apps/payment/test_export_xlsx_verification_mutation.py @@ -9,8 +9,9 @@ from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, + PaymentPlanFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerificationPlan from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -48,10 +49,10 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=cls.business_area) program.admin_areas.set(Area.objects.order_by("?")[:3]) - cash_plan = CashPlanFactory(program=program, business_area=cls.business_area) - cash_plan.save() + payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=cls.business_area) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) cls.payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, + payment_plan=payment_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_XLSX, status=PaymentVerificationPlan.STATUS_ACTIVE, ) diff --git a/tests/unit/apps/payment/test_finish_verification_plan.py b/tests/unit/apps/payment/test_finish_verification_plan.py index 1b236d160b..047436a74b 100644 --- a/tests/unit/apps/payment/test_finish_verification_plan.py +++ b/tests/unit/apps/payment/test_finish_verification_plan.py @@ -13,10 +13,11 @@ from hct_mis_api.apps.household.fixtures import EntitlementCardFactory, create_household from hct_mis_api.apps.household.models import Household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan from hct_mis_api.apps.payment.services.verification_plan_status_change_services import ( @@ -24,10 +25,6 @@ ) from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) class TestFinishVerificationPlan(TestCase): @@ -46,23 +43,16 @@ def setUpTestData(cls) -> None: cls.program = ProgramFactory(business_area=business_area) cls.program.admin_areas.set(afghanistan_areas_qs.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=user, - targeting_criteria=targeting_criteria, - business_area=business_area, - program=cls.program, - ) - cash_plan = CashPlanFactory( - program=cls.program, + payment_plan = PaymentPlanFactory( + program_cycle=cls.program.cycles.first(), business_area=business_area, ) - cash_plan.save() - cash_plan_payment_verification = PaymentVerificationPlanFactory( + PaymentVerificationSummaryFactory(payment_plan=payment_plan) + payment_plan_payment_verification = PaymentVerificationPlanFactory( status=PaymentVerificationPlan.STATUS_PENDING, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_RAPIDPRO, - payment_plan_obj=cash_plan, + payment_plan=payment_plan, ) for i in range(payment_record_amount): registration_data_import = RegistrationDataImportFactory( @@ -83,22 +73,21 @@ def setUpTestData(cls) -> None: household.program = cls.program household.refresh_from_db() - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, delivered_quantity_usd=200, currency="PLN", ) PaymentVerificationFactory( - payment_verification_plan=cash_plan_payment_verification, - payment_obj=payment_record, + payment_verification_plan=payment_plan_payment_verification, + payment=payment, status=PaymentVerification.STATUS_RECEIVED_WITH_ISSUES, ) EntitlementCardFactory(household=household) - cls.verification = cash_plan.get_payment_verification_plans.first() + cls.verification = payment_plan.payment_verification_plans.first() @mock.patch("hct_mis_api.apps.utils.celery_tasks.requests.post") @override_settings(EMAIL_SUBJECT_PREFIX="test") diff --git a/tests/unit/apps/payment/test_fixtures.py b/tests/unit/apps/payment/test_fixtures.py index 409d44a2b6..61f7dd01da 100644 --- a/tests/unit/apps/payment/test_fixtures.py +++ b/tests/unit/apps/payment/test_fixtures.py @@ -7,7 +7,6 @@ from hct_mis_api.apps.payment.fixtures import ( generate_delivery_mechanisms, generate_payment_plan, - generate_real_cash_plans, generate_reconciled_payment_plan, update_fsps, ) @@ -29,6 +28,5 @@ def test_fixtures_functions(self) -> None: HouseholdFactory() generate_delivery_mechanisms() generate_payment_plan() - generate_real_cash_plans() generate_reconciled_payment_plan() update_fsps() diff --git a/tests/unit/apps/payment/test_fsp_in_payment_plan.py b/tests/unit/apps/payment/test_fsp_in_payment_plan.py index 1bc23261b2..b7255b85c7 100644 --- a/tests/unit/apps/payment/test_fsp_in_payment_plan.py +++ b/tests/unit/apps/payment/test_fsp_in_payment_plan.py @@ -119,7 +119,7 @@ def payment_plan_setup(cls: Any) -> None: total_households_count=4, target_population=target_population, status=PaymentPlan.Status.LOCKED, - program=cls.program, + program_cycle=cls.program.cycles.first(), ) cls.encoded_payment_plan_id = encode_id_base64(cls.payment_plan.id, "PaymentPlan") @@ -251,7 +251,7 @@ def setUpTestData(cls) -> None: def test_choosing_delivery_mechanism_order(self) -> None: payment_plan = PaymentPlanFactory( - total_households_count=1, status=PaymentPlan.Status.LOCKED, program=self.program + total_households_count=1, status=PaymentPlan.Status.LOCKED, program_cycle=self.program.cycles.first() ) encoded_payment_plan_id = encode_id_base64(payment_plan.id, "PaymentPlan") choose_dms_mutation_variables_mutation_variables_without_delivery_mechanisms = dict( @@ -320,7 +320,7 @@ def test_error_when_choosing_delivery_mechanism_with_usdc_currency(self) -> None payment_plan = PaymentPlanFactory( total_households_count=1, status=PaymentPlan.Status.LOCKED, - program=self.program, + program_cycle=self.program.cycles.first(), currency=USDC, ) assert payment_plan.currency == USDC @@ -365,7 +365,7 @@ def test_being_able_to_get_possible_delivery_mechanisms(self) -> None: def test_providing_non_unique_delivery_mechanisms(self) -> None: payment_plan = PaymentPlanFactory( - total_households_count=1, status=PaymentPlan.Status.LOCKED, program=self.program + total_households_count=1, status=PaymentPlan.Status.LOCKED, program_cycle=self.program.cycles.first() ) encoded_payment_plan_id = encode_id_base64(payment_plan.id, "PaymentPlan") choose_dms_mutation_variables_mutation_variables = dict( @@ -1116,7 +1116,9 @@ def test_fsp_cannot_accept_any_volume(self) -> None: # FSP with limit is used in other conflicting PP self.bank_of_america_fsp.distribution_limit = 1000 self.bank_of_america_fsp.save() - new_payment_plan = PaymentPlanFactory(status=PaymentPlan.Status.LOCKED_FSP, program=self.program) + new_payment_plan = PaymentPlanFactory( + status=PaymentPlan.Status.LOCKED_FSP, program_cycle=self.program.cycles.first() + ) DeliveryMechanismPerPaymentPlanFactory( payment_plan=new_payment_plan, delivery_mechanism=self.dm_voucher, diff --git a/tests/unit/apps/payment/test_fsp_xlsx_template_get_column_value.py b/tests/unit/apps/payment/test_fsp_xlsx_template_get_column_value.py index 2ad2a44c70..c5ad868861 100644 --- a/tests/unit/apps/payment/test_fsp_xlsx_template_get_column_value.py +++ b/tests/unit/apps/payment/test_fsp_xlsx_template_get_column_value.py @@ -34,7 +34,9 @@ def test_get_column_value_registration_token_empty(self) -> None: household, individuals = create_household(household_args={"size": 1, "business_area": self.business_area}) individual = individuals[0] payment_plan = PaymentPlanFactory( - program=self.program, status=PaymentPlan.Status.ACCEPTED, business_area=self.business_area + program_cycle=self.program.cycles.first(), + status=PaymentPlan.Status.ACCEPTED, + business_area=self.business_area, ) payment = PaymentFactory(parent=payment_plan, household=household, collector=individual, currency="PLN") create_payment_plan_snapshot_data(payment_plan) @@ -62,7 +64,9 @@ def test_get_column_value_from_payment(self, _: Any, field_name: str) -> None: individual = individuals[0] payment_plan = PaymentPlanFactory( - program=self.program, status=PaymentPlan.Status.ACCEPTED, business_area=self.business_area + program_cycle=self.program.cycles.first(), + status=PaymentPlan.Status.ACCEPTED, + business_area=self.business_area, ) payment = PaymentFactory(parent=payment_plan, household=household, collector=individual, currency="PLN") primary = IndividualRoleInHousehold.objects.filter(role=ROLE_PRIMARY).first().individual diff --git a/tests/unit/apps/payment/test_import_export_payment_plan_payment_list.py b/tests/unit/apps/payment/test_import_export_payment_plan_payment_list.py index 79beaa3754..71ec4e770a 100644 --- a/tests/unit/apps/payment/test_import_export_payment_plan_payment_list.py +++ b/tests/unit/apps/payment/test_import_export_payment_plan_payment_list.py @@ -45,7 +45,6 @@ PaymentFactory, PaymentPlanFactory, RealProgramFactory, - ServiceProviderFactory, generate_delivery_mechanisms, ) from hct_mis_api.apps.payment.models import ( @@ -56,7 +55,6 @@ PaymentHouseholdSnapshot, PaymentPlan, PaymentPlanSplit, - ServiceProvider, ) from hct_mis_api.apps.payment.services.payment_household_snapshot_service import ( create_payment_plan_snapshot_data, @@ -101,13 +99,13 @@ def setUpTestData(cls) -> None: {"size": n, "address": "Lorem Ipsum", "country_origin": country_origin, "village": "TEST_VILLAGE"}, ) - if ServiceProvider.objects.count() < 3: - ServiceProviderFactory.create_batch(3) + if FinancialServiceProvider.objects.count() < 3: + FinancialServiceProviderFactory.create_batch(3) program = RealProgramFactory() cls.dm_cash = DeliveryMechanism.objects.get(code="cash") cls.dm_transfer = DeliveryMechanism.objects.get(code="transfer") cls.dm_atm_card = DeliveryMechanism.objects.get(code="atm_card") - cls.payment_plan = PaymentPlanFactory(program=program, business_area=cls.business_area) + cls.payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=cls.business_area) cls.fsp_1 = FinancialServiceProviderFactory( name="Test FSP 1", communication_channel=FinancialServiceProvider.COMMUNICATION_CHANNEL_XLSX, @@ -501,7 +499,7 @@ def test_export_payment_plan_per_fsp_with_people_program(self) -> None: # create Program for People export program_sw = ProgramFactory(data_collecting_type__type=DataCollectingType.Type.SOCIAL) - self.payment_plan.program = program_sw + self.payment_plan.program_cycle = program_sw.cycles.first() self.payment_plan.save() export_service = XlsxPaymentPlanExportPerFspService(self.payment_plan) diff --git a/tests/unit/apps/payment/test_import_verifications.py b/tests/unit/apps/payment/test_import_verifications.py index 720d69a057..ee25f088bf 100644 --- a/tests/unit/apps/payment/test_import_verifications.py +++ b/tests/unit/apps/payment/test_import_verifications.py @@ -23,10 +23,11 @@ create_household, ) from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification from hct_mis_api.apps.payment.xlsx.xlsx_verification_export_service import ( @@ -37,32 +38,24 @@ ) from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) class TestXlsxVerificationImport(APITestCase): def setUp(self) -> None: super().setUp() create_afghanistan() - payment_record_amount = 10 + payments_amount = 10 self.business_area = BusinessArea.objects.get(slug="afghanistan") self.user = UserFactory() program = ProgramFactory(business_area=self.business_area) program.admin_areas.set(Area.objects.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=self.user, targeting_criteria=targeting_criteria, business_area=self.business_area - ) - cash_plan = CashPlanFactory(program=program, business_area=self.business_area) - cash_plan.save() - payment_verification_plan = PaymentVerificationPlanFactory(payment_plan_obj=cash_plan) - for _ in range(payment_record_amount): + payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=self.business_area) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) + payment_verification_plan = PaymentVerificationPlanFactory(payment_plan=payment_plan) + for _ in range(payments_amount): registration_data_import = RegistrationDataImportFactory( imported_by=self.user, business_area=BusinessArea.objects.first() ) @@ -76,22 +69,21 @@ def setUp(self) -> None: household.programs.add(program) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, currency="PLN", ) PaymentVerificationFactory( - payment_obj=payment_record, + payment=payment, payment_verification_plan=payment_verification_plan, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=household) - self.cash_plan = cash_plan - self.verification = cash_plan.payment_verification_plan.first() + self.payment_plan = payment_plan + self.verification = payment_plan.payment_verification_plans.first() @parameterized.expand( [ @@ -123,7 +115,7 @@ def test_validation_valid_not_changed_file(self) -> None: self.assertEqual(import_service.errors, []) def test_validation_valid_status_changed_for_people(self) -> None: - dct = self.verification.payment_plan_obj.program.data_collecting_type + dct = self.verification.payment_plan.program_cycle.program.data_collecting_type dct.type = DataCollectingType.Type.SOCIAL dct.save() export_service = XlsxVerificationExportService(self.verification) @@ -277,7 +269,7 @@ def test_import_valid_status_changed_received_no(self) -> None: export_service = XlsxVerificationExportService(self.verification) wb = export_service.generate_workbook() payment_record_id = wb.active["A2"].value - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual(payment_verification.status, PaymentVerification.STATUS_PENDING) wb.active[f"{XlsxVerificationExportService.RECEIVED_COLUMN_LETTER}2"] = "NO" with NamedTemporaryFile() as tmp: @@ -289,18 +281,18 @@ def test_import_valid_status_changed_received_no(self) -> None: import_service.import_verifications() self.assertEqual(import_service.errors, []) - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual(payment_verification.status, PaymentVerification.STATUS_NOT_RECEIVED) def test_import_valid_status_changed_received_yes_not_full(self) -> None: export_service = XlsxVerificationExportService(self.verification) wb = export_service.generate_workbook() payment_record_id = wb.active["A2"].value - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual(payment_verification.status, PaymentVerification.STATUS_PENDING) wb.active[f"{XlsxVerificationExportService.RECEIVED_COLUMN_LETTER}2"] = "YES" wb.active[f"{XlsxVerificationExportService.RECEIVED_AMOUNT_COLUMN_LETTER}2"] = ( - payment_verification.payment_obj.delivered_quantity - 1 + payment_verification.payment.delivered_quantity - 1 ) with NamedTemporaryFile() as tmp: wb.save(tmp.name) @@ -311,26 +303,26 @@ def test_import_valid_status_changed_received_yes_not_full(self) -> None: import_service.import_verifications() self.assertEqual(import_service.errors, []) - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual( payment_verification.status, PaymentVerification.STATUS_RECEIVED_WITH_ISSUES, ) self.assertEqual( payment_verification.received_amount, - payment_verification.payment_obj.delivered_quantity - 1, + payment_verification.payment.delivered_quantity - 1, ) def test_import_valid_status_changed_received_yes_full(self) -> None: export_service = XlsxVerificationExportService(self.verification) wb = export_service.generate_workbook() payment_record_id = wb.active["A2"].value - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual(payment_verification.status, PaymentVerification.STATUS_PENDING) wb.active[f"{XlsxVerificationExportService.RECEIVED_COLUMN_LETTER}2"] = "YES" wb.active[ f"{XlsxVerificationExportService.RECEIVED_AMOUNT_COLUMN_LETTER}2" - ] = payment_verification.payment_obj.delivered_quantity + ] = payment_verification.payment.delivered_quantity with NamedTemporaryFile() as tmp: wb.save(tmp.name) file = io.BytesIO(tmp.read()) @@ -340,14 +332,14 @@ def test_import_valid_status_changed_received_yes_full(self) -> None: import_service.import_verifications() self.assertEqual(import_service.errors, []) - payment_verification = PaymentVerification.objects.get(payment_object_id=payment_record_id) + payment_verification = PaymentVerification.objects.get(payment_id=payment_record_id) self.assertEqual( payment_verification.status, PaymentVerification.STATUS_RECEIVED, ) self.assertEqual( payment_verification.received_amount, - payment_verification.payment_obj.delivered_quantity, + payment_verification.payment.delivered_quantity, ) @parameterized.expand( @@ -368,13 +360,13 @@ def test_validation_of_unordered_columns(self, file_name: str, error_list: List, 3rd scenario - like above + one null header """ - cash_plan = CashPlanFactory() + payment_plan = PaymentPlanFactory() hoh1 = IndividualFactory(household=None) household_1 = HouseholdFactory(head_of_household=hoh1) - payment_1 = PaymentRecordFactory( + payment_1 = PaymentFactory( id="0329a41f-affd-4669-9e38-38ec2d6699b3", - parent=cash_plan, + parent=payment_plan, household=household_1, entitlement_quantity=120, delivered_quantity=150, @@ -383,24 +375,24 @@ def test_validation_of_unordered_columns(self, file_name: str, error_list: List, hoh2 = IndividualFactory(household=None) household_2 = HouseholdFactory(head_of_household=hoh2) - payment_2 = PaymentRecordFactory( + payment_2 = PaymentFactory( id="299811ef-b123-427d-b77d-9fd5d1bc8946", - parent=cash_plan, + parent=payment_plan, household=household_2, entitlement_quantity=120, delivered_quantity=150, currency="PLN", ) - - payment_verification_plan = PaymentVerificationPlanFactory(payment_plan_obj=cash_plan) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) + payment_verification_plan = PaymentVerificationPlanFactory(payment_plan=payment_plan) PaymentVerificationFactory( - payment_obj=payment_1, + payment=payment_1, payment_verification_plan=payment_verification_plan, status=PaymentVerification.STATUS_PENDING, ) PaymentVerificationFactory( - payment_obj=payment_2, + payment=payment_2, payment_verification_plan=payment_verification_plan, status=PaymentVerification.STATUS_PENDING, ) diff --git a/tests/unit/apps/payment/test_invalid_xlsx_verification_mutation.py b/tests/unit/apps/payment/test_invalid_xlsx_verification_mutation.py index fe80113c58..c74dd0184c 100644 --- a/tests/unit/apps/payment/test_invalid_xlsx_verification_mutation.py +++ b/tests/unit/apps/payment/test_invalid_xlsx_verification_mutation.py @@ -15,8 +15,9 @@ from hct_mis_api.apps.core.models import BusinessArea, FileTemp from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, + PaymentPlanFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerificationPlan from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -53,10 +54,10 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=cls.business_area) program.admin_areas.set(Area.objects.order_by("?")[:3]) - cash_plan = CashPlanFactory(program=program, business_area=cls.business_area) - cash_plan.save() + payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=cls.business_area) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) cls.payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, + payment_plan=payment_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_XLSX, status=PaymentVerificationPlan.STATUS_ACTIVE, ) diff --git a/tests/unit/apps/payment/test_models.py b/tests/unit/apps/payment/test_models.py index d31c75a364..592bb2aabf 100644 --- a/tests/unit/apps/payment/test_models.py +++ b/tests/unit/apps/payment/test_models.py @@ -228,13 +228,12 @@ def test_can_be_locked(self) -> None: program = RealProgramFactory() program_cycle = program.cycles.first() - pp1 = PaymentPlanFactory(program=program, program_cycle=program_cycle) + pp1 = PaymentPlanFactory(program_cycle=program_cycle) self.assertEqual(pp1.can_be_locked, False) # create hard conflicted payment pp1_conflicted = PaymentPlanFactory( status=PaymentPlan.Status.LOCKED, - program=program, program_cycle=program_cycle, ) p1 = PaymentFactory(parent=pp1, conflicted=False, currency="PLN") @@ -311,23 +310,20 @@ def test_manager_annotations_pp_conflicts(self) -> None: program = RealProgramFactory() program_cycle = program.cycles.first() - pp1 = PaymentPlanFactory(program=program, program_cycle=program_cycle) + pp1 = PaymentPlanFactory(program_cycle=program_cycle) # create hard conflicted payment pp2 = PaymentPlanFactory( status=PaymentPlan.Status.LOCKED, - program=program, program_cycle=program_cycle, ) # create soft conflicted payments pp3 = PaymentPlanFactory( status=PaymentPlan.Status.OPEN, - program=program, program_cycle=program_cycle, ) pp4 = PaymentPlanFactory( status=PaymentPlan.Status.OPEN, - program=program, program_cycle=program_cycle, ) p1 = PaymentFactory(parent=pp1, conflicted=False, currency="PLN") diff --git a/tests/unit/apps/payment/test_payment_gateway_service.py b/tests/unit/apps/payment/test_payment_gateway_service.py index 6274e3d798..539dd957c9 100644 --- a/tests/unit/apps/payment/test_payment_gateway_service.py +++ b/tests/unit/apps/payment/test_payment_gateway_service.py @@ -3,10 +3,7 @@ from typing import Any from unittest import mock -from django.utils import timezone - import pytest -from pytz import utc from hct_mis_api.apps.account.fixtures import UserFactory from hct_mis_api.apps.core.base_test_case import APITestCase @@ -73,8 +70,6 @@ def setUpTestData(cls) -> None: cls.user = UserFactory.create() cls.pp = PaymentPlanFactory( - program__cycle__start_date=timezone.datetime(2021, 6, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2021, 7, 10, tzinfo=utc).date(), status=PaymentPlan.Status.ACCEPTED, ) cls.pg_fsp = FinancialServiceProviderFactory( diff --git a/tests/unit/apps/payment/test_payment_notification.py b/tests/unit/apps/payment/test_payment_notification.py index 13dace4291..9be890b5bb 100644 --- a/tests/unit/apps/payment/test_payment_notification.py +++ b/tests/unit/apps/payment/test_payment_notification.py @@ -33,7 +33,9 @@ def setUpTestData(cls) -> None: cls.program = ProgramFactory.create(business_area=cls.business_area) cls.program2 = ProgramFactory.create(business_area=cls.business_area) cls.payment_plan = PaymentPlanFactory.create( - business_area=cls.business_area, created_by=cls.user_payment_plan_creator, program=cls.program + business_area=cls.business_area, + created_by=cls.user_payment_plan_creator, + program_cycle=cls.program.cycles.first(), ) cls.approval_process = ApprovalProcessFactory.create( diff --git a/tests/unit/apps/payment/test_payment_plan_pdf_export_service.py b/tests/unit/apps/payment/test_payment_plan_pdf_export_service.py index b8881c9c79..881d230370 100644 --- a/tests/unit/apps/payment/test_payment_plan_pdf_export_service.py +++ b/tests/unit/apps/payment/test_payment_plan_pdf_export_service.py @@ -25,8 +25,9 @@ def setUp(self) -> None: generate_delivery_mechanisms() create_afghanistan() self.dm_cash = DeliveryMechanism.objects.get(code="cash") + program = ProgramFactory(data_collecting_type__type=DataCollectingType.Type.STANDARD) self.payment_plan = PaymentPlanFactory( - program=ProgramFactory(data_collecting_type__type=DataCollectingType.Type.STANDARD) + program_cycle=program.cycles.first(), ) self.payment_plan.unicef_id = "PP-0060-24-00000007" self.payment_plan.save() diff --git a/tests/unit/apps/payment/test_payment_plan_reconciliation.py b/tests/unit/apps/payment/test_payment_plan_reconciliation.py index fefd0f7479..8e76bee858 100644 --- a/tests/unit/apps/payment/test_payment_plan_reconciliation.py +++ b/tests/unit/apps/payment/test_payment_plan_reconciliation.py @@ -897,9 +897,11 @@ def test_receiving_payment_reconciliations_status( def test_xlsx_payment_plan_import_per_fsp_service_import_row(self) -> None: pp = PaymentPlanFactory(status=PaymentPlan.Status.FINISHED) pp.refresh_from_db() - PaymentVerificationSummaryFactory(payment_plan_obj=pp) + pvs = PaymentVerificationSummaryFactory() + pvs.payment_plan = pp + pvs.save() pvp = PaymentVerificationPlanFactory( - payment_plan_obj=pp, + payment_plan=pp, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL, status=PaymentVerificationPlan.STATUS_ACTIVE, ) @@ -945,19 +947,19 @@ def test_xlsx_payment_plan_import_per_fsp_service_import_row(self) -> None: ) verification_1 = PaymentVerificationFactory( payment_verification_plan=pvp, - payment_obj=payment_1, + payment=payment_1, status=PaymentVerification.STATUS_RECEIVED_WITH_ISSUES, received_amount=999, ) verification_2 = PaymentVerificationFactory( payment_verification_plan=pvp, - payment_obj=payment_2, + payment=payment_2, status=PaymentVerification.STATUS_RECEIVED, received_amount=500, ) verification_3 = PaymentVerificationFactory( payment_verification_plan=pvp, - payment_obj=payment_3, + payment=payment_3, status=PaymentVerification.STATUS_PENDING, received_amount=None, ) diff --git a/tests/unit/apps/payment/test_payment_plan_services.py b/tests/unit/apps/payment/test_payment_plan_services.py index 88c8fe2e10..657d045333 100644 --- a/tests/unit/apps/payment/test_payment_plan_services.py +++ b/tests/unit/apps/payment/test_payment_plan_services.py @@ -62,7 +62,8 @@ def setUpTestData(cls) -> None: cls.dm_transfer_to_account = DeliveryMechanism.objects.get(code="transfer_to_account") def test_delete_open(self) -> None: - pp: PaymentPlan = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program__status=Program.ACTIVE) + program = ProgramFactory(status=Program.ACTIVE) + pp: PaymentPlan = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program_cycle=program.cycles.first()) self.assertEqual(pp.target_population.status, TargetPopulation.STATUS_OPEN) pp = PaymentPlanService(payment_plan=pp).delete() @@ -77,7 +78,8 @@ def test_delete_locked(self) -> None: PaymentPlanService(payment_plan=pp).delete() def test_delete_when_its_one_pp_in_cycle(self) -> None: - pp = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program__status=Program.ACTIVE) + program = ProgramFactory(status=Program.ACTIVE) + pp: PaymentPlan = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program_cycle=program.cycles.first()) program_cycle = ProgramCycleFactory(status=ProgramCycle.ACTIVE, program=pp.program) pp.program_cycle = program_cycle pp.save() @@ -91,14 +93,10 @@ def test_delete_when_its_one_pp_in_cycle(self) -> None: self.assertEqual(program_cycle.status, ProgramCycle.DRAFT) def test_delete_when_its_two_pp_in_cycle(self) -> None: - pp_1 = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program__status=Program.ACTIVE) - pp_2 = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program=pp_1.program) - program_cycle = ProgramCycleFactory(status=ProgramCycle.ACTIVE, program=pp_1.program) - pp_1.program_cycle = program_cycle - pp_1.save() - pp_1.refresh_from_db() - pp_2.program_cycle = program_cycle - pp_2.save() + program = ProgramFactory(status=Program.ACTIVE) + program_cycle = ProgramCycleFactory(status=ProgramCycle.ACTIVE, program=program) + pp_1: PaymentPlan = PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program_cycle=program_cycle) + PaymentPlanFactory(status=PaymentPlan.Status.OPEN, program_cycle=program_cycle) self.assertEqual(pp_1.program_cycle.status, ProgramCycle.ACTIVE) @@ -195,7 +193,7 @@ def test_create(self, get_exchange_rate_mock: Any) -> None: self.assertEqual(pp.total_households_count, 0) self.assertEqual(pp.total_individuals_count, 0) self.assertEqual(pp.payment_items.count(), 0) - with self.assertNumQueries(68): + with self.assertNumQueries(69): prepare_payment_plan_task.delay(pp.id) pp.refresh_from_db() self.assertEqual(pp.status, PaymentPlan.Status.OPEN) @@ -293,8 +291,6 @@ def test_update(self, get_exchange_rate_mock: Any) -> None: def test_create_follow_up_pp(self, get_exchange_rate_mock: Any) -> None: pp = PaymentPlanFactory( total_households_count=1, - program__cycle__start_date=timezone.datetime(2021, 6, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2021, 7, 10, tzinfo=utc).date(), ) new_targeting = TargetPopulationFactory( status=TargetPopulation.STATUS_READY_FOR_PAYMENT_MODULE, @@ -398,7 +394,7 @@ def test_create_follow_up_pp(self, get_exchange_rate_mock: Any) -> None: self.assertEqual(pp.follow_ups.count(), 2) - with self.assertNumQueries(48): + with self.assertNumQueries(49): prepare_follow_up_payment_plan_task(follow_up_pp_2.id) self.assertEqual(follow_up_pp_2.payment_items.count(), 1) @@ -414,10 +410,7 @@ def test_create_follow_up_pp(self, get_exchange_rate_mock: Any) -> None: def test_split(self, min_no_of_payments_in_chunk_mock: Any, get_exchange_rate_mock: Any) -> None: min_no_of_payments_in_chunk_mock.__get__ = mock.Mock(return_value=2) - pp = PaymentPlanFactory( - program__cycle__start_date=timezone.datetime(2021, 6, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2021, 7, 10, tzinfo=utc).date(), - ) + pp = PaymentPlanFactory() with self.assertRaisesMessage(GraphQLError, "No payments to split"): PaymentPlanService(pp).split(PaymentPlanSplit.SplitType.BY_COLLECTOR) @@ -523,8 +516,6 @@ def test_split(self, min_no_of_payments_in_chunk_mock: Any, get_exchange_rate_mo @mock.patch("hct_mis_api.apps.payment.models.PaymentPlan.get_exchange_rate", return_value=2.0) def test_send_to_payment_gateway(self, get_exchange_rate_mock: Any) -> None: pp = PaymentPlanFactory( - program__cycle__start_date=timezone.datetime(2021, 6, 10, tzinfo=utc).date(), - program__cycle__end_date=timezone.datetime(2021, 7, 10, tzinfo=utc).date(), status=PaymentPlan.Status.ACCEPTED, ) pp.background_action_status_send_to_payment_gateway() diff --git a/tests/unit/apps/payment/test_payment_plan_views.py b/tests/unit/apps/payment/test_payment_plan_views.py index 44651dd9ec..ff080e6512 100644 --- a/tests/unit/apps/payment/test_payment_plan_views.py +++ b/tests/unit/apps/payment/test_payment_plan_views.py @@ -38,17 +38,17 @@ def set_up(self, api_client: Callable, afghanistan: BusinessAreaFactory, id_to_b self.program1 = ProgramFactory(business_area=self.afghanistan) self.program2 = ProgramFactory(business_area=self.afghanistan) self.payment_plan1 = PaymentPlanFactory( - program=self.program1, + program_cycle=self.program1.cycles.first(), business_area=self.afghanistan, status=PaymentPlan.Status.IN_APPROVAL, ) self.payment_plan2 = PaymentPlanFactory( - program=self.program2, + program_cycle=self.program2.cycles.first(), business_area=self.afghanistan, status=PaymentPlan.Status.IN_APPROVAL, ) self.payment_plan3 = PaymentPlanFactory( - program=self.program2, + program_cycle=self.program2.cycles.first(), business_area=self.afghanistan, status=PaymentPlan.Status.OPEN, ) @@ -133,7 +133,7 @@ def _test_list() -> Any: etag = response.headers["etag"] assert json.loads(cache.get(etag)[0].decode("utf8")) == response.json() - assert len(ctx.captured_queries) == 26 + assert len(ctx.captured_queries) == 28 # Test that reoccurring request use cached data with CaptureQueriesContext(connection) as ctx: diff --git a/tests/unit/apps/payment/test_payment_token_and_order_numbers.py b/tests/unit/apps/payment/test_payment_token_and_order_numbers.py index 0176c54cfe..040ff8f76e 100644 --- a/tests/unit/apps/payment/test_payment_token_and_order_numbers.py +++ b/tests/unit/apps/payment/test_payment_token_and_order_numbers.py @@ -30,7 +30,7 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=business_area) cls.payment_plan = PaymentPlanFactory( - program=program, status=PaymentPlan.Status.ACCEPTED, business_area=business_area + program_cycle=program.cycles.first(), status=PaymentPlan.Status.ACCEPTED, business_area=business_area ) program.households.set(Household.objects.all().values_list("id", flat=True)) for household in program.households.all(): diff --git a/tests/unit/apps/payment/test_payment_verification_mutations.py b/tests/unit/apps/payment/test_payment_verification_mutations.py index a7b61fceef..2a192e5654 100644 --- a/tests/unit/apps/payment/test_payment_verification_mutations.py +++ b/tests/unit/apps/payment/test_payment_verification_mutations.py @@ -18,10 +18,8 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.fixtures import EntitlementCardFactory, create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, PaymentVerificationSummaryFactory, @@ -37,10 +35,6 @@ ) from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) EDIT_PAYMENT_VERIFICATION_MUTATION = """ mutation EditPaymentVerificationPlan($input: EditPaymentVerificationInput!) { @@ -67,15 +61,11 @@ def setUpTestData(cls) -> None: ) program = ProgramFactory(business_area=cls.business_area) program.admin_areas.set(Area.objects.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=cls.user, targeting_criteria=targeting_criteria, business_area=cls.business_area - ) - cash_plan = CashPlanFactory(program=program, business_area=cls.business_area) - cash_plan.save() + payment_plan = PaymentPlanFactory(program_cycle=program.cycles.first(), business_area=cls.business_area) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=cash_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL + payment_plan=payment_plan, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL ) registration_data_import = RegistrationDataImportFactory( imported_by=cls.user, business_area=BusinessArea.objects.first() @@ -90,24 +80,23 @@ def setUpTestData(cls) -> None: household.programs.add(program) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, - entitlement_quantity="21.36", - delivered_quantity="21.36", + entitlement_quantity=21.36, + delivered_quantity=21.36, currency="PLN", ) PaymentVerificationFactory( - payment_obj=payment_record, + payment=payment, payment_verification_plan=payment_verification_plan, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=household) - cls.cash_plan = cash_plan - cls.verification = cash_plan.payment_verification_plan.first() + cls.payment_plan = payment_plan + cls.verification = payment_plan.payment_verification_plans.first() VerificationPlanStatusChangeServices(payment_verification_plan).activate() info = ResolveInfo(None, None, None, None, None, None, None, None, None, None) request = RequestFactory().get("/api/graphql") @@ -230,10 +219,10 @@ def test_permissions(self) -> None: def test_edit_payment_verification_plan_mutation(self) -> None: payment_plan = PaymentPlanFactory(status=PaymentPlan.Status.FINISHED, business_area=self.business_area) - PaymentVerificationSummaryFactory(payment_plan_obj=payment_plan) + PaymentVerificationSummaryFactory(payment_plan=payment_plan) PaymentFactory(parent=payment_plan, currency="PLN", status=GenericPayment.STATUS_SUCCESS) payment_verification_plan = PaymentVerificationPlanFactory( - payment_plan_obj=payment_plan, + payment_plan=payment_plan, status=PaymentVerificationPlan.STATUS_PENDING, ) input_dict = { diff --git a/tests/unit/apps/payment/test_rapid_pro_verification_task.py b/tests/unit/apps/payment/test_rapid_pro_verification_task.py index e4a9520459..2de7fef9d9 100644 --- a/tests/unit/apps/payment/test_rapid_pro_verification_task.py +++ b/tests/unit/apps/payment/test_rapid_pro_verification_task.py @@ -12,10 +12,11 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.fixtures import EntitlementCardFactory, create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan from hct_mis_api.apps.payment.tasks.CheckRapidProVerificationTask import ( @@ -23,10 +24,6 @@ ) from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) from hct_mis_api.apps.utils.phone import is_valid_phone_number @@ -86,22 +83,16 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=BusinessArea.objects.first()) program.admin_areas.set(Area.objects.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=user, - targeting_criteria=targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - cash_plan = CashPlanFactory( - program=program, + payment_plan = PaymentPlanFactory( + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), ) - cash_plan.save() + PaymentVerificationSummaryFactory(payment_plan=payment_plan) payment_verification_plan = PaymentVerificationPlanFactory( status=PaymentVerificationPlan.STATUS_ACTIVE, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_RAPIDPRO, - payment_plan_obj=cash_plan, + payment_plan=payment_plan, ) cls.individuals = [] for _ in range(payment_record_amount): @@ -119,23 +110,22 @@ def setUpTestData(cls) -> None: household.programs.add(program) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, delivered_quantity_usd=200, currency="PLN", ) PaymentVerificationFactory( payment_verification_plan=payment_verification_plan, - payment_obj=payment_record, + payment=payment, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=household) - cls.cash_plan = cash_plan - cls.verification = cash_plan.get_payment_verification_plans.first() + cls.payment_plan = payment_plan + cls.verification = payment_plan.payment_verification_plans.first() @patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.__init__") def test_filtering_by_start_id(self, mock_parent_init: Any) -> None: @@ -143,7 +133,7 @@ def test_filtering_by_start_id(self, mock_parent_init: Any) -> None: payment_record_verification_obj = TestRapidProVerificationTask.verification.payment_record_verifications.first() TestRapidProVerificationTask.ORIGINAL_RAPIDPRO_RUNS_RESPONSE[0]["contact"][ "urn" - ] = f"tel:{payment_record_verification_obj.payment_obj.head_of_household.phone_no}" + ] = f"tel:{payment_record_verification_obj.payment.head_of_household.phone_no}" mock = MagicMock(return_value=TestRapidProVerificationTask.ORIGINAL_RAPIDPRO_RUNS_RESPONSE) with patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.get_flow_runs", mock): api = RapidProAPI("afghanistan", RapidProAPI.MODE_VERIFICATION) @@ -159,7 +149,7 @@ def test_mapping(self, mock_parent_init: Any) -> None: payment_record_verification_obj = TestRapidProVerificationTask.verification.payment_record_verifications.first() TestRapidProVerificationTask.ORIGINAL_RAPIDPRO_RUNS_RESPONSE[0]["contact"][ "urn" - ] = f"tel:{payment_record_verification_obj.payment_obj.head_of_household.phone_no}" + ] = f"tel:{payment_record_verification_obj.payment.head_of_household.phone_no}" mock = MagicMock(return_value=TestRapidProVerificationTask.ORIGINAL_RAPIDPRO_RUNS_RESPONSE) with patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.get_flow_runs", mock): api = RapidProAPI("afghanistan", RapidProAPI.MODE_VERIFICATION) @@ -168,7 +158,7 @@ def test_mapping(self, mock_parent_init: Any) -> None: mapped_dict, [ { - "phone_number": str(payment_record_verification_obj.payment_obj.head_of_household.phone_no), + "phone_number": str(payment_record_verification_obj.payment.head_of_household.phone_no), "received": True, "received_amount": Decimal("200"), } @@ -188,13 +178,13 @@ def test_not_received(self, mock_parent_init: Any) -> None: fake_data_to_return_from_rapid_pro_api = [ { - "phone_number": str(payment_record_verification.payment_obj.head_of_household.phone_no), + "phone_number": str(payment_record_verification.payment.head_of_household.phone_no), "received": False, } ] assert is_valid_phone_number( - payment_record_verification.payment_obj.head_of_household.phone_no - ), payment_record_verification.payment_obj.head_of_household.phone_no + payment_record_verification.payment.head_of_household.phone_no + ), payment_record_verification.payment.head_of_household.phone_no mock = MagicMock(return_value=fake_data_to_return_from_rapid_pro_api) with patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.get_mapped_flow_runs", mock): task = CheckRapidProVerificationTask() @@ -217,13 +207,13 @@ def test_received_with_issues(self, mock_parent_init: Any) -> None: PaymentVerification.STATUS_PENDING, ) assert is_valid_phone_number( - payment_record_verification.payment_obj.head_of_household.phone_no - ), payment_record_verification.payment_obj.head_of_household.phone_no + payment_record_verification.payment.head_of_household.phone_no + ), payment_record_verification.payment.head_of_household.phone_no fake_data_to_return_from_rapid_pro_api = [ { - "phone_number": str(payment_record_verification.payment_obj.head_of_household.phone_no), + "phone_number": str(payment_record_verification.payment.head_of_household.phone_no), "received": True, - "received_amount": payment_record_verification.payment_obj.delivered_quantity - 1, + "received_amount": payment_record_verification.payment.delivered_quantity - 1, } ] mock = MagicMock(return_value=fake_data_to_return_from_rapid_pro_api) @@ -238,7 +228,7 @@ def test_received_with_issues(self, mock_parent_init: Any) -> None: ) self.assertEqual( payment_record_verification.received_amount, - payment_record_verification.payment_obj.delivered_quantity - 1, + payment_record_verification.payment.delivered_quantity - 1, ) @patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.__init__") @@ -253,14 +243,14 @@ def test_received(self, mock_parent_init: Any) -> None: ) fake_data_to_return_from_rapid_pro_api = [ { - "phone_number": str(payment_record_verification.payment_obj.head_of_household.phone_no), + "phone_number": str(payment_record_verification.payment.head_of_household.phone_no), "received": True, - "received_amount": payment_record_verification.payment_obj.delivered_quantity, + "received_amount": payment_record_verification.payment.delivered_quantity, } ] assert is_valid_phone_number( - payment_record_verification.payment_obj.head_of_household.phone_no - ), payment_record_verification.payment_obj.head_of_household.phone_no + payment_record_verification.payment.head_of_household.phone_no + ), payment_record_verification.payment.head_of_household.phone_no mock = MagicMock(return_value=fake_data_to_return_from_rapid_pro_api) with patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.get_mapped_flow_runs", mock): task = CheckRapidProVerificationTask() @@ -273,7 +263,7 @@ def test_received(self, mock_parent_init: Any) -> None: ) self.assertEqual( payment_record_verification.received_amount, - payment_record_verification.payment_obj.delivered_quantity, + payment_record_verification.payment.delivered_quantity, ) @patch("hct_mis_api.apps.core.services.rapid_pro.api.RapidProAPI.__init__") @@ -290,7 +280,7 @@ def test_wrong_phone_number(self, mock_parent_init: Any) -> None: { "phone_number": "123-not-really-a-phone-number", "received": True, - "received_amount": payment_record_verification.payment_obj.delivered_quantity, + "received_amount": payment_record_verification.payment.delivered_quantity, } ] mock = MagicMock(return_value=fake_data_to_return_from_rapid_pro_api) diff --git a/tests/unit/apps/payment/test_sample_size.py b/tests/unit/apps/payment/test_sample_size.py index 3ac4af2cca..25e3fa212e 100644 --- a/tests/unit/apps/payment/test_sample_size.py +++ b/tests/unit/apps/payment/test_sample_size.py @@ -6,14 +6,14 @@ from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.core.utils import encode_id_base64 from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import CashPlanFactory, PaymentRecordFactory -from hct_mis_api.apps.payment.models import PaymentRecord +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory +from hct_mis_api.apps.payment.models import Payment -def create_query_variables(cash_plan: CashPlanFactory, verification_channel: Any) -> Dict: +def create_query_variables(payment_plan: PaymentPlanFactory, verification_channel: Any) -> Dict: return { "input": { - "cashOrPaymentPlanId": encode_id_base64(cash_plan.pk, "CashPlan"), + "cashOrPaymentPlanId": encode_id_base64(payment_plan.pk, "PaymentPlan"), "sampling": "FULL_LIST", "fullListArguments": {"excludedAdminAreas": []}, "verificationChannel": verification_channel, @@ -43,7 +43,7 @@ def setUpTestData(cls) -> None: cls.business_area = BusinessArea.objects.get(slug="afghanistan") cls.household, cls.individuals = create_household(household_args={"size": 2}) - cls.cash_plan = CashPlanFactory() + cls.payment_plan = PaymentPlanFactory() cls.individuals[0].phone_no = "invalid-phone-no" cls.individuals[0].phone_no_alternative = "invalid-phone-no" @@ -54,15 +54,15 @@ def setUpTestData(cls) -> None: cls.individuals[1].save() def test_sample_size_in_manual_verification_plan(self) -> None: - PaymentRecordFactory( - parent=self.cash_plan, + PaymentFactory( + parent=self.payment_plan, business_area=self.business_area, household=self.household, head_of_household_id=self.individuals[0].id, - status=PaymentRecord.STATUS_SUCCESS, + status=Payment.STATUS_SUCCESS, currency="PLN", ) - manual_sample_query_variables = create_query_variables(self.cash_plan, "MANUAL") + manual_sample_query_variables = create_query_variables(self.payment_plan, "MANUAL") manual_response = self.graphql_request( request_string=self.SAMPLE_SIZE_QUERY, variables=manual_sample_query_variables, @@ -70,7 +70,7 @@ def test_sample_size_in_manual_verification_plan(self) -> None: ) self.assertTrue(manual_response["data"]["sampleSize"]["paymentRecordCount"] == 1) - rapid_pro_sample_query_variables = create_query_variables(self.cash_plan, "RAPIDPRO") + rapid_pro_sample_query_variables = create_query_variables(self.payment_plan, "RAPIDPRO") rapid_pro_response = self.graphql_request( request_string=self.SAMPLE_SIZE_QUERY, variables=rapid_pro_sample_query_variables, @@ -79,16 +79,15 @@ def test_sample_size_in_manual_verification_plan(self) -> None: self.assertEqual(rapid_pro_response["data"]["sampleSize"]["paymentRecordCount"], 0) def test_number_of_queries(self) -> None: - PaymentRecordFactory.create_batch( + PaymentFactory.create_batch( 4, - parent=self.cash_plan, + parent=self.payment_plan, business_area=self.business_area, - household=self.household, head_of_household_id=self.individuals[1].id, - status=PaymentRecord.STATUS_SUCCESS, + status=Payment.STATUS_SUCCESS, currency="PLN", ) - rapid_pro_sample_query_variables = create_query_variables(self.cash_plan, "RAPIDPRO") + rapid_pro_sample_query_variables = create_query_variables(self.payment_plan, "RAPIDPRO") # with self.assertNumQueries(4): > sometimes fails on CI with 3 queries instead of 4 # maybe will update later diff --git a/tests/unit/apps/payment/test_verification_plan_status_change_services.py b/tests/unit/apps/payment/test_verification_plan_status_change_services.py index d09375affb..b8aee197bc 100644 --- a/tests/unit/apps/payment/test_verification_plan_status_change_services.py +++ b/tests/unit/apps/payment/test_verification_plan_status_change_services.py @@ -12,10 +12,11 @@ from hct_mis_api.apps.geo.models import Area from hct_mis_api.apps.household.fixtures import EntitlementCardFactory, create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentRecordFactory, + PaymentFactory, + PaymentPlanFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, ) from hct_mis_api.apps.payment.models import PaymentVerification, PaymentVerificationPlan from hct_mis_api.apps.payment.services.verification_plan_status_change_services import ( @@ -23,10 +24,6 @@ ) from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) class TestPhoneNumberVerification(TestCase): @@ -41,22 +38,16 @@ def setUpTestData(cls) -> None: program = ProgramFactory(business_area=BusinessArea.objects.first()) program.admin_areas.set(Area.objects.order_by("?")[:3]) - targeting_criteria = TargetingCriteriaFactory() - target_population = TargetPopulationFactory( - created_by=user, - targeting_criteria=targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - cash_plan = CashPlanFactory( - program=program, + payment_plan = PaymentPlanFactory( + program_cycle=program.cycles.first(), business_area=BusinessArea.objects.first(), ) - cash_plan.save() + PaymentVerificationSummaryFactory(payment_plan=payment_plan) cash_plan_payment_verification = PaymentVerificationPlanFactory( status=PaymentVerificationPlan.STATUS_PENDING, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_RAPIDPRO, - payment_plan_obj=cash_plan, + payment_plan=payment_plan, ) cls.individuals = [] for i in range(cls.payment_record_amount): @@ -78,44 +69,37 @@ def setUpTestData(cls) -> None: household.programs.add(program) - payment_record = PaymentRecordFactory( - parent=cash_plan, + payment = PaymentFactory( + parent=payment_plan, household=household, head_of_household=household.head_of_household, - target_population=target_population, delivered_quantity_usd=200, currency="PLN", ) PaymentVerificationFactory( payment_verification_plan=cash_plan_payment_verification, - payment_obj=payment_record, + payment=payment, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=household) - cls.cash_plan = cash_plan - cls.verification = cash_plan.get_payment_verification_plans.first() + cls.payment_plan = payment_plan + cls.verification = payment_plan.payment_verification_plans.first() ### other_program = ProgramFactory(business_area=BusinessArea.objects.first()) other_program.admin_areas.set(Area.objects.order_by("?")[:3]) - other_targeting_criteria = TargetingCriteriaFactory() - other_target_population = TargetPopulationFactory( - created_by=user, - targeting_criteria=other_targeting_criteria, - business_area=BusinessArea.objects.first(), - ) - other_cash_plan = CashPlanFactory( - program=other_program, + other_payment_plan = PaymentPlanFactory( + program_cycle=other_program.cycles.first(), business_area=BusinessArea.objects.first(), ) - other_cash_plan.save() - other_cash_plan_payment_verification = PaymentVerificationPlanFactory( + PaymentVerificationSummaryFactory(payment_plan=other_payment_plan) + other_payment_plan_payment_verification = PaymentVerificationPlanFactory( status=PaymentVerificationPlan.STATUS_PENDING, verification_channel=PaymentVerificationPlan.VERIFICATION_CHANNEL_RAPIDPRO, - payment_plan_obj=other_cash_plan, + payment_plan=other_payment_plan, ) cls.other_individuals = [] for _ in range(cls.payment_record_amount): @@ -134,23 +118,22 @@ def setUpTestData(cls) -> None: other_household.programs.add(program) - other_payment_record = PaymentRecordFactory( - parent=other_cash_plan, + other_payment_record = PaymentFactory( + parent=other_payment_plan, household=other_household, head_of_household=other_household.head_of_household, - target_population=other_target_population, delivered_quantity_usd=200, currency="PLN", ) PaymentVerificationFactory( - payment_verification_plan=other_cash_plan_payment_verification, + payment_verification_plan=other_payment_plan_payment_verification, payment_obj=other_payment_record, status=PaymentVerification.STATUS_PENDING, ) EntitlementCardFactory(household=other_household) - cls.other_cash_plan = other_cash_plan - cls.other_verification = other_cash_plan.get_payment_verification_plans.first() + cls.other_payment_plan = other_payment_plan + cls.other_verification = other_payment_plan.payment_verification_plans.first() def test_failing_rapid_pro_during_cash_plan_payment_verification(self) -> None: self.assertEqual(self.verification.status, PaymentVerification.STATUS_PENDING) diff --git a/tests/unit/apps/program/test_all_programs_query.py b/tests/unit/apps/program/test_all_programs_query.py index 5b5ce7f041..864c75359e 100644 --- a/tests/unit/apps/program/test_all_programs_query.py +++ b/tests/unit/apps/program/test_all_programs_query.py @@ -224,7 +224,7 @@ def test_all_programs_with_cycles_filter(self) -> None: program = Program.objects.get(name="Program with all partners access") cycle = ProgramCycleFactory(program=program, title="Second CYCLE with total_delivered_quantity_usd") - PaymentPlanFactory(program=program, program_cycle=cycle, total_delivered_quantity_usd=999) + PaymentPlanFactory(program_cycle=cycle, total_delivered_quantity_usd=999) self.snapshot_graphql_request( request_string=self.ALL_PROGRAMS_QUERY_WITH_PROGRAM_CYCLE_FILTERS, diff --git a/tests/unit/apps/program/test_cash_plan_queries.py b/tests/unit/apps/program/test_cash_plan_queries.py deleted file mode 100644 index e5707db832..0000000000 --- a/tests/unit/apps/program/test_cash_plan_queries.py +++ /dev/null @@ -1,132 +0,0 @@ -from typing import List - -from parameterized import parameterized - -from hct_mis_api.apps.account.fixtures import PartnerFactory, UserFactory -from hct_mis_api.apps.account.permissions import Permissions -from hct_mis_api.apps.core.base_test_case import APITestCase -from hct_mis_api.apps.core.fixtures import create_afghanistan -from hct_mis_api.apps.core.models import BusinessArea -from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices -from hct_mis_api.apps.payment.fixtures import CashPlanFactory -from hct_mis_api.apps.program.fixtures import ProgramFactory - -QUERY_SINGLE_CASH_PLAN = """ -query CashPlan($id: ID!) { - cashPlan(id: $id) { - name - dispersionDate - totalPersonsCovered - coverageDuration - coverageUnit - caId - status - assistanceMeasurement - totalEntitledQuantity - totalDeliveredQuantity - totalUndeliveredQuantity - dispersionDate - deliveryType - assistanceThrough - } -} -""" - -QUERY_ALL_CASH_PLANS = """ -query AllCashPlans { - allCashPlans(businessArea: "afghanistan") { - edges { - node { - name - dispersionDate - totalPersonsCovered - coverageDuration - coverageUnit - caId - status - assistanceMeasurement - totalEntitledQuantity - totalDeliveredQuantity - totalUndeliveredQuantity - dispersionDate - deliveryType - assistanceThrough - } - } - } -} -""" - - -class TestCashPlanQueries(APITestCase): - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - create_afghanistan() - cls.partner = PartnerFactory(name="Test1") - cls.user = UserFactory(partner=cls.partner) - cls.business_area = BusinessArea.objects.get(slug="afghanistan") - program = ProgramFactory.create(business_area=cls.business_area) - cls.CASH_PLANS_TO_CREATE = [ - { - "business_area": cls.business_area, - "id": "c7e768f1-5626-413e-a032-5fb18789f985", - "ca_id": "7ff3542c-8c48-4ed4-8283-41966093995b", - "coverage_duration": 21, - "coverage_unit": "Day(s)", - "assistance_measurement": "Syrian pound", - "dispersion_date": "2020-04-25T00:00:00+00:00", - "distribution_level": "Registration Group", - "name": "Far yet reveal area bar almost dinner.", - "total_persons_covered": 540, - "status": "Transaction Completed", - "total_delivered_quantity": 53477453.27, - "total_entitled_quantity": 56657648.82, - "total_undelivered_quantity": 55497021.04, - "delivery_type": DeliveryMechanismChoices.DELIVERY_TYPE_DEPOSIT_TO_CARD, - "assistance_through": "Cairo Amman Bank", - }, - { - "business_area": cls.business_area, - "ca_id": "04b9d44b-67fe-425c-9095-509e31ba7494", - "coverage_duration": 19, - "coverage_unit": "Week(s)", - "assistance_measurement": "Cuban peso", - "dispersion_date": "2020-02-22T00:00:00+00:00", - "distribution_level": "Registration Group", - "name": "Despite action TV after.", - "total_persons_covered": 100, - "status": "Transaction Completed", - "total_delivered_quantity": 41935107.03, - "total_entitled_quantity": 38204833.92, - "total_undelivered_quantity": 63098825.46, - "delivery_type": DeliveryMechanismChoices.DELIVERY_TYPE_DEPOSIT_TO_CARD, - "assistance_through": "Cairo Amman Bank", - }, - ] - - for cash_plan in cls.CASH_PLANS_TO_CREATE: - CashPlanFactory.create( - program=program, - **cash_plan, - ) - - @parameterized.expand( - [ - ("all_with_permission", [Permissions.PAYMENT_VERIFICATION_VIEW_LIST], QUERY_ALL_CASH_PLANS), - ("all_without_permission", [], QUERY_ALL_CASH_PLANS), - ("single_with_permission", [Permissions.PAYMENT_VERIFICATION_VIEW_DETAILS], QUERY_SINGLE_CASH_PLAN), - ("single_without_permission", [], QUERY_SINGLE_CASH_PLAN), - ] - ) - def test_cash_plans(self, name: str, permissions: List[Permissions], query: str) -> None: - self.create_user_role_with_permissions(self.user, permissions, self.business_area) - variables = {} - if "single" in name: - variables["id"] = self.id_to_base64("c7e768f1-5626-413e-a032-5fb18789f985", "CashPlanNode") - - self.snapshot_graphql_request( - request_string=query, - variables=variables, - context={"user": self.user}, - ) diff --git a/tests/unit/apps/program/test_dashboard_queries.py b/tests/unit/apps/program/test_dashboard_queries.py index 603b01aa59..5664db1757 100644 --- a/tests/unit/apps/program/test_dashboard_queries.py +++ b/tests/unit/apps/program/test_dashboard_queries.py @@ -9,10 +9,8 @@ from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, generate_delivery_mechanisms, ) from hct_mis_api.apps.payment.models import DeliveryMechanism @@ -84,17 +82,17 @@ def test_chart_programmes_by_sector(self) -> None: program3 = ProgramFactory.create(cash_plus=False, sector=Program.NUTRITION) program4 = ProgramFactory.create(cash_plus=True, sector=Program.WASH) - cash_plan1 = CashPlanFactory(program=program1) - cash_plan2 = CashPlanFactory(program=program2) + payment_plan1 = PaymentPlanFactory(program_cycle=program1.cycles.first()) + payment_plan2 = PaymentPlanFactory(program_cycle=program2.cycles.first()) delivery_date = timezone.datetime(2021, 10, 10, tzinfo=utc) - PaymentRecordFactory(parent=cash_plan1, delivery_date=delivery_date, household=household, currency="PLN") - PaymentRecordFactory(parent=cash_plan2, delivery_date=delivery_date, household=household, currency="PLN") - - payment_plan1 = PaymentPlanFactory(program=program3) - payment_plan2 = PaymentPlanFactory(program=program4) PaymentFactory(parent=payment_plan1, delivery_date=delivery_date, household=household, currency="PLN") PaymentFactory(parent=payment_plan2, delivery_date=delivery_date, household=household, currency="PLN") + payment_plan3 = PaymentPlanFactory(program_cycle=program3.cycles.first()) + payment_plan4 = PaymentPlanFactory(program_cycle=program4.cycles.first()) + PaymentFactory(parent=payment_plan3, delivery_date=delivery_date, household=household, currency="PLN") + PaymentFactory(parent=payment_plan4, delivery_date=delivery_date, household=household, currency="PLN") + self.snapshot_graphql_request( request_string=QUERY_CHART_PROGRAMMES_BY_SECTOR, variables={"businessAreaSlug": "afghanistan", "year": 2021}, @@ -104,70 +102,63 @@ def test_chart_programmes_by_sector(self) -> None: def test_chart_total_transferred_by_month(self) -> None: dm_cash = DeliveryMechanism.objects.get(code="cash") dm_voucher = DeliveryMechanism.objects.get(code="voucher") - household, individuals = create_household( - household_args={"size": 2, "business_area": self.business_area}, - ) program1 = ProgramFactory.create(cash_plus=True, sector=Program.EDUCATION) - cash_plan1 = CashPlanFactory(program=program1) + payment_plan1 = PaymentPlanFactory(program_cycle=program1.cycles.first()) delivery_date1 = timezone.datetime(2021, 10, 10, tzinfo=utc) delivery_date2 = timezone.datetime(2021, 11, 10, tzinfo=utc) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date1, - household=household, delivery_type=dm_cash, delivered_quantity_usd=133, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date1, - household=household, delivery_type=dm_voucher, delivered_quantity_usd=25, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date2, - household=household, delivery_type=dm_cash, delivered_quantity_usd=133, currency="PLN", ) - PaymentRecordFactory( - parent=cash_plan1, + PaymentFactory( + parent=payment_plan1, delivery_date=delivery_date2, - household=household, delivery_type=dm_voucher, delivered_quantity_usd=25, currency="PLN", ) - payment_plan1 = PaymentPlanFactory(program=program1) + payment_plan2 = PaymentPlanFactory(program_cycle=program1.cycles.first()) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date1, delivery_type=dm_cash, delivered_quantity_usd=133, currency="PLN", ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date1, delivery_type=dm_voucher, delivered_quantity_usd=25, currency="PLN", ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date2, delivery_type=dm_cash, delivered_quantity_usd=133, currency="PLN", ) PaymentFactory( - parent=payment_plan1, + parent=payment_plan2, delivery_date=delivery_date2, delivery_type=dm_voucher, delivered_quantity_usd=25, diff --git a/tests/unit/apps/program/test_program_cycle.py b/tests/unit/apps/program/test_program_cycle.py index efd17a02b9..581328f325 100644 --- a/tests/unit/apps/program/test_program_cycle.py +++ b/tests/unit/apps/program/test_program_cycle.py @@ -111,19 +111,17 @@ def test_set_finish(self) -> None: def test_total_entitled_quantity_usd(self) -> None: self.assertEqual(self.cycle.total_entitled_quantity_usd, Decimal("0.0")) - PaymentPlanFactory(program=self.program, program_cycle=self.cycle, total_entitled_quantity_usd=Decimal(123.99)) + PaymentPlanFactory(program_cycle=self.cycle, total_entitled_quantity_usd=Decimal(123.99)) self.assertEqual(self.cycle.total_entitled_quantity_usd, Decimal("123.99")) def test_total_undelivered_quantity_usd(self) -> None: self.assertEqual(self.cycle.total_undelivered_quantity_usd, Decimal("0.0")) - PaymentPlanFactory( - program=self.program, program_cycle=self.cycle, total_undelivered_quantity_usd=Decimal(222.33) - ) + PaymentPlanFactory(program_cycle=self.cycle, total_undelivered_quantity_usd=Decimal(222.33)) self.assertEqual(self.cycle.total_undelivered_quantity_usd, Decimal("222.33")) def test_total_delivered_quantity_usd(self) -> None: self.assertEqual(self.cycle.total_delivered_quantity_usd, Decimal("0.0")) - PaymentPlanFactory(program=self.program, program_cycle=self.cycle, total_delivered_quantity_usd=Decimal(333.11)) + PaymentPlanFactory(program_cycle=self.cycle, total_delivered_quantity_usd=Decimal(333.11)) self.assertEqual(self.cycle.total_delivered_quantity_usd, Decimal("333.11")) def test_cycle_validation_start_date(self) -> None: diff --git a/tests/unit/apps/program/test_program_cycle_rest_api.py b/tests/unit/apps/program/test_program_cycle_rest_api.py index 84c0a4e52d..4a4197462b 100644 --- a/tests/unit/apps/program/test_program_cycle_rest_api.py +++ b/tests/unit/apps/program/test_program_cycle_rest_api.py @@ -177,7 +177,7 @@ def test_delete_program_cycle(self) -> None: ) # create TP and PP tp = TargetPopulationFactory(program_cycle=cycle3, program=self.program) - pp = PaymentPlanFactory(program_cycle=cycle3, target_population=tp, program=self.program) + pp = PaymentPlanFactory(program_cycle=cycle3, target_population=tp) self.assertEqual(TargetPopulation.objects.count(), 1) self.assertEqual(ProgramCycle.objects.count(), 4) self.client.force_authenticate(user=self.user) diff --git a/tests/unit/apps/program/test_update_program.py b/tests/unit/apps/program/test_update_program.py index 57cc5d7fde..9403f7cabc 100644 --- a/tests/unit/apps/program/test_update_program.py +++ b/tests/unit/apps/program/test_update_program.py @@ -974,6 +974,7 @@ def test_update_program_end_date_validation(self) -> None: self.assertEqual(self.program.status, Program.ACTIVE) self.assertIsNone(self.program.end_date) program_cycle = self.program.cycles.first() + program_cycle.start_date = self.program.start_date program_cycle.end_date = self.program.start_date + timedelta(days=5) program_cycle.save() diff --git a/tests/unit/apps/program/test_validators.py b/tests/unit/apps/program/test_validators.py index 4ff7a4610e..0deaf18f2e 100644 --- a/tests/unit/apps/program/test_validators.py +++ b/tests/unit/apps/program/test_validators.py @@ -38,7 +38,7 @@ def test_program_validator(self) -> None: data = {"program": self.program, "program_data": {"status": Program.FINISHED}} self.program.status = Program.ACTIVE self.program.save() - PaymentPlanFactory(program=self.program, program_cycle=self.program_cycle, status=PaymentPlan.Status.IN_REVIEW) + PaymentPlanFactory(program_cycle=self.program_cycle, status=PaymentPlan.Status.IN_REVIEW) with self.assertRaisesMessage( ValidationError, "All Payment Plans and Follow-Up Payment Plans have to be Reconciled." diff --git a/tests/unit/apps/reporting/test_generate_dashboard_report_service.py b/tests/unit/apps/reporting/test_generate_dashboard_report_service.py index f52ba09b79..e69de29bb2 100644 --- a/tests/unit/apps/reporting/test_generate_dashboard_report_service.py +++ b/tests/unit/apps/reporting/test_generate_dashboard_report_service.py @@ -1,116 +0,0 @@ -import json -from typing import Any -from unittest.mock import patch - -from django.conf import settings -from django.template.loader import render_to_string -from django.test import TestCase, override_settings - -from constance.test import override_config -from parameterized import parameterized - -from hct_mis_api.apps.account.fixtures import UserFactory -from hct_mis_api.apps.core.fixtures import create_afghanistan -from hct_mis_api.apps.payment.fixtures import generate_delivery_mechanisms -from hct_mis_api.apps.reporting.fixtures import DashboardReportFactory -from hct_mis_api.apps.reporting.models import DashboardReport -from hct_mis_api.apps.reporting.services.generate_dashboard_report_service import ( - GenerateDashboardReportService, -) - - -class TestGenerateDashboardReportService(TestCase): - @classmethod - def setUpClass(cls) -> None: - super().setUpClass() - cls.afg = create_afghanistan() - generate_delivery_mechanisms() - - @parameterized.expand( - [ - (DashboardReport.TOTAL_TRANSFERRED_BY_COUNTRY,), - (DashboardReport.TOTAL_TRANSFERRED_BY_ADMIN_AREA,), - (DashboardReport.BENEFICIARIES_REACHED,), - (DashboardReport.INDIVIDUALS_REACHED,), - (DashboardReport.VOLUME_BY_DELIVERY_MECHANISM,), - (DashboardReport.GRIEVANCES_AND_FEEDBACK,), - (DashboardReport.PROGRAMS,), - (DashboardReport.PAYMENT_VERIFICATION,), - ] - ) - @patch("hct_mis_api.apps.utils.celery_tasks.requests.post") - @override_config(ENABLE_MAILJET=True) - def test_generate_report_successfully(self, report_type: str, mocked_requests_post: Any) -> None: - report = DashboardReportFactory(status=DashboardReport.IN_PROGRESS, report_type=[report_type]) - service = GenerateDashboardReportService(report=report) - - service.generate_report() - - self.assertEqual(report.status, DashboardReport.COMPLETED) - - mocked_requests_post.assert_called_once() - - @patch("hct_mis_api.apps.utils.celery_tasks.requests.post") - @override_config(ENABLE_MAILJET=True) - def test_generate_report_successfully_ba_notification_disabled(self, mocked_requests_post: Any) -> None: - self.afg.enable_email_notification = False - self.afg.save() - report = DashboardReportFactory( - status=DashboardReport.IN_PROGRESS, report_type=[DashboardReport.TOTAL_TRANSFERRED_BY_COUNTRY] - ) - service = GenerateDashboardReportService(report=report) - - service.generate_report() - - self.assertEqual(report.status, DashboardReport.COMPLETED) - - mocked_requests_post.assert_not_called() - - @patch("hct_mis_api.apps.utils.celery_tasks.requests.post") - @override_settings(EMAIL_SUBJECT_PREFIX="test") - @override_config(ENABLE_MAILJET=True) - def test_email_body_for_generate_report(self, mocked_requests_post: Any) -> None: - user = UserFactory(email="testemail@email.com") - report_type = DashboardReport.TOTAL_TRANSFERRED_BY_COUNTRY - report = DashboardReportFactory(status=DashboardReport.IN_PROGRESS, report_type=[report_type], created_by=user) - service = GenerateDashboardReportService(report=report) - - service.generate_report() - - self.assertEqual(report.status, DashboardReport.COMPLETED) - - mocked_requests_post.assert_called_once() - - context = { - "report_type": dict(DashboardReport.REPORT_TYPES)[report_type], - "created_at": report.created_at.strftime("%Y-%m-%d"), - "report_url": f"http://example.com/api/dashboard-report/{report.id}", - "title": "Report", - } - text_body = render_to_string("dashboard_report.txt", context=context) - html_body = render_to_string("dashboard_report.html", context=context) - - expected_data = json.dumps( - { - "Messages": [ - { - "From": {"Email": settings.DEFAULT_EMAIL, "Name": settings.DEFAULT_EMAIL_DISPLAY}, - "Subject": "[test] HOPE report generated", - "To": [ - { - "Email": "testemail@email.com", - }, - ], - "Cc": [], - "HTMLPart": html_body, - "TextPart": text_body, - } - ] - } - ) - - mocked_requests_post.assert_called_with( - "https://api.mailjet.com/v3.1/send", - auth=(settings.MAILJET_API_KEY, settings.MAILJET_SECRET_KEY), - data=expected_data, - ) diff --git a/tests/unit/apps/reporting/test_report_service.py b/tests/unit/apps/reporting/test_report_service.py index f4797fa555..450f987f35 100644 --- a/tests/unit/apps/reporting/test_report_service.py +++ b/tests/unit/apps/reporting/test_report_service.py @@ -15,10 +15,8 @@ from hct_mis_api.apps.geo.fixtures import AreaFactory, AreaTypeFactory from hct_mis_api.apps.household.fixtures import create_household_and_individuals from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, PaymentVerificationFactory, PaymentVerificationPlanFactory, ) @@ -85,81 +83,83 @@ def setUpTestData(self) -> None: else: household.programs.add(self.program_2) - self.cash_plan_1 = CashPlanFactory( + self.payment_plan_1 = PaymentPlanFactory( business_area=self.business_area, - program=self.program_1, + program_cycle=self.program_1.cycles.first(), # end_date=datetime.datetime.fromisoformat("2020-01-01 00:01:11+00:00"), ) - self.cash_plan_2 = CashPlanFactory( + self.payment_plan_2 = PaymentPlanFactory( business_area=self.business_area, # end_date=datetime.datetime.fromisoformat("2020-01-01 00:01:11+00:00") ) - self.payment_plan_1 = PaymentPlanFactory( + self.payment_plan_3 = PaymentPlanFactory( business_area=self.business_area, - program=self.program_1, + program_cycle=self.program_1.cycles.first(), # end_date=datetime.datetime.fromisoformat("2020-01-01 00:01:11+00:00"), ) - self.payment_plan_2 = PaymentPlanFactory( + self.payment_plan_4 = PaymentPlanFactory( business_area=self.business_area, # end_date=datetime.datetime.fromisoformat("2020-01-01 00:01:11+00:00") ) - PaymentVerificationSummary.objects.create(payment_plan_obj=self.payment_plan_1) - PaymentVerificationSummary.objects.create(payment_plan_obj=self.payment_plan_2) - self.cash_plan_verification_1 = PaymentVerificationPlanFactory( - payment_plan_obj=self.cash_plan_1, completion_date="2020-01-01T14:30+00:00" - ) - self.cash_plan_verification_2 = PaymentVerificationPlanFactory( - payment_plan_obj=self.cash_plan_2, completion_date="2020-01-01T14:30+00:00" - ) + PaymentVerificationSummary.objects.create(payment_plan=self.payment_plan_1) + PaymentVerificationSummary.objects.create(payment_plan=self.payment_plan_2) + PaymentVerificationSummary.objects.create(payment_plan=self.payment_plan_3) + PaymentVerificationSummary.objects.create(payment_plan=self.payment_plan_4) self.payment_plan_verification_1 = PaymentVerificationPlanFactory( - payment_plan_obj=self.payment_plan_1, completion_date="2020-01-01T14:30+00:00" + payment_plan=self.payment_plan_1, completion_date="2020-01-01T14:30+00:00" ) self.payment_plan_verification_2 = PaymentVerificationPlanFactory( - payment_plan_obj=self.payment_plan_2, completion_date="2020-01-01T14:30+00:00" + payment_plan=self.payment_plan_2, completion_date="2020-01-01T14:30+00:00" + ) + self.payment_plan_verification_3 = PaymentVerificationPlanFactory( + payment_plan=self.payment_plan_3, completion_date="2020-01-01T14:30+00:00" ) - record_1 = PaymentRecordFactory( + self.payment_plan_verification_4 = PaymentVerificationPlanFactory( + payment_plan=self.payment_plan_4, completion_date="2020-01-01T14:30+00:00" + ) + payment_1 = PaymentFactory( household=self.households[0], business_area=self.business_area, delivery_date="2020-01-01T00:00+00:00", - parent=self.cash_plan_1, + parent=self.payment_plan_1, currency="PLN", ) - record_2 = PaymentRecordFactory( + payment_2 = PaymentFactory( household=self.households[1], business_area=self.business_area, delivery_date="2020-01-01T00:00+00:00", - parent=self.cash_plan_2, + parent=self.payment_plan_2, currency="PLN", ) - payment_1 = PaymentFactory( + payment_3 = PaymentFactory( household=self.households[0], business_area=self.business_area, delivery_date="2020-01-01T14:30+00:00", - parent=self.payment_plan_1, + parent=self.payment_plan_3, currency="PLN", ) - payment_2 = PaymentFactory( + payment_4 = PaymentFactory( household=self.households[1], business_area=self.business_area, delivery_date="2020-01-01T14:30+00:00", - parent=self.payment_plan_2, + parent=self.payment_plan_4, currency="PLN", ) PaymentVerificationFactory( - payment_verification_plan=self.cash_plan_verification_1, - payment_obj=record_1, + payment_verification_plan=self.payment_plan_verification_1, + payment=payment_1, ) PaymentVerificationFactory( - payment_verification_plan=self.cash_plan_verification_2, - payment_obj=record_2, + payment_verification_plan=self.payment_plan_verification_2, + payment=payment_2, ) PaymentVerificationFactory( payment_verification_plan=self.payment_plan_verification_1, - payment_obj=payment_1, + payment=payment_3, ) PaymentVerificationFactory( payment_verification_plan=self.payment_plan_verification_2, - payment_obj=payment_2, + payment=payment_4, ) @parameterized.expand( diff --git a/tests/unit/apps/reporting/test_reporting_choices.py b/tests/unit/apps/reporting/test_reporting_choices.py index d859ad1736..520d9237d3 100644 --- a/tests/unit/apps/reporting/test_reporting_choices.py +++ b/tests/unit/apps/reporting/test_reporting_choices.py @@ -10,8 +10,8 @@ from hct_mis_api.apps.core.models import BusinessArea from hct_mis_api.apps.grievance.models import GrievanceTicket from hct_mis_api.apps.household.fixtures import create_household -from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentRecordFactory -from hct_mis_api.apps.payment.models import Payment, PaymentRecord +from hct_mis_api.apps.payment.fixtures import PaymentFactory +from hct_mis_api.apps.payment.models import Payment class TestProgramChoices(APITestCase): @@ -59,10 +59,8 @@ def test_report_types_choices(self) -> None: @freeze_time("2023-10-10") def test_dashboard_years_choices_no_objects(self) -> None: cache.clear() - PaymentRecord.objects.all().delete() Payment.objects.all().delete() GrievanceTicket.objects.all().delete() - self.assertEqual(PaymentRecord.objects.count(), 0) self.assertEqual(Payment.objects.count(), 0) self.assertEqual(GrievanceTicket.objects.count(), 0) @@ -81,7 +79,7 @@ def test_dashboard_years_choices(self) -> None: household, individuals = create_household( household_args={"size": 2, "business_area": business_area}, ) - PaymentRecordFactory( + PaymentFactory( delivery_date=timezone.datetime(2021, 10, 10, tzinfo=utc), business_area=business_area, household=household, @@ -93,8 +91,7 @@ def test_dashboard_years_choices(self) -> None: household=household, currency="PLN", ) - self.assertEqual(PaymentRecord.objects.count(), 1) - self.assertEqual(Payment.objects.count(), 1) + self.assertEqual(Payment.objects.count(), 2) self.snapshot_graphql_request( request_string=self.QUERY_DASHBOARD_YEARS_CHOICES, diff --git a/tests/unit/fixtures/dashboard.py b/tests/unit/fixtures/dashboard.py index fef8640059..6dd0553a88 100644 --- a/tests/unit/fixtures/dashboard.py +++ b/tests/unit/fixtures/dashboard.py @@ -9,11 +9,7 @@ from hct_mis_api.apps.geo.fixtures import AreaFactory from hct_mis_api.apps.household.fixtures import create_household from hct_mis_api.apps.household.models import Household -from hct_mis_api.apps.payment.fixtures import ( - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, -) +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory class ModifiedPaymentFactory(PaymentFactory): @@ -26,15 +22,6 @@ class ModifiedPaymentFactory(PaymentFactory): status = factory.Iterator(["Transaction Successful", "Distribution Successful", "Partially Distributed", "Pending"]) -class ModifiedPaymentRecordFactory(PaymentRecordFactory): - """ - A specialized factory for creating Payments that match the filtering logic - in DashboardDataCache.refresh_data. - """ - - status = factory.Iterator(["Transaction Successful", "Distribution Successful", "Partially Distributed"]) - - @pytest.fixture() @pytest.mark.django_db(databases=["default", "read_only"]) def populate_dashboard_cache() -> Callable[[BusinessAreaFactory], Household]: @@ -66,7 +53,6 @@ def _populate_dashboard_cache(afghanistan: BusinessAreaFactory) -> Household: } ) ModifiedPaymentFactory.create_batch(5, household=household) - ModifiedPaymentRecordFactory.create_batch(3, household=household) return household diff --git a/tests/unit/one_time_scripts/test_add_pdu_fields.py b/tests/unit/one_time_scripts/test_add_pdu_fields.py index 95fabbaf8d..ca0b7589ad 100644 --- a/tests/unit/one_time_scripts/test_add_pdu_fields.py +++ b/tests/unit/one_time_scripts/test_add_pdu_fields.py @@ -43,9 +43,9 @@ def setUpTestData(cls) -> None: cls.individual_with_flex_field = individuals2[0] flex_field_existing = FlexibleAttribute.objects.create( name="flex_field_1", - label={"English(EN)": "flex field 1"}, type=FlexibleAttribute.STRING, associated_with=FlexibleAttribute.ASSOCIATED_WITH_INDIVIDUAL, + label={"English(EN)": "flex_field_1"}, ) cls.individual_with_flex_field.flex_fields = { flex_field_existing.name: "value1", diff --git a/tests/unit/one_time_scripts/test_add_tickets_to_missing_rdis.py b/tests/unit/one_time_scripts/test_add_tickets_to_missing_rdis.py deleted file mode 100644 index e6a91bd552..0000000000 --- a/tests/unit/one_time_scripts/test_add_tickets_to_missing_rdis.py +++ /dev/null @@ -1,315 +0,0 @@ -from typing import Optional, Tuple - -from django.test import TestCase - -from hct_mis_api.apps.account.fixtures import BusinessAreaFactory -from hct_mis_api.apps.grievance.fixtures import ( - TicketAddIndividualDetailsFactory, - TicketDeleteHouseholdDetailsFactory, - TicketIndividualDataUpdateDetailsFactory, - TicketNeedsAdjudicationDetailsFactory, - TicketSystemFlaggingDetailsFactory, -) -from hct_mis_api.apps.grievance.models import GrievanceTicket -from hct_mis_api.apps.household.fixtures import HouseholdFactory, IndividualFactory -from hct_mis_api.apps.household.models import Household, Individual -from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.sanction_list.fixtures import SanctionListIndividualFactory -from hct_mis_api.one_time_scripts.add_tickets_to_missing_rdis import ( - create_tickets_for_missing_rdis, -) - - -class TestAddTicketsToMissingRDIS(TestCase): - def setUp(self) -> None: - self.business_area = BusinessAreaFactory() - self.program = ProgramFactory(name="program1", business_area=self.business_area, status=Program.ACTIVE) - self.other_program = ProgramFactory(name="program2", business_area=self.business_area, status=Program.ACTIVE) - self.rdi = RegistrationDataImportFactory(business_area=self.business_area, program=self.program) - ( - self.original_household, - self.original_individual, - self.household_representation, - self.individual_representation, - ) = self.create_household_with_representations(self.program) - self.original_household.registration_data_import = self.rdi - self.original_household.save() - self.household_representation.registration_data_import = self.rdi - self.household_representation.save() - - self.add_individual_details = TicketAddIndividualDetailsFactory( - household=self.original_household, - ) - ticket = self.add_individual_details.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket.save() - - self.delete_household_details1 = TicketDeleteHouseholdDetailsFactory( - household=self.original_household, - ) - ticket = self.delete_household_details1.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket.save() - - self.delete_household_details2 = TicketDeleteHouseholdDetailsFactory( - household=self.original_household, - ) - ticket = self.delete_household_details2.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_CLOSED - ticket.save() - - self.delete_household_details3 = TicketDeleteHouseholdDetailsFactory( - household=self.original_household, - ) - delete_household_details3_repr = TicketDeleteHouseholdDetailsFactory( - household=self.original_household, - ) - ticket_repr = delete_household_details3_repr.ticket - ticket_repr.programs.set([self.other_program]) - ticket_repr.copied_from = self.delete_household_details3.ticket - ticket_repr.save() - - ticket = self.delete_household_details3.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_CLOSED - ticket.save() - - self.individual_data_update_details = TicketIndividualDataUpdateDetailsFactory( - individual=self.original_individual - ) - ticket = self.individual_data_update_details.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_CLOSED - ticket.save() - - self.system_flagging_details = TicketSystemFlaggingDetailsFactory( - sanction_list_individual=SanctionListIndividualFactory(), - golden_records_individual=self.original_individual, - ) - ticket = self.system_flagging_details.ticket - ticket.is_original = True - ticket.status = GrievanceTicket.STATUS_CLOSED - ticket.save() - - self.golden_rec_needs_adjudication = self.create_individual_with_representations([self.program]) - - self.needs_adjudication = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication, - ) - self.needs_adjudication.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.needs_adjudication.ticket.is_original = True - self.needs_adjudication.ticket.save() - self.needs_adjudication.possible_duplicates.set( - [ - self.original_individual, - ] - ) - self.needs_adjudication.selected_individuals.set( - [ - self.original_individual, - ] - ) - - # Needs adjudication ticket with existing representation in program - self.golden_rec_needs_adjudication_existing = self.create_individual_with_representations([self.program]) - some_other_ind = self.create_individual_with_representations([self.program]) - some_other_ind_repr = some_other_ind.copied_to.filter(program=self.program).first() - - self.needs_adjudication_existing_org = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication_existing, - ) - self.needs_adjudication_existing_org.possible_duplicates.set( - [ - self.original_individual, - ] - ) - self.needs_adjudication_existing_org.selected_individuals.set( - [ - self.original_individual, - ] - ) - ticket = self.needs_adjudication_existing_org.ticket - ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket.is_original = True - ticket.save() - - self.needs_adjudication_existing_repr = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication_existing.copied_to.filter( - program=self.program - ).first(), - ) - ticket_repr = self.needs_adjudication_existing_repr.ticket - ticket_repr.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket_repr.is_original = False - ticket_repr.copied_from = ticket - ticket_repr.programs.set([self.program]) - ticket_repr.save() - - self.needs_adjudication_existing_repr.possible_duplicates.set( - [ - some_other_ind_repr, - ] - ) - self.needs_adjudication_existing_repr.selected_individuals.set( - [ - some_other_ind_repr, - ] - ) - - def create_individual_with_representations( - self, - representations_programs: Optional[list[Program]] = None, - ) -> Individual: - if not representations_programs: - representations_programs = [] - original_individual = IndividualFactory( - business_area=self.business_area, - household=None, - is_original=True, - ) - - for program in representations_programs: - IndividualFactory( - household=None, - business_area=self.business_area, - copied_from=original_individual, - origin_unicef_id=original_individual.unicef_id, - program=program, - is_original=False, - ) - return original_individual - - def create_household_with_representations( - self, - program: Program, - ) -> Tuple[Household, Individual, Household, Individual]: - original_individual = IndividualFactory(household=None, business_area=self.business_area, is_original=True) - original_household = HouseholdFactory( - business_area=self.business_area, - head_of_household=original_individual, - is_original=True, - ) - original_individual.household = original_household - original_individual.save() - - individual_representation = IndividualFactory( - household=None, - business_area=self.business_area, - program=program, - copied_from=original_individual, - is_original=False, - ) - household_representation = HouseholdFactory( - business_area=self.business_area, - head_of_household=individual_representation, - copied_from=original_household, - origin_unicef_id=original_household.unicef_id, - program=program, - is_original=False, - ) - individual_representation.household = household_representation - individual_representation.save() - - return original_household, original_individual, household_representation, individual_representation - - def create_extra_data_for_needs_adjudication(self, golden_records_ids: list, possible_duplicates_ids: list) -> dict: - data = {"golden_records": [], "possible_duplicate": []} - - for golden_record_id in golden_records_ids: - data["golden_records"].append( - { - "dob": "date_of_birth", - "full_name": "full_name", - "hit_id": str(golden_record_id), - "location": "location", - "proximity_to_score": "proximity_to_score", - "score": "score", - } - ) - for possible_duplicate_id in possible_duplicates_ids: - data["possible_duplicate"].append( - { - "dob": "date_of_birth", - "full_name": "full_name", - "hit_id": str(possible_duplicate_id), - "location": "location", - "proximity_to_score": "proximity_to_score", - "score": "score", - }, - ) - return data - - def test_add_tickets_to_missing_rdis(self) -> None: - create_tickets_for_missing_rdis([self.rdi]) # type: ignore - add_individual_details_repr = ( - self.add_individual_details.ticket.copied_to.filter(programs=self.program) - .first() - .add_individual_ticket_details - ) - self.assertIsNotNone(add_individual_details_repr) - self.assertEqual(add_individual_details_repr.household, self.household_representation) - - delete_household_details1_repr = ( - self.delete_household_details1.ticket.copied_to.filter(programs=self.program) - .first() - .delete_household_ticket_details - ) - self.assertIsNotNone(delete_household_details1_repr) - self.assertEqual(delete_household_details1_repr.household, self.household_representation) - - delete_household_details2_repr = ( - self.delete_household_details2.ticket.copied_to.filter(programs=self.program) - .first() - .delete_household_ticket_details - ) - self.assertIsNotNone(delete_household_details2_repr) - self.assertEqual(delete_household_details2_repr.household, self.household_representation) - - individual_data_update_details_repr = ( - self.individual_data_update_details.ticket.copied_to.filter(programs=self.program) - .first() - .individual_data_update_ticket_details - ) - self.assertIsNotNone(individual_data_update_details_repr) - self.assertEqual(individual_data_update_details_repr.individual, self.individual_representation) - - system_flagging_details_repr = ( - self.system_flagging_details.ticket.copied_to.filter(programs=self.program) - .first() - .system_flagging_ticket_details - ) - self.assertIsNotNone(system_flagging_details_repr) - self.assertEqual(system_flagging_details_repr.golden_records_individual, self.individual_representation) - - needs_adjudication_repr = ( - self.needs_adjudication.ticket.copied_to.filter(programs=self.program) - .first() - .needs_adjudication_ticket_details - ) - self.assertIsNotNone(needs_adjudication_repr) - possible_duplicates = [ - *needs_adjudication_repr.possible_duplicates.all(), - needs_adjudication_repr.golden_records_individual, - ] - expected_possible_duplicates = [ - self.original_individual.copied_to.filter(program=self.program).first(), - self.golden_rec_needs_adjudication.copied_to.filter(program=self.program).first(), - ] - for possible_duplicate in possible_duplicates: - self.assertIn(possible_duplicate, expected_possible_duplicates) - self.assertEqual(needs_adjudication_repr.selected_individuals.count(), 1) - self.assertEqual(needs_adjudication_repr.selected_individuals.first(), self.individual_representation) - - delete_household_details3_repr = self.delete_household_details3.ticket.copied_to.filter( - programs=self.program - ).first() - self.assertIsNone(delete_household_details3_repr) - - self.needs_adjudication_existing_repr.refresh_from_db() - self.assertEqual(self.needs_adjudication_existing_repr.possible_duplicates.count(), 2) - self.assertEqual(self.needs_adjudication_existing_repr.selected_individuals.count(), 2) diff --git a/tests/unit/one_time_scripts/test_create_payment_snapshot.py b/tests/unit/one_time_scripts/test_create_payment_snapshot.py index 9a4c0d92e7..64bee5146b 100644 --- a/tests/unit/one_time_scripts/test_create_payment_snapshot.py +++ b/tests/unit/one_time_scripts/test_create_payment_snapshot.py @@ -1,5 +1,3 @@ -from datetime import datetime - from django.test import TestCase from freezegun import freeze_time @@ -31,10 +29,7 @@ def setUpTestData(cls) -> None: program = RealProgramFactory() program_cycle = program.cycles.first() cls.pp = PaymentPlanFactory( - program=program, program_cycle=program_cycle, - dispersion_start_date=datetime(2020, 8, 10), - dispersion_end_date=datetime(2020, 12, 10), is_follow_up=False, ) cls.hoh1 = IndividualFactory(household=None) diff --git a/tests/unit/one_time_scripts/test_mass_withdraw_sudan_hhs.py b/tests/unit/one_time_scripts/test_mass_withdraw_sudan_hhs.py index 0898de1f1f..bd873f8102 100644 --- a/tests/unit/one_time_scripts/test_mass_withdraw_sudan_hhs.py +++ b/tests/unit/one_time_scripts/test_mass_withdraw_sudan_hhs.py @@ -60,7 +60,7 @@ def test_mass_withdraw_sudan_hhs(self) -> None: True, ) self.assertEqual( - self.household.user_fields["withdrawn_tag"], + self.household.internal_data["withdrawn_tag"], "Received Full entitlements", ) self.assertEqual( diff --git a/tests/unit/one_time_scripts/test_migrate_data_to_representations.py b/tests/unit/one_time_scripts/test_migrate_data_to_representations.py index ae91833bc6..a0bbd4a4a2 100644 --- a/tests/unit/one_time_scripts/test_migrate_data_to_representations.py +++ b/tests/unit/one_time_scripts/test_migrate_data_to_representations.py @@ -34,14 +34,8 @@ IndividualIdentity, IndividualRoleInHousehold, ) -from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, - ServiceProviderFactory, -) -from hct_mis_api.apps.payment.models import Payment, PaymentRecord, ServiceProvider +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory +from hct_mis_api.apps.payment.models import Payment from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory @@ -49,7 +43,6 @@ from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation from hct_mis_api.one_time_scripts.migrate_data_to_representations import ( - adjust_payment_records, adjust_payments, copy_household_representation_for_programs_fast, migrate_data_to_representations, @@ -193,7 +186,7 @@ def setUp(self) -> None: # Payments 1 payment_plan1 = PaymentPlanFactory( target_population=self.target_population1, - program=self.program_active, + program_cycle=self.program_active.cycles.first(), ) self.payment1 = PaymentFactory( @@ -205,18 +198,6 @@ def setUp(self) -> None: entitlement_quantity=103, currency="PLN", ) - cash_plan = CashPlanFactory( - program=self.program_active, - ) - - self.payment_record1 = PaymentRecordFactory( - target_population=self.target_population1, - household=self.household1, - head_of_household=self.individual1_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, - currency="PLN", - ) # Household2 and its data (no RDI, in 2 programs) self.individual2_1 = IndividualFactory( @@ -262,7 +243,7 @@ def setUp(self) -> None: # Payments 2 payment_plan2 = PaymentPlanFactory( target_population=self.target_population_paid, - program=self.program_active, + program_cycle=self.program_active.cycles.first(), ) self.payment2 = PaymentFactory( parent=payment_plan2, @@ -273,15 +254,6 @@ def setUp(self) -> None: currency="PLN", ) - self.payment_record2 = PaymentRecordFactory( - target_population=self.target_population_paid, - household=self.household2, - head_of_household=self.collector2_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, - currency="PLN", - ) - # Household3 and its data # Additional helper individual that will already be enrolled into a different program # and is representative in the household3 @@ -425,7 +397,7 @@ def setUp(self) -> None: # Payments 5 payment_plan5 = PaymentPlanFactory( target_population=self.target_population_paid, - program=self.program_finished1, + program_cycle=self.program_finished1.cycles.first(), ) self.payment5 = PaymentFactory( parent=payment_plan5, @@ -436,17 +408,10 @@ def setUp(self) -> None: currency="PLN", ) - self.payment_record5 = PaymentRecordFactory( - target_population=self.target_population_paid, - household=self.household5, - head_of_household=self.individual5_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, - ) # Payments 7 payment_plan7 = PaymentPlanFactory( target_population=self.target_population3, - program=self.program_finished2, + program_cycle=self.program_finished2.cycles.first(), ) self.payment7 = PaymentFactory( parent=payment_plan7, @@ -456,15 +421,6 @@ def setUp(self) -> None: program=self.program_finished2, currency="PLN", ) - - self.payment_record7 = PaymentRecordFactory( - target_population=self.target_population3, - household=self.household7, - head_of_household=self.individual7_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, - ) - # Households from mixed rdi self.rdi_mixed = RegistrationDataImportFactory( business_area=self.business_area, @@ -670,9 +626,7 @@ def refresh_objects(self) -> None: self.individual4_1.refresh_from_db() self.collector2_1.refresh_from_db() self.payment1.refresh_from_db() - self.payment_record1.refresh_from_db() self.payment2.refresh_from_db() - self.payment_record2.refresh_from_db() self.household5.refresh_from_db() self.individual5_1.refresh_from_db() self.household6.refresh_from_db() @@ -682,9 +636,7 @@ def refresh_objects(self) -> None: self.collector5_1.refresh_from_db() self.collector5_2.refresh_from_db() self.payment5.refresh_from_db() - self.payment_record5.refresh_from_db() self.payment7.refresh_from_db() - self.payment_record7.refresh_from_db() self.rdi_with_3_hhs.refresh_from_db() self.individual_helper3.refresh_from_db() self.individual_mixed_closed_tp_paid.refresh_from_db() @@ -1806,42 +1758,31 @@ def test_migrate_data_to_representations_per_business_area(self) -> None: self.program_active, ) - def test_adjust_payments_and_payment_records(self) -> None: + def test_adjust_payments(self) -> None: payment_count = Payment.objects.filter(business_area=self.business_area).count() - payment_record_count = PaymentRecord.objects.filter(business_area=self.business_area).count() self.assertEqual(self.payment1.collector, self.individual1_2) self.assertEqual(self.payment1.head_of_household, self.individual1_1) self.assertEqual(self.payment1.household, self.household1) - self.assertEqual(self.payment_record1.head_of_household, self.individual1_1) - self.assertEqual(self.payment_record1.household, self.household1) self.assertEqual(self.payment2.collector, self.collector2_1) self.assertEqual(self.payment2.head_of_household, self.individual2_1) self.assertEqual(self.payment2.household, self.household2) - self.assertEqual(self.payment_record2.head_of_household, self.collector2_1) - self.assertEqual(self.payment_record2.household, self.household2) self.assertEqual(self.payment5.collector, self.collector5_1) self.assertEqual(self.payment5.head_of_household, self.individual5_1) self.assertEqual(self.payment5.household, self.household5) - self.assertEqual(self.payment_record5.head_of_household, self.individual5_1) - self.assertEqual(self.payment_record5.household, self.household5) self.assertEqual(self.payment7.collector, self.collector5_1) self.assertEqual(self.payment7.head_of_household, self.individual7_1) self.assertEqual(self.payment7.household, self.household7) - self.assertEqual(self.payment_record7.head_of_household, self.individual7_1) - self.assertEqual(self.payment_record7.household, self.household7) migrate_data_to_representations_per_business_area(business_area=self.business_area) adjust_payments(business_area=self.business_area) - adjust_payment_records(business_area=self.business_area) self.refresh_objects() self.assertEqual(Payment.objects.filter(business_area=self.business_area).count(), payment_count) - self.assertEqual(PaymentRecord.objects.filter(business_area=self.business_area).count(), payment_record_count) # payment1 individual1_1_representation1 = Individual.original_and_repr_objects.filter( @@ -1856,8 +1797,6 @@ def test_adjust_payments_and_payment_records(self) -> None: self.assertEqual(self.payment1.collector, individual1_2_representation1) self.assertEqual(self.payment1.head_of_household, individual1_1_representation1) self.assertEqual(self.payment1.household, household1_representation1) - self.assertEqual(self.payment_record1.head_of_household, individual1_1_representation1) - self.assertEqual(self.payment_record1.household, household1_representation1) # payment2 individual2_1_representation2 = Individual.original_and_repr_objects.filter( @@ -1872,8 +1811,6 @@ def test_adjust_payments_and_payment_records(self) -> None: self.assertEqual(self.payment2.collector, collector2_1_representation2) self.assertEqual(self.payment2.head_of_household, individual2_1_representation2) self.assertEqual(self.payment2.household, household2_representation2) - self.assertEqual(self.payment_record2.head_of_household, collector2_1_representation2) - self.assertEqual(self.payment_record2.household, household2_representation2) # payment5 collector5_1_representation2 = Individual.original_and_repr_objects.filter( @@ -1888,8 +1825,6 @@ def test_adjust_payments_and_payment_records(self) -> None: self.assertEqual(self.payment5.collector, collector5_1_representation2) self.assertEqual(self.payment5.head_of_household, individual5_1_representation2) self.assertEqual(self.payment5.household, household5_representation2) - self.assertEqual(self.payment_record5.head_of_household, individual5_1_representation2) - self.assertEqual(self.payment_record5.household, household5_representation2) # payment7 collector5_1_representation3 = Individual.original_and_repr_objects.filter( @@ -1904,8 +1839,6 @@ def test_adjust_payments_and_payment_records(self) -> None: self.assertEqual(self.payment7.collector, collector5_1_representation3) self.assertEqual(self.payment7.head_of_household, individual7_1_representation3) self.assertEqual(self.payment7.household, household7_representation3) - self.assertEqual(self.payment_record7.head_of_household, individual7_1_representation3) - self.assertEqual(self.payment_record7.household, household7_representation3) class TestCountrySpecificRules(TestCase): diff --git a/tests/unit/one_time_scripts/test_migrate_data_to_representations_performance.py b/tests/unit/one_time_scripts/test_migrate_data_to_representations_performance.py index 99e2610e69..3128c8b496 100644 --- a/tests/unit/one_time_scripts/test_migrate_data_to_representations_performance.py +++ b/tests/unit/one_time_scripts/test_migrate_data_to_representations_performance.py @@ -29,13 +29,11 @@ Individual, ) from hct_mis_api.apps.payment.fixtures import ( - CashPlanFactory, + FinancialServiceProviderFactory, PaymentFactory, PaymentPlanFactory, - PaymentRecordFactory, - ServiceProviderFactory, ) -from hct_mis_api.apps.payment.models import ServiceProvider +from hct_mis_api.apps.payment.models import FinancialServiceProvider from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory @@ -204,7 +202,7 @@ def setUp(self) -> None: # Payments 1 payment_plan1 = PaymentPlanFactory( target_population=self.target_population1, - program=self.program_active, + program_cycle=self.program_active.cycles.first(), ) self.payment1 = PaymentFactory( @@ -216,16 +214,16 @@ def setUp(self) -> None: entitlement_quantity=103, currency="PLN", ) - cash_plan = CashPlanFactory( + payment_plan2 = PaymentPlanFactory( program=self.program_active, ) - self.payment_record1 = PaymentRecordFactory( + self.payment2 = PaymentFactory( target_population=self.target_population1, household=self.household1, head_of_household=self.individual1_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, + service_provider=FinancialServiceProvider.objects.first() or FinancialServiceProviderFactory(), + parent=payment_plan2, currency="PLN", ) @@ -265,12 +263,12 @@ def setUp(self) -> None: ) # Payments 2 - payment_plan2 = PaymentPlanFactory( + payment_plan3 = PaymentPlanFactory( target_population=self.target_population_paid, program=self.program_active, ) - self.payment2 = PaymentFactory( - parent=payment_plan2, + self.payment3 = PaymentFactory( + parent=payment_plan3, collector=self.collector2_1, household=self.household2, head_of_household=self.individual2_1, @@ -278,12 +276,12 @@ def setUp(self) -> None: currency="PLN", ) - self.payment_record2 = PaymentRecordFactory( + self.payment4 = PaymentFactory( target_population=self.target_population_paid, household=self.household2, head_of_household=self.collector2_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, + service_provider=FinancialServiceProvider.objects.first() or FinancialServiceProviderFactory(), + parent=payment_plan2, currency="PLN", ) @@ -423,7 +421,7 @@ def setUp(self) -> None: # Payments 5 payment_plan5 = PaymentPlanFactory( target_population=self.target_population_paid, - program=self.program_finished1, + program_cycle=self.program_finished1.cycles.first(), ) self.payment5 = PaymentFactory( parent=payment_plan5, @@ -434,17 +432,17 @@ def setUp(self) -> None: currency="PLN", ) - self.payment_record5 = PaymentRecordFactory( + self.payment6 = PaymentFactory( target_population=self.target_population_paid, household=self.household5, head_of_household=self.individual5_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, + service_provider=FinancialServiceProvider.objects.first() or FinancialServiceProviderFactory(), + parent=payment_plan2, ) # Payments 7 payment_plan7 = PaymentPlanFactory( target_population=self.target_population3, - program=self.program_finished2, + program_cycle=self.program_finished2.cycles.first(), ) self.payment7 = PaymentFactory( parent=payment_plan7, @@ -455,12 +453,12 @@ def setUp(self) -> None: currency="PLN", ) - self.payment_record7 = PaymentRecordFactory( + self.payment8 = PaymentFactory( target_population=self.target_population3, household=self.household7, head_of_household=self.individual7_1, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - parent=cash_plan, + service_provider=FinancialServiceProvider.objects.first() or FinancialServiceProviderFactory(), + parent=payment_plan2, ) # Households from mixed rdi diff --git a/tests/unit/one_time_scripts/test_migrate_data_to_representations_unit.py b/tests/unit/one_time_scripts/test_migrate_data_to_representations_unit.py index 03ca6f03a1..c6d4b2d624 100644 --- a/tests/unit/one_time_scripts/test_migrate_data_to_representations_unit.py +++ b/tests/unit/one_time_scripts/test_migrate_data_to_representations_unit.py @@ -31,13 +31,7 @@ IndividualIdentity, IndividualRoleInHousehold, ) -from hct_mis_api.apps.payment.fixtures import ( - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, - ServiceProviderFactory, -) -from hct_mis_api.apps.payment.models import ServiceProvider +from hct_mis_api.apps.payment.fixtures import PaymentFactory, PaymentPlanFactory from hct_mis_api.apps.program.fixtures import ProgramFactory from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory @@ -48,7 +42,6 @@ ) from hct_mis_api.apps.targeting.models import HouseholdSelection from hct_mis_api.one_time_scripts.migrate_data_to_representations import ( - adjust_payment_records, adjust_payments, copy_bank_account_info_per_individual, copy_document_per_individual, @@ -508,57 +501,6 @@ def test_adjust_payments(self) -> None: self.assertEqual(self.payment1.household, household_this_program) -class TestAdjustPaymentRecords(TestCase): - def setUp(self) -> None: - self.business_area = BusinessAreaFactory() - self.other_program = ProgramFactory(status=Program.ACTIVE, business_area=self.business_area) - self.target_population1 = TargetPopulationFactory(program=self.other_program, business_area=self.business_area) - ( - self.household_original, - self.individual_original, - ) = create_origin_household_with_individual( - business_area=self.business_area, - ) - self.payment_record1 = PaymentRecordFactory( - target_population=self.target_population1, - household=self.household_original, - head_of_household=self.individual_original, - service_provider=ServiceProvider.objects.first() or ServiceProviderFactory(), - business_area=self.business_area, - ) - - def test_adjust_payment_records(self) -> None: - this_program = ProgramFactory(status=Program.ACTIVE, business_area=self.business_area) - - individual_representation_this_program = IndividualFactory( - program_id=this_program.id, - business_area=self.business_area, - copied_from=self.individual_original, - origin_unicef_id=self.individual_original.unicef_id, - household=None, - is_original=False, - ) - - household_this_program = HouseholdFactory( - program_id=this_program.id, - business_area=self.business_area, - copied_from=self.household_original, - origin_unicef_id=self.household_original.unicef_id, - head_of_household=individual_representation_this_program, - is_original=False, - ) - - self.target_population1.program = this_program - self.target_population1.save() - - adjust_payment_records(self.business_area) - - self.payment_record1.refresh_from_db() - - self.assertEqual(self.payment_record1.head_of_household, individual_representation_this_program) - self.assertEqual(self.payment_record1.household, household_this_program) - - @skip(reason="Skip this test for GPF") class TestCopyHouseholdSelections(TestCase): def setUp(self) -> None: diff --git a/tests/unit/one_time_scripts/test_migrate_grievance_to_representations.py b/tests/unit/one_time_scripts/test_migrate_grievance_to_representations.py deleted file mode 100644 index 8439630e64..0000000000 --- a/tests/unit/one_time_scripts/test_migrate_grievance_to_representations.py +++ /dev/null @@ -1,4438 +0,0 @@ -from typing import Any, Optional -from unittest import skip - -from django.contrib.contenttypes.models import ContentType -from django.db import DEFAULT_DB_ALIAS, connections -from django.test import TestCase - -from hct_mis_api.apps.account.fixtures import BusinessAreaFactory, PartnerFactory -from hct_mis_api.apps.accountability.fixtures import ( - CommunicationMessageFactory, - FeedbackFactory, - FeedbackMessageFactory, -) -from hct_mis_api.apps.accountability.models import Feedback -from hct_mis_api.apps.core.utils import encode_id_base64 -from hct_mis_api.apps.geo.fixtures import CountryFactory -from hct_mis_api.apps.grievance.fixtures import ( - GrievanceComplaintTicketWithoutExtrasFactory, - GrievanceDocumentFactory, - GrievanceTicketFactory, - ReferralTicketWithoutExtrasFactory, - SensitiveGrievanceTicketWithoutExtrasFactory, - TicketAddIndividualDetailsFactory, - TicketDeleteHouseholdDetailsFactory, - TicketDeleteIndividualDetailsFactory, - TicketHouseholdDataUpdateDetailsFactory, - TicketIndividualDataUpdateDetailsFactory, - TicketNeedsAdjudicationDetailsFactory, - TicketNoteFactory, - TicketPaymentVerificationDetailsFactory, - TicketSystemFlaggingDetailsFactory, -) -from hct_mis_api.apps.grievance.models import ( - GrievanceTicket, - TicketDeleteIndividualDetails, - TicketIndividualDataUpdateDetails, - TicketNeedsAdjudicationDetails, - TicketSystemFlaggingDetails, -) -from hct_mis_api.apps.household.fixtures import ( - BankAccountInfoFactory, - DocumentFactory, - HouseholdFactory, - IndividualFactory, - IndividualIdentityFactory, - IndividualRoleInHouseholdFactory, -) -from hct_mis_api.apps.household.models import ( - HEAD, - ROLE_PRIMARY, - Household, - Individual, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.payment.fixtures import ( - PaymentFactory, - PaymentPlanFactory, - PaymentRecordFactory, - PaymentVerificationFactory, - PaymentVerificationPlanFactory, -) -from hct_mis_api.apps.payment.models import Payment, PaymentRecord -from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.sanction_list.fixtures import SanctionListIndividualFactory -from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory -from hct_mis_api.one_time_scripts.migrate_grievance_to_representations import ( - delete_representations_from_ba, - handle_payment_related_tickets, - migrate_grievance_to_representations, -) -from tests.unit.one_time_scripts.test_migrate_data_to_representations_performance import ( - _AssertNumQueriesContext, -) - - -class BaseGrievanceTestCase: - def setUp(self) -> None: - self.PAYMENT_RECORD_CT_ID = ContentType.objects.get_for_model(PaymentRecord).id - self.PAYMENT_CT_ID = ContentType.objects.get_for_model(Payment).id - - self.business_area = getattr(self, "business_area", None) or BusinessAreaFactory() - self.program1 = ProgramFactory(name="program1", business_area=self.business_area, status=Program.ACTIVE) - self.program2 = ProgramFactory(name="program2", business_area=self.business_area, status=Program.ACTIVE) - self.program3 = ProgramFactory(name="program3", business_area=self.business_area, status=Program.ACTIVE) - self.program4 = ProgramFactory(name="program4", business_area=self.business_area, status=Program.ACTIVE) - - self.create_complaint_tickets() - - self.create_sensitive_tickets() - - self.create_payment_verification_tickets() - - self.tickets_add_ind = self.create_hh_only_tickets(TicketAddIndividualDetailsFactory) - - self.tickets_delete_hh = self.create_hh_only_tickets(TicketDeleteHouseholdDetailsFactory) - - self.tickets_update_hh = self.create_hh_only_tickets(TicketHouseholdDataUpdateDetailsFactory) - - self.tickets_upd_ind_data = self.create_ind_only_tickets( - TicketIndividualDataUpdateDetailsFactory, is_individual_data_update=True - ) - - self.tickets_delete_ind = self.create_ind_only_tickets(TicketDeleteIndividualDetailsFactory) - - self.tickets_sys_flagging = self.create_ind_only_tickets( - TicketSystemFlaggingDetailsFactory, - "golden_records_individual", - ) - - self.create_messages() - - self.create_referral_tickets() - - self.create_needs_adjudication_tickets() - - self.create_feedback_closed() - - self.create_feedback_with_program() - - self.create_feedback_without_program_and_not_closed() - - def check_grievance_household_unicef_id( - self, grievance_ticket: GrievanceTicket, household_unicef_id_expected: Optional[str] - ) -> None: - self.assertEqual(grievance_ticket.household_unicef_id, household_unicef_id_expected) - - def check_tickets_unicef_id_uniqueness(self, grievance_tickets: list, ticket_field: str = "ticket") -> None: - ticket_unicef_ids = [getattr(t, ticket_field).unicef_id for t in grievance_tickets] - self.assertEqual( - len(ticket_unicef_ids), - len(set(ticket_unicef_ids)), - ) - - def check_feedback_unicef_id_uniqueness(self, grievance_tickets: list) -> None: - ticket_unicef_ids = [t.unicef_id for t in grievance_tickets] - self.assertEqual( - len(ticket_unicef_ids), - len(set(ticket_unicef_ids)), - ) - - def check_created_at_equality(self, tickets: list, ticket_field: str = "ticket") -> None: - self.assertTrue(all(t.created_at == tickets[0].created_at for t in tickets)) - if getattr(tickets[0], ticket_field) and ticket_field == "linked_grievance" or ticket_field == "ticket": - self.assertTrue( - all( - getattr(t, ticket_field).created_at == getattr(tickets[0], ticket_field).created_at for t in tickets - ) - ) - notes_len = getattr(tickets[0], ticket_field).ticket_notes.count() - documents_len = getattr(tickets[0], ticket_field).support_documents.count() - for x in range(notes_len): - self.assertTrue( - all( - getattr(t, ticket_field).ticket_notes.order_by("created_at")[x].created_at - == getattr(tickets[0], ticket_field).ticket_notes.order_by("created_at")[x].created_at - for t in tickets - ) - ) - for x in range(documents_len): - self.assertTrue( - all( - getattr(t, ticket_field).support_documents.order_by("created_at")[x].created_at - == getattr(tickets[0], ticket_field).support_documents.order_by("created_at")[x].created_at - for t in tickets - ) - ) - - def check_closed_ticket(self, original_ticket: Any, program: Optional[Any], ticket_representation: Any) -> None: - self.check_original_ticket(original_ticket) - self.check_ticket_representation(ticket_representation) - self.assertEqual( - original_ticket.ticket.copied_to(manager="default_for_migrations_fix").count(), - 1, - ) - self.assertEqual( - ticket_representation.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - ticket_representation.ticket.programs(manager="all_objects").first().name, - program.name, - ) - self.assertEqual( - ticket_representation.ticket.is_original, - False, - ) - self.check_created_at_equality([original_ticket, ticket_representation]) - self.check_tickets_unicef_id_uniqueness([original_ticket, ticket_representation]) - - def check_original_ticket(self, original_ticket: Any) -> None: - self.assertEqual( - original_ticket.ticket.programs(manager="all_objects").count(), - 0, - ) - self.assertEqual( - original_ticket.ticket.is_original, - True, - ) - self.assertEqual( - original_ticket.ticket.is_migration_handled, - True, - ) - - def check_ticket_representation(self, ticket_copy: Any) -> None: - self.assertEqual( - ticket_copy.ticket.is_original, - False, - ) - - def create_household_with_representations( - self, - representations_programs: Optional[list[Program]] = None, - ) -> Household: - if not representations_programs: - representations_programs = [] - individual = IndividualFactory(household=None, business_area=self.business_area) - original_household = HouseholdFactory( - business_area=self.business_area, - head_of_household=individual, - ) - - for program in representations_programs: - individual_representation = IndividualFactory( - household=None, - business_area=self.business_area, - program=program, - copied_from=individual, - is_original=False, - ) - HouseholdFactory( - business_area=self.business_area, - head_of_household=individual_representation, - copied_from=original_household, - origin_unicef_id=original_household.unicef_id, - program=program, - is_original=False, - ) - return original_household - - def create_individual_with_representations( - self, - representations_programs: Optional[list[Program]] = None, - ) -> Individual: - if not representations_programs: - representations_programs = [] - original_individual = IndividualFactory( - business_area=self.business_area, - household=None, - ) - - for program in representations_programs: - IndividualFactory( - household=None, - business_area=self.business_area, - copied_from=original_individual, - origin_unicef_id=original_individual.unicef_id, - program=program, - is_original=False, - ) - return original_individual - - def create_role_individual_with_representations( - self, - individual: Individual, - representations_programs: Optional[list[Program]] = None, - role: str = ROLE_PRIMARY, - ) -> tuple[IndividualRoleInHousehold, dict[str, IndividualRoleInHousehold]]: - original_household = self.create_household_with_representations(representations_programs) - if not representations_programs: - representations_programs = [] - - original_role = IndividualRoleInHouseholdFactory( - individual=individual, - household=original_household, - role=role, - ) - - roles_in_programs = {} - for program in representations_programs: - roles_in_programs[program.id] = IndividualRoleInHouseholdFactory( - individual=individual.copied_to(manager="original_and_repr_objects").get(program=program), - household=original_household.copied_to(manager="original_and_repr_objects").get(program=program), - role=role, - is_original=False, - ) - return original_role, roles_in_programs - - def create_complaint_tickets(self) -> None: - # ComplaintTicketDetails with payment in pr1, with HH in pr1 and IND in pr1 and pr3 - self.household_complaint_ticket_with_payment = self.create_household_with_representations([self.program1]) - self.individual_complaint_ticket_with_payment = self.create_individual_with_representations( - [self.program1, self.program3], - ) - - target_population1 = TargetPopulationFactory(program=self.program1) - payment_plan = PaymentPlanFactory(target_population=target_population1) - payment = PaymentFactory(parent=payment_plan, currency="PLN") - - self.complaint_ticket_with_payment = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_with_payment, - individual=self.individual_complaint_ticket_with_payment, - payment_obj=payment, - ) - - # ComplaintTicketDetails with payment_record in pr2, with HH in p2 and pr3 - self.household_complaint_ticket_with_payment_record = self.create_household_with_representations( - [self.program2, self.program3] - ) - target_population2 = TargetPopulationFactory(program=self.program2) - payment_record = PaymentRecordFactory( - target_population=target_population2, - household=self.household_complaint_ticket_with_payment_record, - currency="PLN", - ) - - self.complaint_ticket_with_payment_record = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_with_payment_record, individual=None, payment_obj=payment_record - ) - - # ComplaintTicketDetails without payment_obj - # GT is Closed, no HH and no IND - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt = GrievanceComplaintTicketWithoutExtrasFactory( - household=None, - individual=None, - payment_obj=None, - ) - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.ticket.status = GrievanceTicket.STATUS_CLOSED - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.ticket.save() - - # GT is Closed, HH in pr1, and IND in pr1, pr2, pr3 - self.household_complaint_ticket_no_payment_closed_gt = self.create_household_with_representations( - [self.program1] - ) - self.individual_complaint_ticket_no_payment_closed_gt = self.create_individual_with_representations( - [self.program1, self.program2, self.program3], - ) - self.complaint_ticket_no_payment_closed_gt = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_no_payment_closed_gt, - individual=self.individual_complaint_ticket_no_payment_closed_gt, - payment_obj=None, - ) - self.complaint_ticket_no_payment_closed_gt.ticket.status = GrievanceTicket.STATUS_CLOSED - self.complaint_ticket_no_payment_closed_gt.ticket.save() - - # GT is Closed, HH in p1, pr2 - self.household_complaint_ticket_no_payment_closed_gt_only_hh = self.create_household_with_representations( - [self.program1, self.program2], - ) - self.complaint_ticket_no_payment_closed_gt_only_hh = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_no_payment_closed_gt_only_hh, - individual=None, - payment_obj=None, - ) - self.complaint_ticket_no_payment_closed_gt_only_hh.ticket.status = GrievanceTicket.STATUS_CLOSED - self.complaint_ticket_no_payment_closed_gt_only_hh.ticket.save() - - # GT is not Closed, HH in p1, pr2 - self.household_complaint_ticket_no_payment_only_hh = self.create_household_with_representations( - [self.program1, self.program2], - ) - self.complaint_ticket_no_payment_only_hh = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_no_payment_only_hh, - individual=None, - payment_obj=None, - ) - self.complaint_ticket_no_payment_only_hh.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.complaint_ticket_no_payment_only_hh.ticket.save() - - # GT is not Closed and has 2 documents and 1 note, hh in p1 with repr in pr2, ind in pr3 with repr in pr1, pr2 - self.household_complaint_ticket_no_payment_not_closed_gt = self.create_household_with_representations( - [self.program1, self.program2], - ) - self.individual_complaint_ticket_no_payment_not_closed_gt = self.create_individual_with_representations( - [self.program1, self.program2, self.program3], - ) - - self.complaint_ticket_no_payment_not_closed_gt = GrievanceComplaintTicketWithoutExtrasFactory( - household=self.household_complaint_ticket_no_payment_not_closed_gt, - individual=self.individual_complaint_ticket_no_payment_not_closed_gt, - payment_obj=None, - ) - grievance_ticket = self.complaint_ticket_no_payment_not_closed_gt.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - - TicketNoteFactory(ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - - # GT is not Closed with note and document, no HH no IND - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind = GrievanceComplaintTicketWithoutExtrasFactory( - household=None, - individual=None, - payment_obj=None, - ) - grievance_ticket = self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - - TicketNoteFactory(ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - - def create_sensitive_tickets(self) -> None: - # TicketSensitiveDetails with payment in pr1, IND in pr1 - self.individual_sensitive_ticket_with_payment = self.create_individual_with_representations([self.program1]) - - target_population1 = TargetPopulationFactory(program=self.program1) - payment_plan = PaymentPlanFactory(target_population=target_population1) - payment = PaymentFactory(parent=payment_plan) - - self.sensitive_ticket_with_payment = SensitiveGrievanceTicketWithoutExtrasFactory( - household=None, - individual=self.individual_sensitive_ticket_with_payment, - payment_obj=payment, - ) - - # TicketSensitiveDetails without payment_obj - # GT is Closed, IND in pr1 - individual_pr1 = self.create_individual_with_representations([self.program1]) - self.sensitive_ticket_no_payment_closed_gt = SensitiveGrievanceTicketWithoutExtrasFactory( - household=None, - individual=individual_pr1, - payment_obj=None, - ) - self.sensitive_ticket_no_payment_closed_gt.ticket.status = GrievanceTicket.STATUS_CLOSED - self.sensitive_ticket_no_payment_closed_gt.ticket.save() - - # GT is not Closed and has 2 notes and 1 document and is linked to - # self.complaint_ticket_no_payment_not_closed_gt.ticket, IND in pr1, pr2 - self.individual_sensitive_ticket_no_payment_not_closed_gt = self.create_individual_with_representations( - [self.program1, self.program2] - ) - self.sensitive_ticket_no_payment_not_closed_gt = SensitiveGrievanceTicketWithoutExtrasFactory( - household=None, - individual=self.individual_sensitive_ticket_no_payment_not_closed_gt, - payment_obj=None, - ) - grievance_ticket = self.sensitive_ticket_no_payment_not_closed_gt.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - grievance_ticket.linked_tickets.add(self.complaint_ticket_no_payment_not_closed_gt.ticket) - - TicketNoteFactory(ticket=grievance_ticket) - TicketNoteFactory(ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - - # TicketSensitiveDetails with payment_record in pr2, HH in pr1, pr2, IND in pr3, pr2 - self.household_sensitive_ticket_with_payment_record = self.create_household_with_representations( - [self.program1, self.program2], - ) - self.individual_sensitive_ticket_with_payment_record = self.create_individual_with_representations( - [self.program2, self.program3], - ) - target_population2 = TargetPopulationFactory(program=self.program2) - payment_record = PaymentRecordFactory( - target_population=target_population2, - household=self.household_sensitive_ticket_with_payment_record, - currency="PLN", - ) - self.sensitive_ticket_with_payment_record = SensitiveGrievanceTicketWithoutExtrasFactory( - household=self.household_sensitive_ticket_with_payment_record, - individual=self.individual_sensitive_ticket_with_payment_record, - payment_obj=payment_record, - ) - - # TicketSensitiveDetails with no payment, GT not Closed, HH in pr1, pr2, pr3, IND in pr2, pr3 - self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind = self.create_household_with_representations( - [self.program1, self.program2, self.program3], - ) - self.individual_sensitive_ticket_no_payment_not_closed_3hh_2ind = self.create_individual_with_representations( - [self.program2, self.program3], - ) - self.sensitive_ticket_no_payment_not_closed_3hh_2ind = SensitiveGrievanceTicketWithoutExtrasFactory( - household=self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind, - individual=self.individual_sensitive_ticket_no_payment_not_closed_3hh_2ind, - payment_obj=None, - ) - grievance_ticket = self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - - TicketNoteFactory(ticket=grievance_ticket) - TicketNoteFactory(ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - GrievanceDocumentFactory(grievance_ticket=grievance_ticket) - - def create_payment_verification_tickets(self) -> None: - payment_verification_plan = PaymentVerificationPlanFactory() - # TicketPaymentVerificationDetails with payment_verification with payment_record - self.household_payment_verification_ticket_with_payment_record = self.create_household_with_representations( - [self.program1] - ) - target_population1 = TargetPopulationFactory(program=self.program1) - payment_record = PaymentRecordFactory( - target_population=target_population1, - household=self.household_payment_verification_ticket_with_payment_record, - ) - payment_verification1 = PaymentVerificationFactory( - payment_obj=payment_record, - payment_verification_plan=payment_verification_plan, - ) - self.payment_verification_ticket_with_payment_record = TicketPaymentVerificationDetailsFactory( - payment_verification=payment_verification1, - ) - self.payment_verification_ticket_with_payment_record.ticket.linked_tickets.add( - self.sensitive_ticket_no_payment_not_closed_gt.ticket - ) - - # TicketPaymentVerificationDetails with payment with payment_record - target_population2 = TargetPopulationFactory(program=self.program2) - payment_plan = PaymentPlanFactory(target_population=target_population2) - payment = PaymentFactory(parent=payment_plan) - payment_verification2 = PaymentVerificationFactory( - payment_obj=payment, - ) - self.payment_verification_ticket_with_payment = TicketPaymentVerificationDetailsFactory( - payment_verification=payment_verification2, - ) - - # TicketPaymentVerificationDetails without payment_verification - self.payment_verification_ticket_no_payment_verification = TicketPaymentVerificationDetailsFactory( - payment_verification=None, - ) - - def create_hh_only_tickets(self, factory_model: Any) -> tuple: - # GT closed, no hh - ticket_closed_no_hh = factory_model() - ticket_closed_no_hh.ticket.status = GrievanceTicket.STATUS_CLOSED - ticket_closed_no_hh.ticket.save() - - # GT closed, 2 hhs - household = self.create_household_with_representations([self.program1, self.program2]) - - ticket_closed_2hh = factory_model( - household=household, - ) - ticket_closed_2hh.ticket.status = GrievanceTicket.STATUS_CLOSED - ticket_closed_2hh.ticket.save() - - # GT not closed, no hh - ticket_active_no_hh = factory_model() - ticket_active_no_hh.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket_active_no_hh.ticket.save() - - # GT not closed, 1 hh - household = self.create_household_with_representations([self.program2]) - ticket_active_1hh = factory_model( - household=household, - ) - ticket_active_1hh.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket_active_1hh.ticket.save() - - # GT not closed, 3 hhs, 2 notes and 2 docs - household = self.create_household_with_representations([self.program1, self.program2, self.program3]) - ticket_active_3hh_2notes_2docs = factory_model( - household=household, - ) - grievance_ticket = ticket_active_3hh_2notes_2docs.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - [TicketNoteFactory(ticket=grievance_ticket) for _ in range(2)] - [GrievanceDocumentFactory(grievance_ticket=grievance_ticket) for _ in range(2)] - - return ( - ticket_closed_no_hh, - ticket_closed_2hh, - ticket_active_no_hh, - ticket_active_1hh, - ticket_active_3hh_2notes_2docs, - ) - - def create_ind_only_tickets( - self, factory_model: Any, individual_field: str = "individual", is_individual_data_update: bool = False - ) -> tuple: - kwargs = {} - if factory_model == TicketSystemFlaggingDetailsFactory: - kwargs = {"sanction_list_individual": SanctionListIndividualFactory()} - # GT closed, 2 ind - individual = self.create_individual_with_representations([self.program1, self.program2]) - ticket_closed_2ind_individual_for_role = self.create_individual_with_representations( - [self.program1, self.program2] - ) - ( - ticket_closed_2ind_original_role, - ticket_closed_2ind_other_roles, - ) = self.create_role_individual_with_representations(individual, [self.program1, self.program2]) - - ticket_closed_2ind_reassign_data = { - str(ticket_closed_2ind_original_role.id): { - "household": encode_id_base64(ticket_closed_2ind_original_role.household.id, "Household"), - "individual": encode_id_base64(ticket_closed_2ind_individual_for_role.id, "Individual"), - "role": ROLE_PRIMARY, - } - } - if is_individual_data_update: - self.create_individual_related_data(individual, [self.program1, self.program2]) - self.individual_data_ticket_closed_2ind = {"individual_data": self.create_individual_data_dict(individual)} - individual_data = self.individual_data_ticket_closed_2ind - else: - individual_data = {} - - ticket_closed_2ind = factory_model( - **{individual_field: individual}, - **kwargs, - role_reassign_data=ticket_closed_2ind_reassign_data, - **individual_data, - ) - ticket_closed_2ind.ticket.status = GrievanceTicket.STATUS_CLOSED - ticket_closed_2ind.ticket.save() - - # GT not closed, 1 ind - individual = self.create_individual_with_representations([self.program2]) - - ( - ticket_active_1ind_original_role, - ticket_active_1ind_other_roles, - ) = self.create_role_individual_with_representations(individual, [self.program2]) - ticket_active_1ind_individual_for_role = self.create_individual_with_representations([self.program2]) - - ticket_active_1ind_reassign_data = { - str(ticket_active_1ind_original_role.id): { - "household": encode_id_base64(ticket_active_1ind_original_role.household.id, "Household"), - "individual": encode_id_base64(ticket_active_1ind_individual_for_role.id, "Individual"), - "role": ROLE_PRIMARY, - } - } - if is_individual_data_update: - self.create_individual_related_data(individual, [self.program2]) - self.individual_data_ticket_active_1ind = {"individual_data": self.create_individual_data_dict(individual)} - individual_data = self.individual_data_ticket_active_1ind - else: - individual_data = {} - - ticket_active_1ind = factory_model( - **{individual_field: individual}, - **kwargs, - role_reassign_data=ticket_active_1ind_reassign_data, - **individual_data, - ) - ticket_active_1ind.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - ticket_active_1ind.ticket.save() - - # GT not closed, 3 ind, 2 notes and 2 docs - individual = self.create_individual_with_representations([self.program1, self.program2, self.program3]) - ( - ticket_active_3ind_2notes_2docs_original_role, - ticket_active_3ind_2notes_2docs_other_roles, - ) = self.create_role_individual_with_representations(individual, [self.program3, self.program2, self.program1]) - ticket_active_3ind_2notes_2docs_individual_for_role = self.create_individual_with_representations( - [self.program1, self.program2, self.program3] - ) - ticket_active_3ind_2notes_2docs_reassign_data = { - str(ticket_active_3ind_2notes_2docs_original_role.id): { - "household": encode_id_base64(ticket_active_3ind_2notes_2docs_original_role.household.id, "Household"), - "individual": encode_id_base64(ticket_active_3ind_2notes_2docs_individual_for_role.id, "Individual"), - "role": ROLE_PRIMARY, - }, - "HEAD": { - "household": encode_id_base64(ticket_active_3ind_2notes_2docs_original_role.household.id, "Household"), - "individual": encode_id_base64(ticket_active_3ind_2notes_2docs_individual_for_role.id, "Individual"), - "role": HEAD, - }, - } - if is_individual_data_update: - self.create_individual_related_data(individual, [self.program1, self.program2, self.program3]) - self.individual_data_ticket_active_3ind_2notes_2docs = { - "individual_data": self.create_individual_data_dict(individual) - } - individual_data = self.individual_data_ticket_active_3ind_2notes_2docs - else: - individual_data = {} - ticket_active_3ind_2notes_2docs = factory_model( - **{individual_field: individual}, - **kwargs, - role_reassign_data=ticket_active_3ind_2notes_2docs_reassign_data, - **individual_data, - ) - grievance_ticket = ticket_active_3ind_2notes_2docs.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - [TicketNoteFactory(ticket=grievance_ticket) for _ in range(2)] - [GrievanceDocumentFactory(grievance_ticket=grievance_ticket) for _ in range(2)] - - return ( - ticket_closed_2ind, - ticket_closed_2ind_reassign_data, - ticket_closed_2ind_other_roles, - ticket_closed_2ind_individual_for_role, - ticket_active_1ind, - ticket_active_1ind_reassign_data, - ticket_active_1ind_other_roles, - ticket_active_1ind_individual_for_role, - ticket_active_3ind_2notes_2docs, - ticket_active_3ind_2notes_2docs_original_role, - ticket_active_3ind_2notes_2docs_other_roles, - ticket_active_3ind_2notes_2docs_individual_for_role, - ) - - def create_individual_data_dict(self, individual: Individual) -> dict: - first_document = individual.documents(manager="original_and_repr_objects").order_by("document_number").first() - last_document = individual.documents(manager="original_and_repr_objects").order_by("document_number").last() - first_identity = individual.identities(manager="original_and_repr_objects").order_by("number").first() - last_identity = individual.identities(manager="original_and_repr_objects").order_by("number").last() - first_bank_account_info = ( - individual.bank_account_info(manager="original_and_repr_objects").order_by("bank_account_number").first() - ) - last_bank_account_info = ( - individual.bank_account_info(manager="original_and_repr_objects").order_by("bank_account_number").last() - ) - return { - "documents_to_remove": [ - { - "value": encode_id_base64(first_document.id, "Document"), - }, - ], - "previous_documents": { - encode_id_base64(first_document.id, "Document"): { - "id": encode_id_base64(first_document.id, "Document"), - "individual": encode_id_base64(individual.id, "Individual"), - "document_number": first_document.document_number, - "key": first_document.type.key, - "country": first_document.country.iso_code3, - } - }, - "documents_to_edit": [ - { - "previous_value": { - "country": last_document.country.iso_code3, - "id": encode_id_base64(last_document.id, "Document"), - "number": last_document.document_number, - }, - "value": { - "country": "POL", - "id": encode_id_base64(last_document.id, "Document"), - "number": "789-789-646", - }, - }, - ], - "identities_to_remove": [ - { - "value": encode_id_base64(first_identity.id, "IndividualIdentity"), - }, - ], - "previous_identities": { - encode_id_base64(first_identity.id, "IndividualIdentity"): { - "id": encode_id_base64(first_identity.id, "IndividualIdentity"), - "individual": encode_id_base64(individual.id, "Individual"), - "number": first_identity.number, - "partner": first_identity.partner.name, - "country": first_identity.country.iso_code3, - } - }, - "identities_to_edit": [ - { - "previous_value": { - "country": last_identity.country.iso_code3, - "id": encode_id_base64(last_identity.id, "IndividualIdentity"), - "individual": encode_id_base64(individual.id, "Individual"), - "number": last_identity.number, - "partner": last_identity.partner.name, - }, - "value": { - "country": "POL", - "id": encode_id_base64(last_identity.id, "IndividualIdentity"), - "individual": encode_id_base64(individual.id, "Individual"), - "number": "789-789-646", - "partner": "Partner", - }, - }, - ], - "payment_channels_to_remove": [ - { - "value": encode_id_base64(first_bank_account_info.id, "BankAccountInfo"), - } - ], - "previous_payment_channels": { - encode_id_base64(first_bank_account_info.id, "BankAccountInfo"): { - "id": encode_id_base64(first_bank_account_info.id, "BankAccountInfo"), - "individual": encode_id_base64(individual.id, "Individual"), - "bank_name": first_bank_account_info.bank_name, - "bank_account_number": first_bank_account_info.bank_account_number, - } - }, - "payment_channels_to_edit": [ - { - "previous_value": { - "id": encode_id_base64(last_bank_account_info.id, "BankAccountInfo"), - "individual": encode_id_base64(individual.id, "Individual"), - "bank_name": last_bank_account_info.bank_name, - "bank_account_number": last_bank_account_info.bank_account_number, - }, - "value": { - "id": encode_id_base64(last_bank_account_info.id, "BankAccountInfo"), - "individual": encode_id_base64(individual.id, "Individual"), - "bank_name": "Some name", - "bank_account_number": "111 111", - }, - }, - ], - } - - def create_individual_related_data( - self, - individual: Individual, - other_programs: list[Program], - ) -> None: - country = CountryFactory() - partner = PartnerFactory() - documents = [DocumentFactory(individual=individual) for _ in range(2)] - identities = [ - IndividualIdentityFactory(individual=individual, partner=partner, country=country) for _ in range(2) - ] - - bank_accounts = [BankAccountInfoFactory(individual=individual) for _ in range(2)] - for program in other_programs: - individual_representation = individual.copied_to(manager="original_and_repr_objects").get(program=program) - [ - DocumentFactory( - individual=individual_representation, - document_number=d.document_number, - type=d.type, - country=d.country, - program=program, - is_original=False, - copied_from=d, - ) - for d in documents - ] - [ - IndividualIdentityFactory( - individual=individual_representation, - number=i.number, - partner=i.partner, - country=i.country, - is_original=False, - copied_from=i, - ) - for i in identities - ] - [ - BankAccountInfoFactory( - individual=individual_representation, - bank_name=b.bank_name, - bank_account_number=b.bank_account_number, - is_original=False, - copied_from=b, - ) - for b in bank_accounts - ] - - def create_messages(self) -> None: - # Message with target population - self.message_tp_hh1_1 = self.create_household_with_representations([self.program2, self.program1]) - self.message_tp_hh2_1 = self.create_household_with_representations([self.program1]) - self.message_tp_hh3_1 = self.create_household_with_representations( - [self.program1, self.program2, self.program3] - ) - self.message_tp_hh4_1 = self.create_household_with_representations([self.program2]) - self.message_tp_target_population = TargetPopulationFactory(program=self.program1) - self.message_tp = CommunicationMessageFactory( - target_population=self.message_tp_target_population, - ) - self.message_tp.households.set( - [self.message_tp_hh1_1, self.message_tp_hh2_1, self.message_tp_hh3_1, self.message_tp_hh4_1] - ) - - # Message without target population - hh1 = self.create_household_with_representations([self.program2, self.program1]) - hh2 = self.create_household_with_representations([self.program1]) - hh3 = self.create_household_with_representations([self.program1, self.program2, self.program3]) - hh4 = self.create_household_with_representations([self.program2]) - self.message_no_tp = CommunicationMessageFactory() - self.message_no_tp.households.set([hh1, hh2, hh3, hh4]) - - # Message without target population and without households - self.message_no_tp_no_hh = CommunicationMessageFactory() - self.message_no_tp_no_hh.households.set([]) - - def create_referral_tickets(self) -> None: - # GT closed, no hh no ind - self.referral_closed_gt_no_hh_no_ind = ReferralTicketWithoutExtrasFactory() - self.referral_closed_gt_no_hh_no_ind.ticket.status = GrievanceTicket.STATUS_CLOSED - self.referral_closed_gt_no_hh_no_ind.ticket.save() - - # GT closed, hh in pr1, pr2, ind in pr2, pr1 - self.household_referral_closed_gt_1hh_1ind = self.create_household_with_representations( - [self.program1, self.program2] - ) - self.individual_referral_closed_gt_1hh_1ind = self.create_individual_with_representations( - [self.program2, self.program1] - ) - self.referral_closed_gt_1hh_1ind = ReferralTicketWithoutExtrasFactory( - household=self.household_referral_closed_gt_1hh_1ind, - individual=self.individual_referral_closed_gt_1hh_1ind, - ) - self.referral_closed_gt_1hh_1ind.ticket.status = GrievanceTicket.STATUS_CLOSED - self.referral_closed_gt_1hh_1ind.ticket.save() - - # GT closed, no hh, ind in pr2 - self.individual_referral_closed_gt_no_hh_1ind = self.create_individual_with_representations([self.program2]) - self.referral_closed_gt_no_hh_1ind = ReferralTicketWithoutExtrasFactory( - individual=self.individual_referral_closed_gt_no_hh_1ind, - ) - self.referral_closed_gt_no_hh_1ind.ticket.status = GrievanceTicket.STATUS_CLOSED - self.referral_closed_gt_no_hh_1ind.ticket.save() - - # GT closed, hh in pr3, no ind - self.household_referral_closed_gt_1hh_no_ind = self.create_household_with_representations([self.program3]) - self.referral_closed_gt_1hh_no_ind = ReferralTicketWithoutExtrasFactory( - household=self.household_referral_closed_gt_1hh_no_ind, - ) - self.referral_closed_gt_1hh_no_ind.ticket.status = GrievanceTicket.STATUS_CLOSED - self.referral_closed_gt_1hh_no_ind.ticket.save() - - # GT not closed, no hh no ind - self.referral_active_gt_no_hh_no_ind = ReferralTicketWithoutExtrasFactory() - self.referral_active_gt_no_hh_no_ind.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.referral_active_gt_no_hh_no_ind.ticket.save() - - # GT not closed 2 notes 2 docs, hh in pr1, pr2, no ind - self.household_referral_active_gt_1hh_2notes_2docs = self.create_household_with_representations( - [self.program1, self.program2], - ) - self.referral_active_gt_1hh_2notes_2docs = ReferralTicketWithoutExtrasFactory( - household=self.household_referral_active_gt_1hh_2notes_2docs, - ) - grievance_ticket = self.referral_active_gt_1hh_2notes_2docs.ticket - grievance_ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - grievance_ticket.save() - [TicketNoteFactory(ticket=grievance_ticket) for _ in range(2)] - [GrievanceDocumentFactory(grievance_ticket=grievance_ticket) for _ in range(2)] - - # GT not closed, no hh, ind in pr3, p2 - self.individual_referral_active_gt_no_hh_1ind_2repr = self.create_individual_with_representations( - [self.program3, self.program2] - ) - self.referral_active_gt_no_hh_1ind_2repr = ReferralTicketWithoutExtrasFactory( - individual=self.individual_referral_active_gt_no_hh_1ind_2repr, - ) - self.referral_active_gt_no_hh_1ind_2repr.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.referral_active_gt_no_hh_1ind_2repr.ticket.save() - - # GT not closed, hh in pr1, pr2 pr3, ind in pr2, pr3 - self.household_referral_active_gt_1hh_1ind = self.create_household_with_representations( - [self.program1, self.program2, self.program3] - ) - self.individual_referral_active_gt_1hh_1ind = self.create_individual_with_representations( - [self.program2, self.program3] - ) - self.referral_active_gt_1hh_1ind = ReferralTicketWithoutExtrasFactory( - household=self.household_referral_active_gt_1hh_1ind, - individual=self.individual_referral_active_gt_1hh_1ind, - ) - self.referral_active_gt_1hh_1ind.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.referral_active_gt_1hh_1ind.ticket.save() - - def create_extra_data_for_needs_adjudication(self, golden_records_ids: list, possible_duplicates_ids: list) -> dict: - data = {"golden_records": [], "possible_duplicate": []} - - for golden_record_id in golden_records_ids: - data["golden_records"].append( - { - "dob": "date_of_birth", - "full_name": "full_name", - "hit_id": str(golden_record_id), - "location": "location", - "proximity_to_score": "proximity_to_score", - "score": "score", - } - ) - for possible_duplicate_id in possible_duplicates_ids: - data["possible_duplicate"].append( - { - "dob": "date_of_birth", - "full_name": "full_name", - "hit_id": str(possible_duplicate_id), - "location": "location", - "proximity_to_score": "proximity_to_score", - "score": "score", - }, - ) - return data - - def create_needs_adjudication_tickets(self) -> None: - # GT not closed, golden ind pr1, pr3, selected ind 2 and 3 - self.golden_rec_needs_adjudication_not_closed = self.create_individual_with_representations( - [self.program1, self.program3] - ) - self.possible_dup1_needs_adjudication_not_closed = self.create_individual_with_representations( - [self.program2, self.program1, self.program3] - ) - self.possible_dup2_needs_adjudication_not_closed = self.create_individual_with_representations( - [self.program1, self.program4] - ) - self.possible_dup3_needs_adjudication_not_closed = self.create_individual_with_representations([self.program2]) - self.possible_dup4_needs_adjudication_not_closed = self.create_individual_with_representations( - [self.program3, self.program2] - ) - extra_data = self.create_extra_data_for_needs_adjudication( - [self.golden_rec_needs_adjudication_not_closed.id], - [self.possible_dup1_needs_adjudication_not_closed.id, self.possible_dup4_needs_adjudication_not_closed.id], - ) - - self.needs_adjudication_not_closed = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication_not_closed, - extra_data=extra_data, - ) - self.needs_adjudication_not_closed.ticket.status = GrievanceTicket.STATUS_IN_PROGRESS - self.needs_adjudication_not_closed.ticket.save() - self.needs_adjudication_not_closed.possible_duplicates.set( - [ - self.possible_dup1_needs_adjudication_not_closed, - self.possible_dup2_needs_adjudication_not_closed, - self.possible_dup3_needs_adjudication_not_closed, - self.possible_dup4_needs_adjudication_not_closed, - ] - ) - self.needs_adjudication_not_closed.selected_individuals.set( - [ - self.possible_dup2_needs_adjudication_not_closed, - self.possible_dup3_needs_adjudication_not_closed, - ] - ) - # link the ticket with others - self.needs_adjudication_not_closed.ticket.linked_tickets.add( - self.sensitive_ticket_no_payment_not_closed_gt.ticket - ) - self.needs_adjudication_not_closed.ticket.linked_tickets.add( - self.payment_verification_ticket_with_payment_record.ticket - ) - # GT closed, golden in pr4, selected ind 1 3 and 4 - self.golden_rec_needs_adjudication_closed = self.create_individual_with_representations([self.program4]) - self.possible_dup1_needs_adjudication_closed = self.create_individual_with_representations( - [self.program1, self.program3] - ) - self.possible_dup2_needs_adjudication_closed = self.create_individual_with_representations([self.program3]) - self.possible_dup3_needs_adjudication_closed = self.create_individual_with_representations( - [self.program2, self.program1, self.program3] - ) - self.possible_dup4_needs_adjudication_closed = self.create_individual_with_representations( - [self.program3, self.program4] - ) - self.needs_adjudication_closed = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication_closed - ) - self.needs_adjudication_closed.ticket.status = GrievanceTicket.STATUS_CLOSED - self.needs_adjudication_closed.ticket.save() - self.needs_adjudication_closed.possible_duplicates.set( - [ - self.possible_dup1_needs_adjudication_closed, - self.possible_dup2_needs_adjudication_closed, - self.possible_dup3_needs_adjudication_closed, - self.possible_dup4_needs_adjudication_closed, - ] - ) - self.needs_adjudication_closed.selected_individuals.set( - [ - self.possible_dup1_needs_adjudication_closed, - self.possible_dup3_needs_adjudication_closed, - self.possible_dup4_needs_adjudication_closed, - ] - ) - - # GT closed 2docs 2 notes, golden from pr1, selected ind 3 and 4 - self.golden_rec_needs_adjudication_closed_2docs_2notes = self.create_individual_with_representations( - [self.program1] - ) - self.possible_dup1_needs_adjudication_closed_2docs_2notes = self.create_individual_with_representations( - [self.program2] - ) - self.possible_dup2_needs_adjudication_closed_2docs_2notes = self.create_individual_with_representations( - [self.program3, self.program2] - ) - self.possible_dup3_needs_adjudication_closed_2docs_2notes = self.create_individual_with_representations( - [self.program2, self.program3] - ) - self.possible_dup4_needs_adjudication_closed_2docs_2notes = self.create_individual_with_representations( - [self.program4] - ) - self.needs_adjudication_closed_2docs_2notes = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_needs_adjudication_closed_2docs_2notes - ) - grievance_ticket = self.needs_adjudication_closed_2docs_2notes.ticket - grievance_ticket.status = GrievanceTicket.STATUS_CLOSED - grievance_ticket.save() - [TicketNoteFactory(ticket=grievance_ticket) for _ in range(2)] - [GrievanceDocumentFactory(grievance_ticket=grievance_ticket) for _ in range(2)] - - self.needs_adjudication_closed_2docs_2notes.possible_duplicates.set( - [ - self.possible_dup1_needs_adjudication_closed_2docs_2notes, - self.possible_dup2_needs_adjudication_closed_2docs_2notes, - self.possible_dup3_needs_adjudication_closed_2docs_2notes, - self.possible_dup4_needs_adjudication_closed_2docs_2notes, - ] - ) - self.needs_adjudication_closed_2docs_2notes.selected_individuals.set( - [ - self.possible_dup3_needs_adjudication_closed_2docs_2notes, - self.possible_dup4_needs_adjudication_closed_2docs_2notes, - ] - ) - - # golden in pr1, possible dup in pr2 - self.golden_rec_no_common_program = self.create_individual_with_representations([self.program1]) - self.possible_dup1_no_common_program = self.create_individual_with_representations([self.program2]) - self.needs_adjudication_no_common_program = TicketNeedsAdjudicationDetailsFactory( - golden_records_individual=self.golden_rec_no_common_program - ) - - self.needs_adjudication_no_common_program.possible_duplicates.set([self.possible_dup1_no_common_program]) - - def create_feedback_closed(self) -> None: - # gt closed, hh in pr1, pr2, ind in pr2, pr1 pr3 - self.household_feedback_closed_2hh_3ind = self.create_household_with_representations( - [self.program1, self.program2] - ) - self.individual_feedback_closed_2hh_3ind = self.create_individual_with_representations( - [self.program2, self.program1, self.program3] - ) - - self.feedback_closed_2hh_3ind = FeedbackFactory( - household_lookup=self.household_feedback_closed_2hh_3ind, - individual_lookup=self.individual_feedback_closed_2hh_3ind, - ) - self.feedback_closed_2hh_3ind.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_2hh_3ind.save() - [FeedbackMessageFactory(feedback=self.feedback_closed_2hh_3ind) for _ in range(2)] - - # gt closed, no hh no ind - self.feedback_closed_no_hh_no_ind = FeedbackFactory() - self.feedback_closed_no_hh_no_ind.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_no_hh_no_ind.save() - - # gt closed, hh in pr1, ind in pr1 - self.household_feedback_closed_1hh_1ind_same_program = self.create_household_with_representations( - [self.program1] - ) - self.individual_feedback_closed_1hh_1ind_same_program = self.create_individual_with_representations( - [self.program1] - ) - self.feedback_closed_1hh_1ind_same_program = FeedbackFactory( - household_lookup=self.household_feedback_closed_1hh_1ind_same_program, - individual_lookup=self.individual_feedback_closed_1hh_1ind_same_program, - ) - self.feedback_closed_1hh_1ind_same_program.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_1hh_1ind_same_program.save() - - # gt closed, hh in pr1, ind in pr2, pr1 - self.household_feedback_closed_1hh_1ind_diff_program_with_repr = self.create_household_with_representations( - [self.program1] - ) - self.individual_feedback_closed_1hh_1ind_diff_program_with_repr = self.create_individual_with_representations( - [self.program2, self.program1] - ) - self.feedback_closed_1hh_1ind_diff_program_with_repr = FeedbackFactory( - household_lookup=self.household_feedback_closed_1hh_1ind_diff_program_with_repr, - individual_lookup=self.individual_feedback_closed_1hh_1ind_diff_program_with_repr, - ) - self.feedback_closed_1hh_1ind_diff_program_with_repr.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_1hh_1ind_diff_program_with_repr.save() - - # gt closed, hh in pr1 - self.household_feedback_closed_only_hh = self.create_household_with_representations([self.program1]) - self.feedback_closed_only_hh = FeedbackFactory( - household_lookup=self.household_feedback_closed_only_hh, - ) - self.feedback_closed_only_hh.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_only_hh.save() - - # gt closed, ind in pr1 - self.individual_feedback_closed_only_ind = self.create_individual_with_representations([self.program1]) - self.feedback_closed_only_ind = FeedbackFactory( - individual_lookup=self.individual_feedback_closed_only_ind, - ) - self.feedback_closed_only_ind.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_only_ind.save() - - # gt closed, hh in pr1, ind in pr2 - self.household_feedback_closed_1hh_1ind_diff_program = self.create_household_with_representations( - [self.program1] - ) - self.individual_feedback_closed_1hh_1ind_diff_program = self.create_individual_with_representations( - [self.program2] - ) - self.feedback_closed_1hh_1ind_diff_program = FeedbackFactory( - household_lookup=self.household_feedback_closed_1hh_1ind_diff_program, - individual_lookup=self.individual_feedback_closed_1hh_1ind_diff_program, - ) - self.feedback_closed_1hh_1ind_diff_program.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_1hh_1ind_diff_program.save() - - def create_feedback_with_program(self) -> None: - # gt closed, hh in pr1, pr3, ind in pr2, pr1 pr3, feedback in pr3 - self.household_feedback_closed_2hh_3ind_in_pr3 = self.create_household_with_representations( - [self.program1, self.program3], - ) - self.individual_feedback_closed_2hh_3ind_in_pr3 = self.create_individual_with_representations( - [self.program2, self.program1, self.program3], - ) - - self.feedback_closed_2hh_3ind_in_pr3 = FeedbackFactory( - household_lookup=self.household_feedback_closed_2hh_3ind_in_pr3, - individual_lookup=self.individual_feedback_closed_2hh_3ind_in_pr3, - program=self.program3, - ) - - self.feedback_closed_2hh_3ind_in_pr3.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_CLOSED, - ) - self.feedback_closed_2hh_3ind_in_pr3.save() - [FeedbackMessageFactory(feedback=self.feedback_closed_2hh_3ind_in_pr3) for _ in range(2)] - - # no gt, hh in pr1 repr pr3, ind in pr2 repr pr1 pr3, feedback in pr3 - self.household_feedback_no_gt_2hh_3ind_in_pr3 = self.create_household_with_representations( - [self.program1, self.program3], - ) - self.individual_feedback_no_gt_2hh_3ind_in_pr3 = self.create_individual_with_representations( - [self.program2, self.program1, self.program3], - ) - - self.feedback_no_gt_2hh_3ind_in_pr3 = FeedbackFactory( - household_lookup=self.household_feedback_no_gt_2hh_3ind_in_pr3, - individual_lookup=self.individual_feedback_no_gt_2hh_3ind_in_pr3, - program=self.program3, - ) - - # gt active , no hh no ind, feedback in pr1 - self.feedback_active_gt_no_hh_no_ind_in_pr1 = FeedbackFactory( - program=self.program1, - ) - self.feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_ASSIGNED, - ) - self.feedback_active_gt_no_hh_no_ind_in_pr1.save() - - # gt active, ind in pr1, pr2, feedback in pr2 - self.individual_feedback_active_only_ind_in_pr2 = self.create_individual_with_representations( - [self.program1, self.program2] - ) - self.feedback_active_only_ind_in_pr2 = FeedbackFactory( - individual_lookup=self.individual_feedback_active_only_ind_in_pr2, - program=self.program2, - ) - self.feedback_active_only_ind_in_pr2.linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_ASSIGNED, - ) - self.feedback_active_only_ind_in_pr2.save() - - # no gt, hh in pr2, ind in pr2 feedback in pr1 - self.household_feedback_no_gt_1hh_1ind_in_pr2 = self.create_household_with_representations([self.program2]) - self.individual_feedback_no_gt_1hh_1ind_in_pr2 = self.create_individual_with_representations([self.program2]) - self.feedback_no_gt_1hh_1ind_in_pr2 = FeedbackFactory( - household_lookup=self.household_feedback_no_gt_1hh_1ind_in_pr2, - individual_lookup=self.individual_feedback_no_gt_1hh_1ind_in_pr2, - program=self.program1, - ) - - def create_feedback_without_program_and_not_closed(self) -> None: - # without GT - # no hh no ind - self.feedback_no_program_no_gt_no_hh_no_ind = FeedbackFactory() - - # GT active, hh in pr1, pr2 pr3, ind in pr2, pr3, 2 docs, 2 notes, 2 messages, linked - self.household_feedback_active_gt_no_program_3hh_2ind = self.create_household_with_representations( - [self.program1, self.program2, self.program3] - ) - self.individual_feedback_active_gt_no_program_3hh_2ind = self.create_individual_with_representations( - [self.program2, self.program3] - ) - self.feedback_active_gt_no_program_3hh_2ind = FeedbackFactory( - household_lookup=self.household_feedback_active_gt_no_program_3hh_2ind, - individual_lookup=self.individual_feedback_active_gt_no_program_3hh_2ind, - ) - linked_grievance = GrievanceTicketFactory( - category=GrievanceTicket.CATEGORY_POSITIVE_FEEDBACK, - issue_type=None, - status=GrievanceTicket.STATUS_ASSIGNED, - ) - self.feedback_active_gt_no_program_3hh_2ind.linked_grievance = linked_grievance - self.feedback_active_gt_no_program_3hh_2ind.save() - [FeedbackMessageFactory(feedback=self.feedback_active_gt_no_program_3hh_2ind) for _ in range(2)] - [TicketNoteFactory(ticket=linked_grievance) for _ in range(2)] - [GrievanceDocumentFactory(grievance_ticket=linked_grievance) for _ in range(2)] - linked_grievance.linked_tickets.add(self.sensitive_ticket_no_payment_not_closed_gt.ticket) - - -class TestMigrateGrievanceTicketsAndFeedbacks(BaseGrievanceTestCase, TestCase): - def perform_test_on_hh_only_tickets(self, objects: tuple, related_name: str) -> None: - for obj in objects: - obj.refresh_from_db() - ( - ticket_closed_no_hh, - ticket_closed_2hh, - ticket_active_no_hh, - ticket_active_1hh, - ticket_active_3hh_2notes_2docs, - ) = objects - - # ticket_closed_no_hh - self.assertEqual(ticket_closed_no_hh.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - void_program = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_ticket_closed_no_hh = getattr( - ticket_closed_no_hh.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - - self.check_closed_ticket(ticket_closed_no_hh, void_program, repr_ticket_closed_no_hh) - - self.assertIsNone(ticket_closed_no_hh.household) - self.assertIsNone(repr_ticket_closed_no_hh.household) - - self.check_grievance_household_unicef_id( - ticket_closed_no_hh.ticket, - None, - ) - self.check_grievance_household_unicef_id( - repr_ticket_closed_no_hh.ticket, - None, - ) - self.check_created_at_equality([ticket_closed_no_hh, repr_ticket_closed_no_hh]) - self.check_tickets_unicef_id_uniqueness([ticket_closed_no_hh, repr_ticket_closed_no_hh]) - - # ticket_closed_2hh - self.assertEqual(ticket_closed_2hh.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - repr_ticket_closed_2hh = getattr( - ticket_closed_2hh.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - program_ticket_closed_2hh = repr_ticket_closed_2hh.ticket.programs(manager="all_objects").first() - self.check_closed_ticket(ticket_closed_2hh, program_ticket_closed_2hh, repr_ticket_closed_2hh) - self.assertEqual( - repr_ticket_closed_2hh.household.program, - program_ticket_closed_2hh, - ) - self.assertEqual( - repr_ticket_closed_2hh.household.copied_from, - ticket_closed_2hh.household, - ) - self.check_created_at_equality([ticket_closed_2hh, repr_ticket_closed_2hh]) - self.check_tickets_unicef_id_uniqueness([ticket_closed_2hh, repr_ticket_closed_2hh]) - - # ticket_active_no_hh - self.assertEqual(ticket_active_no_hh.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - void_program = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_ticket_active_no_hh = getattr( - ticket_active_no_hh.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - self.check_original_ticket(ticket_active_no_hh) - self.check_ticket_representation(repr_ticket_active_no_hh) - - self.assertEqual( - repr_ticket_active_no_hh.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - repr_ticket_active_no_hh.ticket.programs(manager="all_objects").first(), - void_program, - ) - self.assertIsNone(ticket_active_no_hh.household) - self.assertIsNone(repr_ticket_active_no_hh.household) - - self.check_grievance_household_unicef_id( - ticket_active_no_hh.ticket, - None, - ) - self.check_grievance_household_unicef_id( - repr_ticket_active_no_hh.ticket, - None, - ) - self.check_created_at_equality([ticket_active_no_hh, repr_ticket_active_no_hh]) - self.check_tickets_unicef_id_uniqueness([ticket_active_no_hh, repr_ticket_active_no_hh]) - - # ticket_active_1hh - self.assertEqual(ticket_active_1hh.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - repr_ticket_active_1hh = getattr( - ticket_active_1hh.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - self.check_original_ticket(ticket_active_1hh) - self.check_ticket_representation(repr_ticket_active_1hh) - self.assertEqual( - repr_ticket_active_1hh.household.program, - self.program2, - ) - self.assertEqual( - repr_ticket_active_1hh.household.copied_from, - ticket_active_1hh.household, - ) - self.assertEqual( - repr_ticket_active_1hh.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - repr_ticket_active_1hh.ticket.programs(manager="all_objects").first(), - self.program2, - ) - self.check_grievance_household_unicef_id( - repr_ticket_active_1hh.ticket, - repr_ticket_active_1hh.household.unicef_id, - ) - self.check_created_at_equality([ticket_active_1hh, repr_ticket_active_1hh]) - self.check_tickets_unicef_id_uniqueness([ticket_active_1hh, repr_ticket_active_1hh]) - - # ticket_active_3hh_2notes_2docs - self.check_original_ticket(ticket_active_3hh_2notes_2docs) - repr1_ticket_active_3hh_2notes_2docs = getattr( - ticket_active_3hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first(), - related_name, - ) - repr2_ticket_active_3hh_2notes_2docs = getattr( - ticket_active_3hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first(), - related_name, - ) - repr3_ticket_active_3hh_2notes_2docs = getattr( - ticket_active_3hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first(), - related_name, - ) - self.check_ticket_representation(repr1_ticket_active_3hh_2notes_2docs) - self.check_ticket_representation(repr2_ticket_active_3hh_2notes_2docs) - self.check_ticket_representation(repr3_ticket_active_3hh_2notes_2docs) - self.assertEqual( - repr1_ticket_active_3hh_2notes_2docs.household.program, - self.program1, - ) - self.assertEqual( - repr2_ticket_active_3hh_2notes_2docs.household.program, - self.program2, - ) - self.assertEqual( - repr3_ticket_active_3hh_2notes_2docs.household.program, - self.program3, - ) - self.check_grievance_household_unicef_id( - repr1_ticket_active_3hh_2notes_2docs.ticket, - repr1_ticket_active_3hh_2notes_2docs.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_ticket_active_3hh_2notes_2docs.ticket, - repr2_ticket_active_3hh_2notes_2docs.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr3_ticket_active_3hh_2notes_2docs.ticket, - repr3_ticket_active_3hh_2notes_2docs.household.unicef_id, - ) - self.check_created_at_equality( - [ - ticket_active_3hh_2notes_2docs, - repr1_ticket_active_3hh_2notes_2docs, - repr2_ticket_active_3hh_2notes_2docs, - repr3_ticket_active_3hh_2notes_2docs, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - ticket_active_3hh_2notes_2docs, - repr1_ticket_active_3hh_2notes_2docs, - repr2_ticket_active_3hh_2notes_2docs, - repr3_ticket_active_3hh_2notes_2docs, - ] - ) - - self.assertEqual( - ticket_active_3hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - ticket_active_3hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr1_ticket_active_3hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr1_ticket_active_3hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr2_ticket_active_3hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr2_ticket_active_3hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr3_ticket_active_3hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr3_ticket_active_3hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - - def perform_test_on_ind_only_tickets( - self, - model: Any, - objects: tuple, - related_name: str, - individual_field: str = "individual", - is_individual_data_update: bool = False, - ) -> None: - ( - ticket_closed_2ind, - ticket_closed_2ind_reassign_data, - ticket_closed_2ind_other_roles, - ticket_closed_2ind_individual_for_role, - ticket_active_1ind, - ticket_active_1ind_reassign_data, - ticket_active_1ind_other_roles, - ticket_active_1ind_individual_for_role, - ticket_active_3ind_2notes_2docs, - ticket_active_3ind_2notes_2docs_original_role, - ticket_active_3ind_2notes_2docs_other_roles, - ticket_active_3ind_2notes_2docs_individual_for_role, - ) = objects - ticket_closed_2ind.refresh_from_db() - ticket_active_1ind.refresh_from_db() - ticket_active_3ind_2notes_2docs.refresh_from_db() - - # ticket_closed_2ind - self.assertEqual(ticket_closed_2ind.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - repr_ticket_closed_2ind = getattr( - ticket_closed_2ind.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - program_ticket_closed_2ind = repr_ticket_closed_2ind.ticket.programs(manager="all_objects").first() - self.check_closed_ticket(ticket_closed_2ind, program_ticket_closed_2ind, repr_ticket_closed_2ind) - self.assertEqual( - repr_ticket_closed_2ind.individual.program, - program_ticket_closed_2ind, - ) - self.assertEqual( - repr_ticket_closed_2ind.individual.copied_from, - ticket_closed_2ind.individual, - ) - self.check_created_at_equality([ticket_closed_2ind, repr_ticket_closed_2ind]) - self.check_tickets_unicef_id_uniqueness([ticket_closed_2ind, repr_ticket_closed_2ind]) - - self.assertEqual( - repr_ticket_closed_2ind.role_reassign_data, - { - str(ticket_closed_2ind_other_roles[program_ticket_closed_2ind.id].id): { - "household": encode_id_base64( - ticket_closed_2ind_other_roles[program_ticket_closed_2ind.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_closed_2ind_individual_for_role.copied_to(manager="original_and_repr_objects") - .filter(program=program_ticket_closed_2ind) - .first() - .id, - "Individual", - ), - "role": ROLE_PRIMARY, - }, - }, - ) - - self.assertEqual( - ticket_closed_2ind_reassign_data, - ticket_closed_2ind.role_reassign_data, - ) - - if is_individual_data_update: - self.assertEqual( - ticket_closed_2ind.individual_data, self.individual_data_ticket_closed_2ind["individual_data"] - ) - self.assertEqual( - repr_ticket_closed_2ind.individual_data, - self.create_individual_data_dict(repr_ticket_closed_2ind.individual), - ) - - # ticket_active_1ind - self.assertEqual(ticket_active_1ind.ticket.copied_to(manager="default_for_migrations_fix").count(), 1) - repr_ticket_active_1ind = getattr( - ticket_active_1ind.ticket.copied_to(manager="default_for_migrations_fix").first(), related_name - ) - self.check_original_ticket(ticket_active_1ind) - self.check_ticket_representation(repr_ticket_active_1ind) - self.assertEqual( - repr_ticket_active_1ind.individual.program, - self.program2, - ) - self.assertEqual( - repr_ticket_active_1ind.individual.copied_from, - ticket_active_1ind.individual, - ) - self.check_created_at_equality([ticket_active_1ind, repr_ticket_active_1ind]) - self.check_tickets_unicef_id_uniqueness([ticket_active_1ind, repr_ticket_active_1ind]) - - self.assertEqual( - repr_ticket_active_1ind.role_reassign_data, - { - str(ticket_active_1ind_other_roles[self.program2.id].id): { - "household": encode_id_base64( - ticket_active_1ind_other_roles[self.program2.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_1ind_individual_for_role.copied_to(manager="original_and_repr_objects") - .filter(program=self.program2) - .first() - .id, - "Individual", - ), - "role": ROLE_PRIMARY, - }, - }, - ) - - self.assertEqual( - ticket_active_1ind_reassign_data, - ticket_active_1ind.role_reassign_data, - ) - - if is_individual_data_update: - self.assertEqual( - ticket_active_1ind.individual_data, self.individual_data_ticket_active_1ind["individual_data"] - ) - self.assertEqual( - repr_ticket_active_1ind.individual_data, - self.create_individual_data_dict(repr_ticket_active_1ind.individual), - ) - - # ticket_active_3ind_2notes_2docs - self.assertEqual( - ticket_active_3ind_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix").count(), 3 - ) - self.check_original_ticket(ticket_active_3ind_2notes_2docs) - - repr1_ticket_active_3ind_2notes_2docs = getattr( - ticket_active_3ind_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first(), - related_name, - ) - repr2_ticket_active_3ind_2notes_2docs = getattr( - ticket_active_3ind_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first(), - related_name, - ) - repr3_ticket_active_3ind_2notes_2docs = getattr( - ticket_active_3ind_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first(), - related_name, - ) - - self.check_ticket_representation(repr1_ticket_active_3ind_2notes_2docs) - self.assertEqual( - repr1_ticket_active_3ind_2notes_2docs.individual.copied_from, - ticket_active_3ind_2notes_2docs.individual, - ) - self.check_ticket_representation(repr2_ticket_active_3ind_2notes_2docs) - self.assertEqual( - repr2_ticket_active_3ind_2notes_2docs.individual.copied_from, - ticket_active_3ind_2notes_2docs.individual, - ) - self.check_ticket_representation(repr3_ticket_active_3ind_2notes_2docs) - self.assertEqual( - repr3_ticket_active_3ind_2notes_2docs.individual.copied_from, - ticket_active_3ind_2notes_2docs.individual, - ) - - self.check_created_at_equality( - [ - ticket_active_3ind_2notes_2docs, - repr1_ticket_active_3ind_2notes_2docs, - repr2_ticket_active_3ind_2notes_2docs, - repr3_ticket_active_3ind_2notes_2docs, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - ticket_active_3ind_2notes_2docs, - repr1_ticket_active_3ind_2notes_2docs, - repr2_ticket_active_3ind_2notes_2docs, - repr3_ticket_active_3ind_2notes_2docs, - ] - ) - - self.assertEqual( - repr1_ticket_active_3ind_2notes_2docs.role_reassign_data, - { - str(ticket_active_3ind_2notes_2docs_other_roles[self.program1.id].id): { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program1.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program1) - .first() - .id, - "Individual", - ), - "role": ROLE_PRIMARY, - }, - "HEAD": { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program1.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program1) - .first() - .id, - "Individual", - ), - "role": HEAD, - }, - }, - ) - - self.assertEqual( - repr2_ticket_active_3ind_2notes_2docs.role_reassign_data, - { - str(ticket_active_3ind_2notes_2docs_other_roles[self.program2.id].id): { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program2.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program2) - .first() - .id, - "Individual", - ), - "role": ROLE_PRIMARY, - }, - "HEAD": { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program2.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program2) - .first() - .id, - "Individual", - ), - "role": HEAD, - }, - }, - ) - - self.assertEqual( - repr3_ticket_active_3ind_2notes_2docs.role_reassign_data, - { - str(ticket_active_3ind_2notes_2docs_other_roles[self.program3.id].id): { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program3.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program3) - .first() - .id, - "Individual", - ), - "role": ROLE_PRIMARY, - }, - "HEAD": { - "household": encode_id_base64( - ticket_active_3ind_2notes_2docs_other_roles[self.program3.id].household.id, - "Household", - ), - "individual": encode_id_base64( - ticket_active_3ind_2notes_2docs_individual_for_role.copied_to( - manager="original_and_repr_objects" - ) - .filter(program=self.program3) - .first() - .id, - "Individual", - ), - "role": HEAD, - }, - }, - ) - - if is_individual_data_update: - self.assertEqual( - ticket_active_3ind_2notes_2docs.individual_data, - self.individual_data_ticket_active_3ind_2notes_2docs["individual_data"], - ) - self.assertEqual( - repr1_ticket_active_3ind_2notes_2docs.individual_data, - self.create_individual_data_dict(repr1_ticket_active_3ind_2notes_2docs.individual), - ) - self.assertEqual( - repr2_ticket_active_3ind_2notes_2docs.individual_data, - self.create_individual_data_dict(repr2_ticket_active_3ind_2notes_2docs.individual), - ) - self.assertEqual( - repr3_ticket_active_3ind_2notes_2docs.individual_data, - self.create_individual_data_dict(repr3_ticket_active_3ind_2notes_2docs.individual), - ) - - def refresh_objects(self) -> None: - self.complaint_ticket_with_payment.refresh_from_db() - self.complaint_ticket_with_payment_record.refresh_from_db() - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.refresh_from_db() - self.complaint_ticket_no_payment_closed_gt.refresh_from_db() - self.complaint_ticket_no_payment_not_closed_gt.refresh_from_db() - self.complaint_ticket_no_payment_closed_gt_only_hh.refresh_from_db() - self.complaint_ticket_no_payment_only_hh.refresh_from_db() - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.refresh_from_db() - self.sensitive_ticket_with_payment.refresh_from_db() - self.sensitive_ticket_no_payment_closed_gt.refresh_from_db() - self.sensitive_ticket_no_payment_not_closed_gt.refresh_from_db() - self.sensitive_ticket_with_payment_record.refresh_from_db() - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.refresh_from_db() - self.payment_verification_ticket_with_payment_record.refresh_from_db() - self.payment_verification_ticket_with_payment.refresh_from_db() - self.payment_verification_ticket_no_payment_verification.refresh_from_db() - - self.referral_closed_gt_no_hh_no_ind.refresh_from_db() - self.referral_closed_gt_1hh_1ind.refresh_from_db() - self.referral_closed_gt_no_hh_1ind.refresh_from_db() - self.referral_closed_gt_1hh_no_ind.refresh_from_db() - self.referral_active_gt_no_hh_no_ind.refresh_from_db() - self.referral_active_gt_1hh_2notes_2docs.refresh_from_db() - self.referral_active_gt_no_hh_1ind_2repr.refresh_from_db() - self.referral_active_gt_1hh_1ind.refresh_from_db() - - self.needs_adjudication_not_closed.refresh_from_db() - self.needs_adjudication_closed.refresh_from_db() - self.needs_adjudication_closed_2docs_2notes.refresh_from_db() - self.needs_adjudication_no_common_program.refresh_from_db() - - self.feedback_closed_2hh_3ind.refresh_from_db() - self.feedback_closed_no_hh_no_ind.refresh_from_db() - self.feedback_closed_1hh_1ind_same_program.refresh_from_db() - self.feedback_closed_1hh_1ind_diff_program_with_repr.refresh_from_db() - self.feedback_closed_only_hh.refresh_from_db() - self.feedback_closed_only_ind.refresh_from_db() - self.feedback_closed_1hh_1ind_diff_program.refresh_from_db() - self.feedback_closed_2hh_3ind_in_pr3.refresh_from_db() - self.feedback_no_gt_2hh_3ind_in_pr3.refresh_from_db() - self.feedback_active_gt_no_hh_no_ind_in_pr1.refresh_from_db() - self.feedback_active_only_ind_in_pr2.refresh_from_db() - self.feedback_no_gt_1hh_1ind_in_pr2.refresh_from_db() - self.feedback_active_gt_no_program_3hh_2ind.refresh_from_db() - self.feedback_no_program_no_gt_no_hh_no_ind.refresh_from_db() - - self.message_tp.refresh_from_db() - self.message_no_tp.refresh_from_db() - self.message_no_tp_no_hh.refresh_from_db() - - def _test_ticket_complaint_details(self) -> None: - # Test complaint_ticket_no_payment_no_hh_no_ind_closed_gt - program_complaint_ticket_no_payment_no_hh_no_ind_closed_gt = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_complaint_ticket_no_payment_no_hh_no_ind_closed_gt = ( - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.ticket.copied_to( - manager="default_for_migrations_fix" - ) - .first() - .complaint_ticket_details - ) - - self.check_closed_ticket( - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt, - program_complaint_ticket_no_payment_no_hh_no_ind_closed_gt, - repr_complaint_ticket_no_payment_no_hh_no_ind_closed_gt, - ) - - self.assertEqual( - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.household, - None, - ) - self.assertEqual( - self.complaint_ticket_no_payment_no_hh_no_ind_closed_gt.individual, - None, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_no_hh_no_ind_closed_gt.household, - None, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_no_hh_no_ind_closed_gt.individual, - None, - ) - self.check_grievance_household_unicef_id( - repr_complaint_ticket_no_payment_no_hh_no_ind_closed_gt.ticket, - None, - ) - - # Test complaint_ticket_no_payment_closed_gt - repr_complaint_ticket_no_payment_closed_gt = ( - self.complaint_ticket_no_payment_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .complaint_ticket_details - ) - - self.check_closed_ticket( - self.complaint_ticket_no_payment_closed_gt, self.program1, repr_complaint_ticket_no_payment_closed_gt - ) - - self.assertEqual( - self.complaint_ticket_no_payment_closed_gt.individual, - self.individual_complaint_ticket_no_payment_closed_gt, - ) - self.assertEqual( - self.complaint_ticket_no_payment_closed_gt.household, - self.household_complaint_ticket_no_payment_closed_gt, - ) - - self.assertEqual( - repr_complaint_ticket_no_payment_closed_gt.household.program, - self.program1, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_closed_gt.individual.program, - self.program1, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_closed_gt.individual.copied_from, - self.individual_complaint_ticket_no_payment_closed_gt, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_closed_gt.household.copied_from, - self.household_complaint_ticket_no_payment_closed_gt, - ) - self.check_grievance_household_unicef_id( - repr_complaint_ticket_no_payment_closed_gt.ticket, - repr_complaint_ticket_no_payment_closed_gt.household.unicef_id, - ) - - # Test complaint_ticket_no_payment_closed_gt_only_hh - repr_complaint_ticket_no_payment_closed_gt_only_hh = ( - self.complaint_ticket_no_payment_closed_gt_only_hh.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .complaint_ticket_details - ) - - self.check_closed_ticket( - self.complaint_ticket_no_payment_closed_gt_only_hh, - repr_complaint_ticket_no_payment_closed_gt_only_hh.household.program, - repr_complaint_ticket_no_payment_closed_gt_only_hh, - ) - - self.assertEqual( - self.complaint_ticket_no_payment_closed_gt_only_hh.household, - self.household_complaint_ticket_no_payment_closed_gt_only_hh, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_closed_gt_only_hh.household.copied_from, - self.household_complaint_ticket_no_payment_closed_gt_only_hh, - ) - self.check_grievance_household_unicef_id( - repr_complaint_ticket_no_payment_closed_gt_only_hh.ticket, - repr_complaint_ticket_no_payment_closed_gt_only_hh.household.unicef_id, - ) - - # Test complaint_ticket_no_payment_only_hh - self.check_original_ticket(self.complaint_ticket_no_payment_only_hh) - repr1_complaint_ticket_no_payment_only_hh = ( - self.complaint_ticket_no_payment_only_hh.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .complaint_ticket_details - ) - repr2_complaint_ticket_no_payment_only_hh = ( - self.complaint_ticket_no_payment_only_hh.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .complaint_ticket_details - ) - self.check_ticket_representation(repr1_complaint_ticket_no_payment_only_hh) - self.check_ticket_representation(repr2_complaint_ticket_no_payment_only_hh) - self.assertEqual( - repr1_complaint_ticket_no_payment_only_hh.household.program, - self.program1, - ) - self.assertEqual( - repr2_complaint_ticket_no_payment_only_hh.household.program, - self.program2, - ) - self.check_grievance_household_unicef_id( - repr1_complaint_ticket_no_payment_only_hh.ticket, - repr1_complaint_ticket_no_payment_only_hh.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_complaint_ticket_no_payment_only_hh.ticket, - repr2_complaint_ticket_no_payment_only_hh.household.unicef_id, - ) - - self.check_created_at_equality( - [ - repr1_complaint_ticket_no_payment_only_hh, - repr2_complaint_ticket_no_payment_only_hh, - self.complaint_ticket_no_payment_only_hh, - ] - ) - - self.check_tickets_unicef_id_uniqueness( - [ - repr1_complaint_ticket_no_payment_only_hh, - repr2_complaint_ticket_no_payment_only_hh, - self.complaint_ticket_no_payment_only_hh, - ] - ) - - # Test complaint_ticket_no_payment_not_closed_gt - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 3, - ) - repr1_complaint_ticket_no_payment_not_closed_gt = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .complaint_ticket_details - ) - repr2_complaint_ticket_no_payment_not_closed_gt = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .complaint_ticket_details - ) - repr3_complaint_ticket_no_payment_not_closed_gt = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - .complaint_ticket_details - ) - self.check_original_ticket(self.complaint_ticket_no_payment_not_closed_gt) - self.check_ticket_representation(repr1_complaint_ticket_no_payment_not_closed_gt) - self.check_ticket_representation(repr2_complaint_ticket_no_payment_not_closed_gt) - self.check_ticket_representation(repr3_complaint_ticket_no_payment_not_closed_gt) - - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt.household, - self.household_complaint_ticket_no_payment_not_closed_gt, - ) - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt.individual, - self.individual_complaint_ticket_no_payment_not_closed_gt, - ) - - self.assertEqual( - repr1_complaint_ticket_no_payment_not_closed_gt.household, - self.household_complaint_ticket_no_payment_not_closed_gt.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ) - self.assertEqual( - repr1_complaint_ticket_no_payment_not_closed_gt.individual, - self.individual_complaint_ticket_no_payment_not_closed_gt.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program1), - ) - - self.assertEqual( - repr2_complaint_ticket_no_payment_not_closed_gt.household, - self.household_complaint_ticket_no_payment_not_closed_gt.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ) - self.assertEqual( - repr2_complaint_ticket_no_payment_not_closed_gt.individual, - self.individual_complaint_ticket_no_payment_not_closed_gt.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ) - - self.assertEqual( - repr3_complaint_ticket_no_payment_not_closed_gt.household, - None, - ) - self.assertEqual( - repr3_complaint_ticket_no_payment_not_closed_gt.individual, - self.individual_complaint_ticket_no_payment_not_closed_gt.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - ) - - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr1_complaint_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - repr1_complaint_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr2_complaint_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - repr2_complaint_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr3_complaint_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - repr3_complaint_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 2, - ) - self.check_grievance_household_unicef_id( - repr1_complaint_ticket_no_payment_not_closed_gt.ticket, - repr1_complaint_ticket_no_payment_not_closed_gt.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_complaint_ticket_no_payment_not_closed_gt.ticket, - repr2_complaint_ticket_no_payment_not_closed_gt.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr3_complaint_ticket_no_payment_not_closed_gt.ticket, - None, - ) - - self.check_created_at_equality( - [ - repr1_complaint_ticket_no_payment_not_closed_gt, - repr2_complaint_ticket_no_payment_not_closed_gt, - repr3_complaint_ticket_no_payment_not_closed_gt, - self.complaint_ticket_no_payment_not_closed_gt, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_complaint_ticket_no_payment_not_closed_gt, - repr2_complaint_ticket_no_payment_not_closed_gt, - repr3_complaint_ticket_no_payment_not_closed_gt, - self.complaint_ticket_no_payment_not_closed_gt, - ] - ) - - # Test TicketComplaintDetails complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - program_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind = ( - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.copied_to( - manager="default_for_migrations_fix" - ) - .first() - .complaint_ticket_details - ) - - self.check_original_ticket(self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind) - self.check_ticket_representation(repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind) - - self.assertEqual( - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.programs(manager="all_objects").first(), - program_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind, - ) - - self.assertIsNone(self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.household) - self.assertIsNone(self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.individual) - self.assertIsNone(repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.household) - self.assertIsNone(repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.individual) - - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.ticket_notes.count(), - 1, - ) - self.assertEqual( - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.support_documents.count(), - 1, - ) - self.assertEqual( - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket.support_documents.count(), - 1, - ) - self.check_grievance_household_unicef_id( - self.complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket, - None, - ) - - self.check_grievance_household_unicef_id( - repr_complaint_ticket_no_payment_not_closed_gt_no_hh_no_ind.ticket, - None, - ) - - def _test_ticket_sensitive_details(self) -> None: - # Test TicketSensitiveDetails sensitive_ticket_no_payment_closed_gt - repr_sensitive_ticket_no_payment_closed_gt = ( - self.sensitive_ticket_no_payment_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .sensitive_ticket_details - ) - self.check_closed_ticket( - self.sensitive_ticket_no_payment_closed_gt, self.program1, repr_sensitive_ticket_no_payment_closed_gt - ) - - self.assertEqual( - self.sensitive_ticket_no_payment_closed_gt.household, - None, - ) - self.assertEqual( - repr_sensitive_ticket_no_payment_closed_gt.household, - None, - ) - self.assertEqual( - repr_sensitive_ticket_no_payment_closed_gt.individual.copied_from, - self.sensitive_ticket_no_payment_closed_gt.individual, - ) - self.check_grievance_household_unicef_id( - repr_sensitive_ticket_no_payment_closed_gt.ticket, - None, - ) - - # Test TicketSensitiveDetails sensitive_ticket_no_payment_not_closed_gt - self.check_original_ticket(self.sensitive_ticket_no_payment_not_closed_gt) - repr1_sensitive_ticket_no_payment_not_closed_gt = ( - self.sensitive_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .sensitive_ticket_details - ) - repr2_sensitive_ticket_no_payment_not_closed_gt = ( - self.sensitive_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .sensitive_ticket_details - ) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_gt.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 2, - ) - self.check_ticket_representation(repr1_sensitive_ticket_no_payment_not_closed_gt) - self.check_ticket_representation(repr2_sensitive_ticket_no_payment_not_closed_gt) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_gt.household, - None, - ) - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_gt.individual, - self.individual_sensitive_ticket_no_payment_not_closed_gt, - ) - - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_gt.household, - None, - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_gt.individual, - self.individual_sensitive_ticket_no_payment_not_closed_gt.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program1), - ) - - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_gt.household, - None, - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_gt.individual, - self.individual_sensitive_ticket_no_payment_not_closed_gt.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 1, - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 1, - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket.support_documents.count(), - 1, - ) - self.check_grievance_household_unicef_id( - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket, - None, - ) - self.check_grievance_household_unicef_id( - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket, - None, - ) - - self.check_created_at_equality( - [ - repr1_sensitive_ticket_no_payment_not_closed_gt, - repr2_sensitive_ticket_no_payment_not_closed_gt, - self.sensitive_ticket_no_payment_not_closed_gt, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_sensitive_ticket_no_payment_not_closed_gt, - repr2_sensitive_ticket_no_payment_not_closed_gt, - self.sensitive_ticket_no_payment_not_closed_gt, - ] - ) - - # Test linked tickets - repr1_complaint_ticket_no_payment_not_closed_gt_ticket = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - ) - repr2_complaint_ticket_no_payment_not_closed_gt_ticket = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - ) - repr3_complaint_ticket_no_payment_not_closed_gt_ticket = ( - self.complaint_ticket_no_payment_not_closed_gt.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - ) - repr1_feedback_active_gt_no_program_3hh_2ind_ticket = ( - self.feedback_active_gt_no_program_3hh_2ind.linked_grievance.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - ) - repr2_feedback_active_gt_no_program_3hh_2ind_ticket = ( - self.feedback_active_gt_no_program_3hh_2ind.linked_grievance.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - ) - repr3_feedback_active_gt_no_program_3hh_2ind_ticket = ( - self.feedback_active_gt_no_program_3hh_2ind.linked_grievance.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - ) - self.assertIn( - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket, - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket, - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - - for sensitive_ticket in [ - repr1_sensitive_ticket_no_payment_not_closed_gt.ticket, - repr2_sensitive_ticket_no_payment_not_closed_gt.ticket, - ]: - self.assertIn( - repr1_feedback_active_gt_no_program_3hh_2ind_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr1_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr2_feedback_active_gt_no_program_3hh_2ind_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr2_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr3_feedback_active_gt_no_program_3hh_2ind_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr3_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr1_complaint_ticket_no_payment_not_closed_gt_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr1_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr2_complaint_ticket_no_payment_not_closed_gt_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr2_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertIn( - repr3_complaint_ticket_no_payment_not_closed_gt_ticket, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - repr3_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).all(), - ) - self.assertEqual( - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").count(), - 10, - ) # 1x other repr of sensitive_ticket_no_payment_not_closed_gt, 3x repr of feedback_active_gt_no_program_3hh_2ind, 3x repr of complaint_ticket_no_payment_not_closed_gt, 3x needs_adjudication_not_closed - for needs_adjudication_linked in [ - self.needs_adjudication_not_closed.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first(), - self.needs_adjudication_not_closed.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first(), - self.needs_adjudication_not_closed.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first(), - ]: - self.assertIn( - needs_adjudication_linked, - sensitive_ticket.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertIn( - sensitive_ticket, - needs_adjudication_linked.linked_tickets(manager="default_for_migrations_fix").all(), - ) - self.assertEqual( - needs_adjudication_linked.linked_tickets(manager="default_for_migrations_fix").count(), 4 - ) # 2x other repr of needs_adjudication_not_closed, 2x repr of sensitive_ticket_no_payment_not_closed_gt - - self.assertEqual( - repr1_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of feedback_active_gt_no_program_3hh_2ind, 2x repr of sensitive_ticket_no_payment_not_closed_gt - self.assertEqual( - repr2_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of feedback_active_gt_no_program_3hh_2ind, 2x repr of sensitive_ticket_no_payment_not_closed_gt - self.assertEqual( - repr3_feedback_active_gt_no_program_3hh_2ind_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of feedback_active_gt_no_program_3hh_2ind, 2x repr of sensitive_ticket_no_payment_not_closed_gt - self.assertEqual( - repr1_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of complaint_ticket_no_payment_not_closed_gt, 2x repr of sensitive_ticket_no_payment_not_closed_gt - self.assertEqual( - repr2_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of complaint_ticket_no_payment_not_closed_gt, 2x repr of sensitive_ticket_no_payment_not_closed_gt - self.assertEqual( - repr3_complaint_ticket_no_payment_not_closed_gt_ticket.linked_tickets( - manager="default_for_migrations_fix" - ).count(), - 4, - ) # 2x other repr of complaint_ticket_no_payment_not_closed_gt, 2x repr of sensitive_ticket_no_payment_not_closed_gt - # Test sensitive_ticket_no_payment_not_closed_3hh_2ind - self.check_original_ticket(self.sensitive_ticket_no_payment_not_closed_3hh_2ind) - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind = ( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .sensitive_ticket_details - ) - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind = ( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .sensitive_ticket_details - ) - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind = ( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - .sensitive_ticket_details - ) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 3, - ) - self.check_ticket_representation(repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind) - self.check_ticket_representation(repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind) - self.check_ticket_representation(repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.household, - self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind, - ) - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.individual, - self.individual_sensitive_ticket_no_payment_not_closed_3hh_2ind, - ) - - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.household, - self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program1), - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.individual, - None, - ) - - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.household, - self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.individual, - self.individual_sensitive_ticket_no_payment_not_closed_3hh_2ind.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ) - self.assertEqual( - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.household, - self.household_sensitive_ticket_no_payment_not_closed_3hh_2ind.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - ) - self.assertEqual( - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.individual, - self.individual_sensitive_ticket_no_payment_not_closed_3hh_2ind.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - ) - - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - self.sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket.support_documents.count(), - 2, - ) - self.check_grievance_household_unicef_id( - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket, - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket, - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.ticket, - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind.household.unicef_id, - ) - - self.check_created_at_equality( - [ - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind, - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind, - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind, - self.sensitive_ticket_no_payment_not_closed_3hh_2ind, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_sensitive_ticket_no_payment_not_closed_3hh_2ind, - repr2_sensitive_ticket_no_payment_not_closed_3hh_2ind, - repr3_sensitive_ticket_no_payment_not_closed_3hh_2ind, - self.sensitive_ticket_no_payment_not_closed_3hh_2ind, - ] - ) - - def _test_ticket_payment_verification_details(self) -> None: - # Test payment_verification_ticket_no_payment_verification - self.assertEqual( - self.payment_verification_ticket_no_payment_verification.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - program_payment_verification_ticket_no_payment_verification = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_payment_verification_ticket_no_payment_verification = ( - self.payment_verification_ticket_no_payment_verification.ticket.copied_to( - manager="default_for_migrations_fix" - ) - .first() - .payment_verification_ticket_details - ) - - self.check_original_ticket(self.payment_verification_ticket_no_payment_verification) - self.check_ticket_representation(repr_payment_verification_ticket_no_payment_verification) - - self.assertEqual( - repr_payment_verification_ticket_no_payment_verification.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - repr_payment_verification_ticket_no_payment_verification.ticket.programs(manager="all_objects").first(), - program_payment_verification_ticket_no_payment_verification, - ) - - self.assertIsNone(self.payment_verification_ticket_no_payment_verification.household) - self.assertIsNone(self.payment_verification_ticket_no_payment_verification.individual) - self.assertIsNone(repr_payment_verification_ticket_no_payment_verification.household) - self.assertIsNone(repr_payment_verification_ticket_no_payment_verification.individual) - - self.check_grievance_household_unicef_id( - self.payment_verification_ticket_no_payment_verification.ticket, - None, - ) - - self.check_grievance_household_unicef_id( - repr_payment_verification_ticket_no_payment_verification.ticket, - None, - ) - - def _test_ticket_add_individual_details(self) -> None: - self.perform_test_on_hh_only_tickets(self.tickets_add_ind, "add_individual_ticket_details") - - def _test_ticket_delete_household_details(self) -> None: - self.perform_test_on_hh_only_tickets(self.tickets_delete_hh, "delete_household_ticket_details") - - def _test_ticket_update_household_details(self) -> None: - self.perform_test_on_hh_only_tickets(self.tickets_update_hh, "household_data_update_ticket_details") - - def _test_ticket_upd_individual_details(self) -> None: - self.perform_test_on_ind_only_tickets( - TicketIndividualDataUpdateDetails, - self.tickets_upd_ind_data, - "individual_data_update_ticket_details", - is_individual_data_update=True, - ) - - def _test_ticket_delete_individual_details(self) -> None: - self.perform_test_on_ind_only_tickets( - TicketDeleteIndividualDetails, self.tickets_delete_ind, "delete_individual_ticket_details" - ) - - def _test_ticket_system_flagging_details(self) -> None: - self.perform_test_on_ind_only_tickets( - TicketSystemFlaggingDetails, - self.tickets_sys_flagging, - "system_flagging_ticket_details", - individual_field="golden_records_individual", - ) - - def _test_message(self) -> None: - # self.message_tp - self.assertEqual(self.message_tp.is_original, True) - self.assertEqual(self.message_tp.is_migration_handled, True) - self.assertEqual(self.message_tp.copied_to(manager="original_and_repr_objects").count(), 1) - repr_message_tp = self.message_tp.copied_to(manager="original_and_repr_objects").first() - self.assertEqual(repr_message_tp.households(manager="original_and_repr_objects").count(), 3) - for hh in repr_message_tp.households(manager="original_and_repr_objects").all(): - self.assertEqual(hh.program, self.program1) - self.assertEqual(repr_message_tp.program, self.program1) - self.assertEqual(repr_message_tp.copied_from, self.message_tp) - - # self.message_no_tp - self.assertEqual(self.message_no_tp.is_original, True) - self.assertEqual(self.message_no_tp.is_migration_handled, True) - self.assertEqual(self.message_no_tp.copied_to(manager="original_and_repr_objects").count(), 3) - repr1_message_no_tp = ( - self.message_no_tp.copied_to(manager="original_and_repr_objects").filter(program=self.program1).first() - ) - repr2_message_no_tp = ( - self.message_no_tp.copied_to(manager="original_and_repr_objects").filter(program=self.program2).first() - ) - repr3_message_no_tp = ( - self.message_no_tp.copied_to(manager="original_and_repr_objects").filter(program=self.program3).first() - ) - - self.assertEqual(repr1_message_no_tp.households(manager="original_and_repr_objects").count(), 3) - for hh in repr1_message_no_tp.households(manager="original_and_repr_objects").all(): - self.assertEqual(hh.program, self.program1) - self.assertEqual(repr1_message_no_tp.program, self.program1) - self.assertEqual(repr1_message_no_tp.copied_from, self.message_no_tp) - - self.assertEqual(repr2_message_no_tp.households(manager="original_and_repr_objects").count(), 3) - for hh in repr2_message_no_tp.households(manager="original_and_repr_objects").all(): - self.assertEqual(hh.program, self.program2) - self.assertEqual(repr2_message_no_tp.program, self.program2) - self.assertEqual(repr2_message_no_tp.copied_from, self.message_no_tp) - - self.assertEqual(repr3_message_no_tp.households(manager="original_and_repr_objects").count(), 1) - for hh in repr3_message_no_tp.households(manager="original_and_repr_objects").all(): - self.assertEqual(hh.program, self.program3) - self.assertEqual(repr3_message_no_tp.program, self.program3) - self.assertEqual(repr3_message_no_tp.copied_from, self.message_no_tp) - - assert ( - repr1_message_no_tp.created_at - == repr2_message_no_tp.created_at - == repr3_message_no_tp.created_at - == self.message_no_tp.created_at - ) - self.assertNotEqual(repr1_message_no_tp.unicef_id, repr2_message_no_tp.unicef_id) - self.assertNotEqual(repr2_message_no_tp.unicef_id, repr3_message_no_tp.unicef_id) - self.assertNotEqual(repr3_message_no_tp.unicef_id, self.message_no_tp.unicef_id) - self.assertNotEqual(repr1_message_no_tp.unicef_id, repr3_message_no_tp.unicef_id) - - # self.message_no_tp_no_hh - self.assertEqual(self.message_no_tp_no_hh.is_original, True) - self.assertEqual(self.message_no_tp_no_hh.is_migration_handled, True) - self.assertEqual(self.message_no_tp_no_hh.copied_to(manager="original_and_repr_objects").count(), 1) - - repr_message_no_tp_no_hh = self.message_no_tp_no_hh.copied_to(manager="original_and_repr_objects").first() - self.assertEqual( - repr_message_no_tp_no_hh.program.name, "Storage Program For Non-Program Grievance And Accountability" - ) - self.assertIsNone(repr_message_no_tp_no_hh.households(manager="original_and_repr_objects").first()) - - def _test_ticket_referral_details(self) -> None: - # Test referral_closed_gt_no_hh_no_ind - program_referral_closed_gt_no_hh_no_ind = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_referral_closed_gt_no_hh_no_ind = ( - self.referral_closed_gt_no_hh_no_ind.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .referral_ticket_details - ) - - self.check_closed_ticket( - self.referral_closed_gt_no_hh_no_ind, - program_referral_closed_gt_no_hh_no_ind, - repr_referral_closed_gt_no_hh_no_ind, - ) - - self.assertEqual( - self.referral_closed_gt_no_hh_no_ind.household, - None, - ) - self.assertEqual( - self.referral_closed_gt_no_hh_no_ind.individual, - None, - ) - self.assertEqual( - repr_referral_closed_gt_no_hh_no_ind.household, - None, - ) - self.assertEqual( - repr_referral_closed_gt_no_hh_no_ind.individual, - None, - ) - self.check_grievance_household_unicef_id( - repr_referral_closed_gt_no_hh_no_ind.ticket, - None, - ) - - # Test referral_closed_gt_1hh_1ind - repr_referral_closed_gt_1hh_1ind = ( - self.referral_closed_gt_1hh_1ind.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .referral_ticket_details - ) - - program_repr_referral_closed_gt_1hh_1ind = repr_referral_closed_gt_1hh_1ind.ticket.programs( - manager="all_objects" - ).first() - self.check_closed_ticket( - self.referral_closed_gt_1hh_1ind, - program_repr_referral_closed_gt_1hh_1ind, - repr_referral_closed_gt_1hh_1ind, - ) - - self.assertEqual( - self.referral_closed_gt_1hh_1ind.individual, - self.individual_referral_closed_gt_1hh_1ind, - ) - self.assertEqual( - self.referral_closed_gt_1hh_1ind.household, - self.household_referral_closed_gt_1hh_1ind, - ) - - self.assertEqual( - repr_referral_closed_gt_1hh_1ind.household.program, - program_repr_referral_closed_gt_1hh_1ind, - ) - self.assertEqual( - repr_referral_closed_gt_1hh_1ind.individual.program, - program_repr_referral_closed_gt_1hh_1ind, - ) - self.assertEqual( - repr_referral_closed_gt_1hh_1ind.individual.copied_from, - self.individual_referral_closed_gt_1hh_1ind, - ) - self.assertEqual( - repr_referral_closed_gt_1hh_1ind.household.copied_from, - self.household_referral_closed_gt_1hh_1ind, - ) - self.check_grievance_household_unicef_id( - repr_referral_closed_gt_1hh_1ind.ticket, - repr_referral_closed_gt_1hh_1ind.household.unicef_id, - ) - - # Test referral_closed_gt_no_hh_1ind - repr_referral_closed_gt_no_hh_1ind = ( - self.referral_closed_gt_no_hh_1ind.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .referral_ticket_details - ) - - self.check_closed_ticket( - self.referral_closed_gt_no_hh_1ind, - self.program2, - repr_referral_closed_gt_no_hh_1ind, - ) - - self.assertEqual( - self.referral_closed_gt_no_hh_1ind.individual, - self.individual_referral_closed_gt_no_hh_1ind, - ) - self.assertEqual( - self.referral_closed_gt_no_hh_1ind.household, - None, - ) - - # Test referral_closed_gt_1hh_no_ind - repr_referral_closed_gt_1hh_no_ind = ( - self.referral_closed_gt_1hh_no_ind.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .referral_ticket_details - ) - - self.check_closed_ticket( - self.referral_closed_gt_1hh_no_ind, - self.program3, - repr_referral_closed_gt_1hh_no_ind, - ) - - self.assertEqual( - self.referral_closed_gt_1hh_no_ind.individual, - None, - ) - self.assertEqual( - self.referral_closed_gt_1hh_no_ind.household, - self.household_referral_closed_gt_1hh_no_ind, - ) - - self.assertEqual( - repr_referral_closed_gt_1hh_no_ind.household.program, - self.program3, - ) - self.assertEqual( - repr_referral_closed_gt_1hh_no_ind.household.copied_from, - self.household_referral_closed_gt_1hh_no_ind, - ) - self.check_grievance_household_unicef_id( - repr_referral_closed_gt_1hh_no_ind.ticket, - repr_referral_closed_gt_1hh_no_ind.household.unicef_id, - ) - - # Test referral_active_gt_no_hh_no_ind - self.assertEqual( - self.referral_active_gt_no_hh_no_ind.ticket.copied_to(manager="default_for_migrations_fix").count(), 1 - ) - program_referral_active_gt_no_hh_no_ind = Program.all_objects.filter( - name="Storage Program For Non-Program Grievance And Accountability", business_area=self.business_area - ).first() - repr_referral_active_gt_no_hh_no_ind = ( - self.referral_active_gt_no_hh_no_ind.ticket.copied_to(manager="default_for_migrations_fix") - .first() - .referral_ticket_details - ) - - self.check_original_ticket(self.referral_active_gt_no_hh_no_ind) - self.check_ticket_representation(repr_referral_active_gt_no_hh_no_ind) - - self.assertEqual( - repr_referral_active_gt_no_hh_no_ind.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - repr_referral_active_gt_no_hh_no_ind.ticket.programs(manager="all_objects").first(), - program_referral_active_gt_no_hh_no_ind, - ) - - self.assertIsNone(self.referral_active_gt_no_hh_no_ind.household) - self.assertIsNone(self.referral_active_gt_no_hh_no_ind.individual) - self.assertIsNone(repr_referral_active_gt_no_hh_no_ind.household) - self.assertIsNone(repr_referral_active_gt_no_hh_no_ind.individual) - - self.check_grievance_household_unicef_id( - self.referral_active_gt_no_hh_no_ind.ticket, - None, - ) - - self.check_grievance_household_unicef_id( - repr_referral_active_gt_no_hh_no_ind.ticket, - None, - ) - - # Test referral_active_gt_1hh_2notes_2docs - self.check_original_ticket(self.referral_active_gt_1hh_2notes_2docs) - repr1_referral_active_gt_1hh_2notes_2docs = ( - self.referral_active_gt_1hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .referral_ticket_details - ) - repr2_referral_active_gt_1hh_2notes_2docs = ( - self.referral_active_gt_1hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .referral_ticket_details - ) - - self.assertEqual( - self.referral_active_gt_1hh_2notes_2docs.ticket.copied_to(manager="default_for_migrations_fix").count(), 2 - ) - self.check_ticket_representation(repr1_referral_active_gt_1hh_2notes_2docs) - self.check_ticket_representation(repr2_referral_active_gt_1hh_2notes_2docs) - - self.assertEqual( - self.referral_active_gt_1hh_2notes_2docs.household, - self.household_referral_active_gt_1hh_2notes_2docs, - ) - self.assertEqual( - self.referral_active_gt_1hh_2notes_2docs.individual, - None, - ) - - self.assertEqual( - repr1_referral_active_gt_1hh_2notes_2docs.individual, - None, - ) - self.assertEqual( - repr1_referral_active_gt_1hh_2notes_2docs.household, - self.household_referral_active_gt_1hh_2notes_2docs.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ) - - self.assertEqual( - repr2_referral_active_gt_1hh_2notes_2docs.individual, - None, - ) - self.assertEqual( - repr2_referral_active_gt_1hh_2notes_2docs.household, - self.household_referral_active_gt_1hh_2notes_2docs.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ) - - self.assertEqual( - self.referral_active_gt_1hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - self.referral_active_gt_1hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr1_referral_active_gt_1hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr1_referral_active_gt_1hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.assertEqual( - repr2_referral_active_gt_1hh_2notes_2docs.ticket.ticket_notes.count(), - 2, - ) - self.assertEqual( - repr2_referral_active_gt_1hh_2notes_2docs.ticket.support_documents.count(), - 2, - ) - self.check_grievance_household_unicef_id( - repr1_referral_active_gt_1hh_2notes_2docs.ticket, - repr1_referral_active_gt_1hh_2notes_2docs.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_referral_active_gt_1hh_2notes_2docs.ticket, - repr2_referral_active_gt_1hh_2notes_2docs.household.unicef_id, - ) - - self.check_created_at_equality( - [ - repr1_referral_active_gt_1hh_2notes_2docs, - repr2_referral_active_gt_1hh_2notes_2docs, - self.referral_active_gt_1hh_2notes_2docs, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_referral_active_gt_1hh_2notes_2docs, - repr2_referral_active_gt_1hh_2notes_2docs, - self.referral_active_gt_1hh_2notes_2docs, - ] - ) - - # Test referral_active_gt_no_hh_1ind_2repr - self.check_original_ticket(self.referral_active_gt_no_hh_1ind_2repr) - repr1_referral_active_gt_no_hh_1ind_2repr = ( - self.referral_active_gt_no_hh_1ind_2repr.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .referral_ticket_details - ) - repr2_referral_active_gt_no_hh_1ind_2repr = ( - self.referral_active_gt_no_hh_1ind_2repr.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - .referral_ticket_details - ) - - self.assertEqual( - self.referral_active_gt_no_hh_1ind_2repr.ticket.copied_to(manager="default_for_migrations_fix").count(), 2 - ) - self.check_ticket_representation(repr1_referral_active_gt_no_hh_1ind_2repr) - self.check_ticket_representation(repr2_referral_active_gt_no_hh_1ind_2repr) - - self.assertEqual( - self.referral_active_gt_no_hh_1ind_2repr.individual, - self.individual_referral_active_gt_no_hh_1ind_2repr, - ) - self.assertEqual( - self.referral_active_gt_no_hh_1ind_2repr.household, - None, - ) - - self.assertEqual( - repr1_referral_active_gt_no_hh_1ind_2repr.individual, - self.individual_referral_active_gt_no_hh_1ind_2repr.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ) - self.assertEqual( - repr1_referral_active_gt_no_hh_1ind_2repr.household, - None, - ) - - self.assertEqual( - repr2_referral_active_gt_no_hh_1ind_2repr.individual, - self.individual_referral_active_gt_no_hh_1ind_2repr.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ) - self.assertEqual( - repr2_referral_active_gt_no_hh_1ind_2repr.household, - None, - ) - - self.check_grievance_household_unicef_id( - repr1_referral_active_gt_no_hh_1ind_2repr.ticket, - None, - ) - self.check_grievance_household_unicef_id( - repr2_referral_active_gt_no_hh_1ind_2repr.ticket, - None, - ) - - self.check_created_at_equality( - [ - repr1_referral_active_gt_no_hh_1ind_2repr, - repr2_referral_active_gt_no_hh_1ind_2repr, - self.referral_active_gt_no_hh_1ind_2repr, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_referral_active_gt_no_hh_1ind_2repr, - repr2_referral_active_gt_no_hh_1ind_2repr, - self.referral_active_gt_no_hh_1ind_2repr, - ] - ) - - # Test referral_active_gt_1hh_1ind - self.check_original_ticket(self.referral_active_gt_1hh_1ind) - repr1_referral_active_gt_1hh_1ind = ( - self.referral_active_gt_1hh_1ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program1]) - .first() - .referral_ticket_details - ) - repr2_referral_active_gt_1hh_1ind = ( - self.referral_active_gt_1hh_1ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program2]) - .first() - .referral_ticket_details - ) - repr3_referral_active_gt_1hh_1ind = ( - self.referral_active_gt_1hh_1ind.ticket.copied_to(manager="default_for_migrations_fix") - .filter(programs__in=[self.program3]) - .first() - .referral_ticket_details - ) - - self.assertEqual( - self.referral_active_gt_1hh_1ind.ticket.copied_to(manager="default_for_migrations_fix").count(), 3 - ) - self.check_ticket_representation(repr1_referral_active_gt_1hh_1ind) - self.check_ticket_representation(repr2_referral_active_gt_1hh_1ind) - self.check_ticket_representation(repr3_referral_active_gt_1hh_1ind) - - self.assertEqual( - self.referral_active_gt_1hh_1ind.individual, - self.individual_referral_active_gt_1hh_1ind, - ) - self.assertEqual( - self.referral_active_gt_1hh_1ind.household, - self.household_referral_active_gt_1hh_1ind, - ) - - self.assertEqual( - repr1_referral_active_gt_1hh_1ind.individual, - None, - ) - self.assertEqual( - repr1_referral_active_gt_1hh_1ind.household, - self.household_referral_active_gt_1hh_1ind.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ) - - self.assertEqual( - repr2_referral_active_gt_1hh_1ind.individual, - self.individual_referral_active_gt_1hh_1ind.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ) - self.assertEqual( - repr2_referral_active_gt_1hh_1ind.household, - self.household_referral_active_gt_1hh_1ind.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ) - self.assertEqual( - repr3_referral_active_gt_1hh_1ind.individual, - self.individual_referral_active_gt_1hh_1ind.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ) - self.assertEqual( - repr3_referral_active_gt_1hh_1ind.household, - self.household_referral_active_gt_1hh_1ind.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ) - - self.check_grievance_household_unicef_id( - repr1_referral_active_gt_1hh_1ind.ticket, - repr1_referral_active_gt_1hh_1ind.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr2_referral_active_gt_1hh_1ind.ticket, - repr2_referral_active_gt_1hh_1ind.household.unicef_id, - ) - self.check_grievance_household_unicef_id( - repr3_referral_active_gt_1hh_1ind.ticket, - repr3_referral_active_gt_1hh_1ind.household.unicef_id, - ) - - self.check_created_at_equality( - [ - repr1_referral_active_gt_1hh_1ind, - repr2_referral_active_gt_1hh_1ind, - repr3_referral_active_gt_1hh_1ind, - self.referral_active_gt_1hh_1ind, - ] - ) - self.check_tickets_unicef_id_uniqueness( - [ - repr1_referral_active_gt_1hh_1ind, - repr2_referral_active_gt_1hh_1ind, - repr3_referral_active_gt_1hh_1ind, - self.referral_active_gt_1hh_1ind, - ] - ) - - def assert_needs_adjudication_ticket( - self, - possible_duplicates: list, - program: Optional[Program], - selected_individuals: list, - notes_count: int = 0, - documents_count: int = 0, - ) -> TicketNeedsAdjudicationDetails: - ticket_pr = TicketNeedsAdjudicationDetails.objects.filter(golden_records_individual__in=possible_duplicates) - self.assertEqual( - ticket_pr.count(), - 1, - ) - ticket_pr = ticket_pr.first() - - # self.assertEqual( - # ticket_pr.golden_records_individual.program, - # program, - # ) - self.assertEqual( - ticket_pr.ticket.programs(manager="all_objects").first(), - program, - ) - - possible_duplicates = [pd for pd in possible_duplicates if pd != ticket_pr.golden_records_individual] - for poss_dup in possible_duplicates: - self.assertIn( - poss_dup.pk, - ticket_pr.possible_duplicates(manager="original_and_repr_objects").values_list("pk", flat=True), - ) - self.assertEqual( - ticket_pr.possible_duplicates(manager="original_and_repr_objects").count(), - len(possible_duplicates), - ) - - for selected_individual in selected_individuals: - self.assertIn( - selected_individual, - ticket_pr.selected_individuals(manager="original_and_repr_objects").all(), - ) - if not selected_individuals: - self.assertEqual( - ticket_pr.selected_individuals(manager="original_and_repr_objects").count(), - 0, - ) - self.assertEqual( - ticket_pr.ticket.ticket_notes.count(), - notes_count, - ) - self.assertEqual( - ticket_pr.ticket.support_documents.count(), - documents_count, - ) - return ticket_pr - - def _test_needs_adjudication_tickets(self) -> None: - # Test needs_adjudication_not_closed - self.check_original_ticket(self.needs_adjudication_not_closed) - self.assertEqual( - self.needs_adjudication_closed.ticket.copied_to(manager="default_for_migrations_fix").count(), 3 - ) - ticket_original = self.assert_needs_adjudication_ticket( - [ - self.golden_rec_needs_adjudication_not_closed, - self.possible_dup1_needs_adjudication_not_closed, - self.possible_dup2_needs_adjudication_not_closed, - self.possible_dup3_needs_adjudication_not_closed, - self.possible_dup4_needs_adjudication_not_closed, - ], - None, - [ - self.possible_dup2_needs_adjudication_not_closed, - self.possible_dup3_needs_adjudication_not_closed, - ], - ) - self.assertEqual(ticket_original, self.needs_adjudication_not_closed) - - ticket_pr1 = self.assert_needs_adjudication_ticket( - [ - self.golden_rec_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - self.possible_dup2_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ], - self.program1, - [ - self.possible_dup2_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ], - ) - self.repr1_needs_adjudication_not_closed = ticket_pr1 - self.assertEqual( - ticket_pr1.extra_data, - self.create_extra_data_for_needs_adjudication( - [ - self.golden_rec_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program1) - .id - ], - [ - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program1) - .id - ], - ), - ) - self.check_ticket_representation(ticket_pr1) - - ticket_pr2 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - self.possible_dup3_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - self.possible_dup4_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ], - self.program2, - [ - self.possible_dup3_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program2 - ), - ], - ) - self.repr2_needs_adjudication_not_closed = ticket_pr2 - self.assertEqual( - ticket_pr2.extra_data, - self.create_extra_data_for_needs_adjudication( - [], - [ - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program2) - .id, - self.possible_dup4_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program2) - .id, - ], - ), - ) - self.check_ticket_representation(ticket_pr2) - - ticket_pr3 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup4_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.golden_rec_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ], - self.program3, - [], - ) - self.repr3_needs_adjudication_not_closed = ticket_pr3 - self.assertEqual( - ticket_pr3.extra_data, - self.create_extra_data_for_needs_adjudication( - [ - self.golden_rec_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program3) - .id - ], - [ - self.possible_dup1_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program3) - .id, - self.possible_dup4_needs_adjudication_not_closed.copied_to(manager="original_and_repr_objects") - .get(program=self.program3) - .id, - ], - ), - ) - self.check_ticket_representation(ticket_pr3) - - self.check_tickets_unicef_id_uniqueness([ticket_original, ticket_pr1, ticket_pr2, ticket_pr3]) - self.check_created_at_equality( - [ticket_original, ticket_pr1, ticket_pr2, ticket_pr3], - ) - - # Test needs_adjudication_closed - self.check_original_ticket(self.needs_adjudication_closed) - self.assertEqual( - self.needs_adjudication_closed.ticket.copied_to(manager="default_for_migrations_fix").count(), 3 - ) - - ticket_original = self.assert_needs_adjudication_ticket( - [ - self.golden_rec_needs_adjudication_closed, - self.possible_dup1_needs_adjudication_closed, - self.possible_dup2_needs_adjudication_closed, - self.possible_dup3_needs_adjudication_closed, - self.possible_dup4_needs_adjudication_closed, - ], - None, - [ - self.possible_dup1_needs_adjudication_closed, - self.possible_dup3_needs_adjudication_closed, - self.possible_dup4_needs_adjudication_closed, - ], - ) - self.assertEqual(ticket_original, self.needs_adjudication_closed) - - ticket_pr1 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup1_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - self.possible_dup3_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ], - self.program1, - [ - self.possible_dup1_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - self.possible_dup3_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program1 - ), - ], - ) - self.check_ticket_representation(ticket_pr1) - - ticket_pr2 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup1_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup2_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup3_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup4_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ], - self.program3, - [ - self.possible_dup1_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup3_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - self.possible_dup4_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program3 - ), - ], - ) - self.check_ticket_representation(ticket_pr2) - - ticket_pr3 = self.assert_needs_adjudication_ticket( - [ - self.golden_rec_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program4 - ), - self.possible_dup4_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program4 - ), - ], - self.program4, - [ - self.possible_dup4_needs_adjudication_closed.copied_to(manager="original_and_repr_objects").get( - program=self.program4 - ), - ], - ) - - self.check_tickets_unicef_id_uniqueness([ticket_original, ticket_pr1, ticket_pr2, ticket_pr3]) - self.check_created_at_equality( - [ticket_original, ticket_pr1, ticket_pr2, ticket_pr3], - ) - - # Test needs_adjudication_closed_2docs_2notes - self.check_original_ticket(self.needs_adjudication_closed_2docs_2notes) - self.assertEqual( - self.needs_adjudication_closed_2docs_2notes.ticket.copied_to(manager="default_for_migrations_fix").count(), - 2, - ) - ticket_original = self.assert_needs_adjudication_ticket( - [ - self.golden_rec_needs_adjudication_closed_2docs_2notes, - self.possible_dup1_needs_adjudication_closed_2docs_2notes, - self.possible_dup2_needs_adjudication_closed_2docs_2notes, - self.possible_dup3_needs_adjudication_closed_2docs_2notes, - self.possible_dup4_needs_adjudication_closed_2docs_2notes, - ], - None, - [ - self.possible_dup3_needs_adjudication_closed_2docs_2notes, - self.possible_dup4_needs_adjudication_closed_2docs_2notes, - ], - 2, - 2, - ) - self.assertEqual(ticket_original, self.needs_adjudication_closed_2docs_2notes) - - ticket_pr1 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup1_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - self.possible_dup2_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - self.possible_dup3_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ], - self.program2, - [ - self.possible_dup3_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program2), - ], - 2, - 2, - ) - self.check_ticket_representation(ticket_pr1) - - ticket_pr2 = self.assert_needs_adjudication_ticket( - [ - self.possible_dup2_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - self.possible_dup3_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - ], - self.program3, - [ - self.possible_dup3_needs_adjudication_closed_2docs_2notes.copied_to( - manager="original_and_repr_objects" - ).get(program=self.program3), - ], - 2, - 2, - ) - self.check_ticket_representation(ticket_pr2) - - self.check_tickets_unicef_id_uniqueness([ticket_original, ticket_pr1, ticket_pr2]) - self.check_created_at_equality( - [ticket_original, ticket_pr1, ticket_pr2], - ) - - # Test needs_adjudication_no_common_program - self.assertTrue( - TicketNeedsAdjudicationDetails.objects.filter(id=self.needs_adjudication_no_common_program.id).exists() - ) - self.assertEqual( - self.needs_adjudication_no_common_program.ticket.copied_to(manager="default_for_migrations_fix").count(), 0 - ) - self.check_original_ticket(self.needs_adjudication_no_common_program) - - def _test_feedback(self) -> None: - # Test feedback_closed_2hh_3ind - self.assertEqual(self.feedback_closed_2hh_3ind.is_migration_handled, True) - self.assertEqual(self.feedback_closed_2hh_3ind.is_original, True) - self.assertEqual( - self.feedback_closed_2hh_3ind.linked_grievance.copied_to(manager="default_for_migrations_fix").count(), 1 - ) - self.assertEqual( - self.feedback_closed_2hh_3ind.feedback_messages.count(), - 2, - ) - - repr_feedback_closed_2hh_3ind = ( - self.feedback_closed_2hh_3ind.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_2hh_3ind.is_original, False) - program = repr_feedback_closed_2hh_3ind.program - self.assertEqual( - repr_feedback_closed_2hh_3ind.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual(repr_feedback_closed_2hh_3ind.copied_from, self.feedback_closed_2hh_3ind) - self.assertEqual(repr_feedback_closed_2hh_3ind.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_2hh_3ind.household_lookup.copied_from, self.household_feedback_closed_2hh_3ind - ) - self.assertEqual(repr_feedback_closed_2hh_3ind.individual_lookup.program, program) - self.assertEqual( - repr_feedback_closed_2hh_3ind.individual_lookup.copied_from, self.individual_feedback_closed_2hh_3ind - ) - self.assertEqual(repr_feedback_closed_2hh_3ind.linked_grievance.is_original, False) - self.assertEqual( - self.feedback_closed_2hh_3ind.feedback_messages.count(), - 2, - ) - self.assertEqual( - repr_feedback_closed_2hh_3ind.feedback_messages.count(), - 2, - ) - - # Test feedback_closed_no_hh_no_ind - self.assertIsNone(self.feedback_closed_no_hh_no_ind.household_lookup) - self.assertIsNone(self.feedback_closed_no_hh_no_ind.individual_lookup) - self.assertEqual(self.feedback_closed_no_hh_no_ind.is_migration_handled, True) - self.assertEqual(self.feedback_closed_no_hh_no_ind.is_original, True) - self.assertEqual( - self.feedback_closed_no_hh_no_ind.linked_grievance.copied_to( - manager="default_for_migrations_fix", - ).count(), - 1, - ) - repr_feedback_closed_no_hh_no_ind = ( - self.feedback_closed_no_hh_no_ind.linked_grievance.copied_to( - manager="default_for_migrations_fix", - ) - .first() - .feedback - ) - - self.assertEqual(repr_feedback_closed_no_hh_no_ind.is_original, False) - program = repr_feedback_closed_no_hh_no_ind.program - self.assertEqual(program.name, "Storage Program For Non-Program Grievance And Accountability") - self.assertEqual( - repr_feedback_closed_no_hh_no_ind.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual(repr_feedback_closed_no_hh_no_ind.copied_from, self.feedback_closed_no_hh_no_ind) - self.assertEqual(repr_feedback_closed_no_hh_no_ind.linked_grievance.is_original, False) - - # Test feedback_closed_1hh_1ind_same_program - self.assertEqual(self.feedback_closed_1hh_1ind_same_program.is_migration_handled, True) - self.assertEqual(self.feedback_closed_1hh_1ind_same_program.is_original, True) - self.assertEqual( - self.feedback_closed_1hh_1ind_same_program.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - - repr_feedback_closed_1hh_1ind_same_program = ( - self.feedback_closed_1hh_1ind_same_program.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_same_program.is_original, False) - program = repr_feedback_closed_1hh_1ind_same_program.program - self.assertEqual(program, self.program1) - self.assertEqual( - repr_feedback_closed_1hh_1ind_same_program.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual( - repr_feedback_closed_1hh_1ind_same_program.copied_from, self.feedback_closed_1hh_1ind_same_program - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_same_program.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_1hh_1ind_same_program.household_lookup.copied_from, - self.household_feedback_closed_1hh_1ind_same_program, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_same_program.individual_lookup.program, program) - self.assertEqual( - repr_feedback_closed_1hh_1ind_same_program.individual_lookup.copied_from, - self.individual_feedback_closed_1hh_1ind_same_program, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_same_program.linked_grievance.is_original, False) - - # Test feedback_closed_1hh_1ind_diff_program_with_repr - self.assertEqual(self.feedback_closed_1hh_1ind_diff_program_with_repr.is_migration_handled, True) - self.assertEqual(self.feedback_closed_1hh_1ind_diff_program_with_repr.is_original, True) - self.assertEqual( - self.feedback_closed_1hh_1ind_diff_program_with_repr.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - - repr_feedback_closed_1hh_1ind_diff_program_with_repr = ( - self.feedback_closed_1hh_1ind_diff_program_with_repr.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ) - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program_with_repr.is_original, False) - program = repr_feedback_closed_1hh_1ind_diff_program_with_repr.program - self.assertEqual(program, self.program1) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program_with_repr.linked_grievance.programs( - manager="all_objects" - ).first(), - program, - ) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program_with_repr.copied_from, - self.feedback_closed_1hh_1ind_diff_program_with_repr, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program_with_repr.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program_with_repr.household_lookup.copied_from, - self.household_feedback_closed_1hh_1ind_diff_program_with_repr, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program_with_repr.individual_lookup.program, program) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program_with_repr.individual_lookup.copied_from, - self.individual_feedback_closed_1hh_1ind_diff_program_with_repr, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program_with_repr.linked_grievance.is_original, False) - - # Test feedback_closed_only_hh - self.assertEqual(self.feedback_closed_only_hh.is_migration_handled, True) - self.assertEqual(self.feedback_closed_only_hh.is_original, True) - self.assertEqual( - self.feedback_closed_only_hh.linked_grievance.copied_to(manager="default_for_migrations_fix").count(), 1 - ) - - repr_feedback_closed_only_hh = ( - self.feedback_closed_only_hh.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_only_hh.is_original, False) - program = repr_feedback_closed_only_hh.program - self.assertEqual(program, self.program1) - self.assertEqual(repr_feedback_closed_only_hh.linked_grievance.programs(manager="all_objects").first(), program) - self.assertEqual(repr_feedback_closed_only_hh.copied_from, self.feedback_closed_only_hh) - self.assertEqual(repr_feedback_closed_only_hh.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_only_hh.household_lookup.copied_from, self.household_feedback_closed_only_hh - ) - self.assertEqual(repr_feedback_closed_only_hh.individual_lookup, None) - self.assertEqual(repr_feedback_closed_only_hh.linked_grievance.is_original, False) - - # Test feedback_closed_only_ind - self.assertEqual(self.feedback_closed_only_ind.is_migration_handled, True) - self.assertEqual(self.feedback_closed_only_ind.is_original, True) - self.assertEqual( - self.feedback_closed_only_ind.linked_grievance.copied_to(manager="default_for_migrations_fix").count(), 1 - ) - - repr_feedback_closed_only_ind = ( - self.feedback_closed_only_ind.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_only_ind.is_original, False) - program = repr_feedback_closed_only_ind.program - self.assertEqual(program, self.program1) - self.assertEqual( - repr_feedback_closed_only_ind.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual(repr_feedback_closed_only_ind.copied_from, self.feedback_closed_only_ind) - self.assertEqual(repr_feedback_closed_only_ind.household_lookup, None) - self.assertEqual( - repr_feedback_closed_only_ind.individual_lookup.copied_from, self.individual_feedback_closed_only_ind - ) - self.assertEqual(repr_feedback_closed_only_ind.individual_lookup.program, program) - self.assertEqual(repr_feedback_closed_only_ind.linked_grievance.is_original, False) - - # Test feedback_closed_1hh_1ind_diff_program - self.assertEqual(self.feedback_closed_1hh_1ind_diff_program.is_migration_handled, True) - self.assertEqual(self.feedback_closed_1hh_1ind_diff_program.is_original, True) - self.assertEqual( - self.feedback_closed_1hh_1ind_diff_program.household_lookup, - self.household_feedback_closed_1hh_1ind_diff_program, - ) - self.assertEqual( - self.feedback_closed_1hh_1ind_diff_program.individual_lookup, - self.individual_feedback_closed_1hh_1ind_diff_program, - ) - self.assertEqual( - self.feedback_closed_1hh_1ind_diff_program.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - - repr_feedback_closed_1hh_1ind_diff_program = ( - self.feedback_closed_1hh_1ind_diff_program.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program.is_original, False) - program = repr_feedback_closed_1hh_1ind_diff_program.program - self.assertEqual(program, self.program1) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program.copied_from, self.feedback_closed_1hh_1ind_diff_program - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_1hh_1ind_diff_program.household_lookup.copied_from, - self.household_feedback_closed_1hh_1ind_diff_program, - ) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program.individual_lookup, None) - self.assertEqual(repr_feedback_closed_1hh_1ind_diff_program.linked_grievance.is_original, False) - - # Test feedback_closed_2hh_3ind_in_pr3 - self.assertEqual(self.feedback_closed_2hh_3ind_in_pr3.is_migration_handled, True) - self.assertEqual(self.feedback_closed_2hh_3ind_in_pr3.is_original, True) - self.assertEqual(self.feedback_closed_2hh_3ind_in_pr3.program, self.program3) - self.assertEqual( - self.feedback_closed_2hh_3ind_in_pr3.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - - repr_feedback_closed_2hh_3ind_in_pr3 = ( - self.feedback_closed_2hh_3ind_in_pr3.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_closed_2hh_3ind_in_pr3.is_original, False) - program = repr_feedback_closed_2hh_3ind_in_pr3.program - self.assertEqual(program, self.program3) - self.assertEqual(repr_feedback_closed_2hh_3ind_in_pr3.copied_from, self.feedback_closed_2hh_3ind_in_pr3) - self.assertEqual( - repr_feedback_closed_2hh_3ind_in_pr3.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual(repr_feedback_closed_2hh_3ind_in_pr3.household_lookup.program, program) - self.assertEqual( - repr_feedback_closed_2hh_3ind_in_pr3.household_lookup.copied_from, - self.household_feedback_closed_2hh_3ind_in_pr3, - ) - self.assertEqual(repr_feedback_closed_2hh_3ind_in_pr3.individual_lookup.program, program) - self.assertEqual( - repr_feedback_closed_2hh_3ind_in_pr3.individual_lookup.copied_from, - self.individual_feedback_closed_2hh_3ind_in_pr3, - ) - self.assertEqual(repr_feedback_closed_2hh_3ind_in_pr3.linked_grievance.is_original, False) - # Test feedback_no_gt_2hh_3ind_in_pr3 - self.assertEqual(self.feedback_no_gt_2hh_3ind_in_pr3.is_migration_handled, True) - self.assertEqual(self.feedback_no_gt_2hh_3ind_in_pr3.is_original, True) - self.assertEqual(self.feedback_no_gt_2hh_3ind_in_pr3.program, self.program3) - - repr_feedback_no_gt_2hh_3ind_in_pr3 = Feedback.original_and_repr_objects.get( - household_lookup=self.household_feedback_no_gt_2hh_3ind_in_pr3.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program3), - individual_lookup=self.individual_feedback_no_gt_2hh_3ind_in_pr3.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program3), - ) - self.assertEqual(repr_feedback_no_gt_2hh_3ind_in_pr3.is_original, False) - program = repr_feedback_no_gt_2hh_3ind_in_pr3.program - self.assertEqual(program, self.program3) - self.assertEqual(repr_feedback_no_gt_2hh_3ind_in_pr3.copied_from, self.feedback_no_gt_2hh_3ind_in_pr3) - self.assertEqual(repr_feedback_no_gt_2hh_3ind_in_pr3.household_lookup.program, program) - self.assertEqual( - repr_feedback_no_gt_2hh_3ind_in_pr3.household_lookup.copied_from, - self.household_feedback_no_gt_2hh_3ind_in_pr3, - ) - self.assertEqual(repr_feedback_no_gt_2hh_3ind_in_pr3.individual_lookup.program, program) - self.assertEqual( - repr_feedback_no_gt_2hh_3ind_in_pr3.individual_lookup.copied_from, - self.individual_feedback_no_gt_2hh_3ind_in_pr3, - ) - - # Test feedback_active_gt_no_hh_no_ind_in_pr1 - self.assertEqual(self.feedback_active_gt_no_hh_no_ind_in_pr1.is_migration_handled, True) - self.assertEqual(self.feedback_active_gt_no_hh_no_ind_in_pr1.is_original, True) - self.assertEqual(self.feedback_active_gt_no_hh_no_ind_in_pr1.program, self.program1) - self.assertEqual( - self.feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - self.assertEqual( - self.feedback_active_gt_no_hh_no_ind_in_pr1.copied_to(manager="original_and_repr_objects").count(), 1 - ) - - repr_feedback_active_gt_no_hh_no_ind_in_pr1 = ( - self.feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_active_gt_no_hh_no_ind_in_pr1.is_original, False) - program = repr_feedback_active_gt_no_hh_no_ind_in_pr1.program - self.assertEqual(program, self.program1) - self.assertEqual( - repr_feedback_active_gt_no_hh_no_ind_in_pr1.copied_from, self.feedback_active_gt_no_hh_no_ind_in_pr1 - ) - self.assertEqual( - repr_feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance.programs(manager="all_objects").first(), - program, - ) - self.assertEqual( - repr_feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance.status, GrievanceTicket.STATUS_ASSIGNED - ) - self.assertEqual(repr_feedback_active_gt_no_hh_no_ind_in_pr1.household_lookup, None) - self.assertEqual(repr_feedback_active_gt_no_hh_no_ind_in_pr1.individual_lookup, None) - self.assertEqual(repr_feedback_active_gt_no_hh_no_ind_in_pr1.linked_grievance.is_original, False) - # Test feedback_active_only_ind_in_pr2 - self.assertEqual(self.feedback_active_only_ind_in_pr2.is_migration_handled, True) - self.assertEqual(self.feedback_active_only_ind_in_pr2.is_original, True) - self.assertEqual(self.feedback_active_only_ind_in_pr2.program, self.program2) - self.assertEqual( - self.feedback_active_only_ind_in_pr2.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 1, - ) - self.assertEqual(self.feedback_active_only_ind_in_pr2.copied_to(manager="original_and_repr_objects").count(), 1) - - repr_feedback_active_only_ind_in_pr2 = ( - self.feedback_active_only_ind_in_pr2.linked_grievance.copied_to(manager="default_for_migrations_fix") - .first() - .feedback - ) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.is_original, False) - program = repr_feedback_active_only_ind_in_pr2.program - self.assertEqual(program, self.program2) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.copied_from, self.feedback_active_only_ind_in_pr2) - self.assertEqual( - repr_feedback_active_only_ind_in_pr2.linked_grievance.programs(manager="all_objects").first(), program - ) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.linked_grievance.status, GrievanceTicket.STATUS_ASSIGNED) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.household_lookup, None) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.individual_lookup.program, program) - self.assertEqual( - repr_feedback_active_only_ind_in_pr2.individual_lookup.copied_from, - self.individual_feedback_active_only_ind_in_pr2, - ) - self.assertEqual(repr_feedback_active_only_ind_in_pr2.linked_grievance.is_original, False) - - # Test feedback_no_gt_1hh_1ind_in_pr2 - self.assertEqual(self.feedback_no_gt_1hh_1ind_in_pr2.is_migration_handled, True) - self.assertEqual(self.feedback_no_gt_1hh_1ind_in_pr2.is_original, True) - self.assertEqual(self.feedback_no_gt_1hh_1ind_in_pr2.program, self.program1) - self.assertEqual(self.feedback_no_gt_1hh_1ind_in_pr2.copied_to(manager="original_and_repr_objects").count(), 1) - - repr_feedback_no_gt_1hh_1ind_in_pr2 = self.feedback_no_gt_1hh_1ind_in_pr2.copied_to( - manager="original_and_repr_objects" - ).first() - self.assertEqual(repr_feedback_no_gt_1hh_1ind_in_pr2.is_original, False) - program = repr_feedback_no_gt_1hh_1ind_in_pr2.program - self.assertEqual(program, self.program1) - self.assertEqual(repr_feedback_no_gt_1hh_1ind_in_pr2.household_lookup, None) - self.assertEqual(repr_feedback_no_gt_1hh_1ind_in_pr2.individual_lookup, None) - self.assertEqual(repr_feedback_no_gt_1hh_1ind_in_pr2.linked_grievance, None) - - # Test feedback_no_program_no_gt_no_hh_no_ind - self.assertEqual(self.feedback_no_program_no_gt_no_hh_no_ind.is_migration_handled, True) - self.assertEqual(self.feedback_no_program_no_gt_no_hh_no_ind.is_original, True) - self.assertEqual(self.feedback_no_program_no_gt_no_hh_no_ind.program, None) - self.assertEqual( - self.feedback_no_program_no_gt_no_hh_no_ind.copied_to(manager="original_and_repr_objects").count(), 1 - ) - - repr_feedback_no_program_no_gt_no_hh_no_ind = self.feedback_no_program_no_gt_no_hh_no_ind.copied_to( - manager="original_and_repr_objects" - ).first() - self.assertEqual(repr_feedback_no_program_no_gt_no_hh_no_ind.is_original, False) - program = repr_feedback_no_program_no_gt_no_hh_no_ind.program - self.assertEqual(program.name, "Storage Program For Non-Program Grievance And Accountability") - self.assertEqual(repr_feedback_no_program_no_gt_no_hh_no_ind.household_lookup, None) - self.assertEqual(repr_feedback_no_program_no_gt_no_hh_no_ind.individual_lookup, None) - self.assertEqual(repr_feedback_no_program_no_gt_no_hh_no_ind.linked_grievance, None) - - # Test feedback_active_gt_no_program_3hh_2ind - self.assertEqual(self.feedback_active_gt_no_program_3hh_2ind.is_migration_handled, True) - self.assertEqual(self.feedback_active_gt_no_program_3hh_2ind.is_original, True) - self.assertEqual(self.feedback_active_gt_no_program_3hh_2ind.program, None) - self.assertEqual( - self.feedback_active_gt_no_program_3hh_2ind.copied_to(manager="original_and_repr_objects").count(), 3 - ) - self.assertEqual( - self.feedback_active_gt_no_program_3hh_2ind.linked_grievance.copied_to( - manager="default_for_migrations_fix" - ).count(), - 3, - ) - repr1_feedback_no_gt_2hh_3ind_in_pr3 = Feedback.original_and_repr_objects.get( - household_lookup=self.household_feedback_active_gt_no_program_3hh_2ind.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program1), - individual_lookup=None, - ) - repr2_feedback_no_gt_2hh_3ind_in_pr3 = Feedback.original_and_repr_objects.get( - household_lookup=self.household_feedback_active_gt_no_program_3hh_2ind.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program2), - individual_lookup=self.individual_feedback_active_gt_no_program_3hh_2ind.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program2), - ) - repr3_feedback_no_gt_2hh_3ind_in_pr3 = Feedback.original_and_repr_objects.get( - household_lookup=self.household_feedback_active_gt_no_program_3hh_2ind.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program3), - individual_lookup=self.individual_feedback_active_gt_no_program_3hh_2ind.copied_to( - manager="original_and_repr_objects", - ).get(program=self.program3), - ) - for repr, program in zip( - [ - repr1_feedback_no_gt_2hh_3ind_in_pr3, - repr2_feedback_no_gt_2hh_3ind_in_pr3, - repr3_feedback_no_gt_2hh_3ind_in_pr3, - ], - [ - self.program1, - self.program2, - self.program3, - ], - ): - self.assertEqual(repr.is_original, False) - program = repr.program - self.assertEqual(program, program) - self.assertEqual(repr.copied_from, self.feedback_active_gt_no_program_3hh_2ind) - self.assertEqual(repr.linked_grievance.programs(manager="all_objects").first(), program) - self.assertEqual(repr.household_lookup.program, program) - self.assertEqual(repr.household_lookup.copied_from, self.household_feedback_active_gt_no_program_3hh_2ind) - if program != self.program1: - self.assertEqual(repr.individual_lookup.program, program) - self.assertEqual( - repr.individual_lookup.copied_from, self.individual_feedback_active_gt_no_program_3hh_2ind - ) - else: - self.assertEqual(repr.individual_lookup, None) - self.assertEqual( - repr.linked_grievance.copied_from, self.feedback_active_gt_no_program_3hh_2ind.linked_grievance - ) - - self.assertEqual(repr.feedback_messages.count(), 2) - self.assertEqual(repr.linked_grievance.ticket_notes.count(), 2) - self.assertEqual(repr.linked_grievance.support_documents.count(), 2) - - self.check_created_at_equality( - [ - self.feedback_active_gt_no_program_3hh_2ind, - repr1_feedback_no_gt_2hh_3ind_in_pr3, - repr2_feedback_no_gt_2hh_3ind_in_pr3, - repr3_feedback_no_gt_2hh_3ind_in_pr3, - ], - ticket_field="linked_grievance", - ) - self.check_tickets_unicef_id_uniqueness( - [ - self.feedback_active_gt_no_program_3hh_2ind, - repr1_feedback_no_gt_2hh_3ind_in_pr3, - repr2_feedback_no_gt_2hh_3ind_in_pr3, - repr3_feedback_no_gt_2hh_3ind_in_pr3, - ], - ticket_field="linked_grievance", - ) - self.check_feedback_unicef_id_uniqueness( - [ - self.feedback_active_gt_no_program_3hh_2ind, - repr1_feedback_no_gt_2hh_3ind_in_pr3, - repr2_feedback_no_gt_2hh_3ind_in_pr3, - repr3_feedback_no_gt_2hh_3ind_in_pr3, - ] - ) - - assert ( - self.feedback_active_gt_no_program_3hh_2ind.feedback_messages.order_by("created_at").first().created_at - == repr1_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").first().created_at - == repr2_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").first().created_at - == repr3_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").first().created_at - ) - assert ( - self.feedback_active_gt_no_program_3hh_2ind.feedback_messages.order_by("created_at").last().created_at - == repr1_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").last().created_at - == repr2_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").last().created_at - == repr3_feedback_no_gt_2hh_3ind_in_pr3.feedback_messages.order_by("created_at").last().created_at - ) - - def assertNumQueries( # type: ignore[override] - self, num: int, func: None = None, *, using: str = DEFAULT_DB_ALIAS - ) -> _AssertNumQueriesContext: - conn = connections[using] - - context = _AssertNumQueriesContext(self, num, conn) - if func is None: - return context - - @skip("failing test") - def test_migrate_grievance_to_representations(self) -> None: - with self.assertNumQueries( - 1072, - ): - migrate_grievance_to_representations() - self.refresh_objects() - # test with deleting and rerunning - delete_representations_from_ba(self.business_area) - migrate_grievance_to_representations() - self.refresh_objects() - - self._test_ticket_complaint_details() - self._test_ticket_sensitive_details() - self._test_ticket_payment_verification_details() - self._test_ticket_delete_household_details() - self._test_ticket_update_household_details() - self._test_ticket_add_individual_details() - - self._test_ticket_upd_individual_details() - self._test_ticket_delete_individual_details() - self._test_ticket_system_flagging_details() - - self._test_ticket_referral_details() - self._test_needs_adjudication_tickets() - self._test_feedback() - - self._test_message() - # Test payment related tickets - self._test_payment_related_tickets() - - def _test_payment_related_tickets(self) -> None: - handle_payment_related_tickets() - self.refresh_objects() - - self._test_ticket_complaint_details_with_payments() - self._test_ticket_sensitive_details_with_payments() - self._test_ticket_payment_verification_details_with_payments() - - def _test_ticket_complaint_details_with_payments(self) -> None: - # Test complaint_ticket_with_payment - repr_household_complaint_ticket_with_payment = ( - self.household_complaint_ticket_with_payment.copied_to(manager="original_and_repr_objects") - .filter(program=self.program1) - .first() - ) - repr_individual_complaint_ticket_with_payment = ( - self.individual_complaint_ticket_with_payment.copied_to(manager="original_and_repr_objects") - .filter(program=self.program1) - .first() - ) - self.assertEqual(self.complaint_ticket_with_payment.household, repr_household_complaint_ticket_with_payment) - self.assertEqual(self.complaint_ticket_with_payment.individual, repr_individual_complaint_ticket_with_payment) - self.assertEqual( - self.complaint_ticket_with_payment.ticket.copied_to(manager="default_for_migrations_fix").count(), 0 - ) - self.assertEqual( - self.complaint_ticket_with_payment.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.complaint_ticket_with_payment.ticket.programs(manager="all_objects").first(), - self.program1, - ) - self.check_grievance_household_unicef_id( - self.complaint_ticket_with_payment.ticket, - repr_household_complaint_ticket_with_payment.unicef_id, - ) - self.assertEqual( - self.complaint_ticket_with_payment.ticket.is_original, - False, - ) - self.assertEqual( - self.complaint_ticket_with_payment.ticket.is_migration_handled, - True, - ) - - # Test complaint_ticket_with_payment_record - repr_household_complaint_ticket_with_payment_record = ( - self.household_complaint_ticket_with_payment_record.copied_to(manager="original_and_repr_objects") - .filter(program=self.program2) - .first() - ) - self.assertEqual( - self.complaint_ticket_with_payment_record.household, repr_household_complaint_ticket_with_payment_record - ) - self.assertEqual(self.complaint_ticket_with_payment_record.individual, None) - self.assertEqual( - self.complaint_ticket_with_payment_record.ticket.copied_to(manager="default_for_migrations_fix").count(), 0 - ) - self.assertEqual( - self.complaint_ticket_with_payment_record.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.complaint_ticket_with_payment_record.ticket.programs(manager="all_objects").first(), - self.program2, - ) - self.check_grievance_household_unicef_id( - self.complaint_ticket_with_payment_record.ticket, - repr_household_complaint_ticket_with_payment_record.unicef_id, - ) - self.assertEqual( - self.complaint_ticket_with_payment_record.ticket.is_original, - False, - ) - self.assertEqual( - self.complaint_ticket_with_payment_record.ticket.is_migration_handled, - True, - ) - - def _test_ticket_sensitive_details_with_payments(self) -> None: - # Test TicketSensitiveDetails sensitive_ticket_with_payment - repr_individual_sensitive_ticket_with_payment = ( - self.individual_sensitive_ticket_with_payment.copied_to(manager="original_and_repr_objects") - .filter(program=self.program1) - .first() - ) - self.assertEqual(self.sensitive_ticket_with_payment.household, None) - self.assertEqual(self.sensitive_ticket_with_payment.individual, repr_individual_sensitive_ticket_with_payment) - self.assertEqual( - self.sensitive_ticket_with_payment.ticket.copied_to(manager="default_for_migrations_fix").count(), 0 - ) - self.assertEqual( - self.sensitive_ticket_with_payment.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.sensitive_ticket_with_payment.ticket.programs(manager="all_objects").first(), - self.program1, - ) - self.check_grievance_household_unicef_id( - self.sensitive_ticket_with_payment.ticket, - None, - ) - self.assertEqual( - self.sensitive_ticket_with_payment.ticket.is_original, - False, - ) - self.assertEqual( - self.sensitive_ticket_with_payment.ticket.is_migration_handled, - True, - ) - - # Test TicketSensitiveDetails sensitive_ticket_with_payment_record - repr_individual_sensitive_ticket_with_payment_record = ( - self.individual_sensitive_ticket_with_payment_record.copied_to(manager="original_and_repr_objects") - .filter(program=self.program2) - .first() - ) - repr_household_sensitive_ticket_with_payment_record = ( - self.household_sensitive_ticket_with_payment_record.copied_to(manager="original_and_repr_objects") - .filter(program=self.program2) - .first() - ) - - self.assertEqual( - self.sensitive_ticket_with_payment_record.household, repr_household_sensitive_ticket_with_payment_record - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.individual, repr_individual_sensitive_ticket_with_payment_record - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.ticket.copied_to(manager="default_for_migrations_fix").count(), 0 - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.ticket.programs(manager="all_objects").first(), - self.program2, - ) - self.check_grievance_household_unicef_id( - self.sensitive_ticket_with_payment_record.ticket, - repr_household_sensitive_ticket_with_payment_record.unicef_id, - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.ticket.is_original, - False, - ) - self.assertEqual( - self.sensitive_ticket_with_payment_record.ticket.is_migration_handled, - True, - ) - - def _test_ticket_payment_verification_details_with_payments(self) -> None: - # Test payment_verification_ticket_with_payment_record - self.assertEqual( - self.payment_verification_ticket_with_payment_record.household, - self.household_payment_verification_ticket_with_payment_record, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment_record.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 0, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment_record.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment_record.ticket.programs(manager="all_objects").first(), - self.program1, - ) - self.check_grievance_household_unicef_id( - self.payment_verification_ticket_with_payment_record.ticket, - self.payment_verification_ticket_with_payment_record.payment_verification.payment_obj.household.unicef_id, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment_record.ticket.is_original, - False, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment_record.ticket.is_migration_handled, - True, - ) - - # Test payment_verification_ticket_with_payment - self.assertEqual( - self.payment_verification_ticket_with_payment.ticket.copied_to( - manager="default_for_migrations_fix" - ).count(), - 0, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment.ticket.programs(manager="all_objects").count(), - 1, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment.ticket.programs(manager="all_objects").first(), - self.program2, - ) - self.check_grievance_household_unicef_id( - self.payment_verification_ticket_with_payment.ticket, - self.payment_verification_ticket_with_payment.payment_verification.payment_obj.household.unicef_id, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment.ticket.is_original, - False, - ) - self.assertEqual( - self.payment_verification_ticket_with_payment.ticket.is_migration_handled, - True, - ) diff --git a/tests/unit/one_time_scripts/test_sync_representations.py b/tests/unit/one_time_scripts/test_sync_representations.py deleted file mode 100644 index fcc28309c3..0000000000 --- a/tests/unit/one_time_scripts/test_sync_representations.py +++ /dev/null @@ -1,739 +0,0 @@ -from unittest import skip - -from django.core.files.base import ContentFile -from django.db.models import Q -from django.test import TestCase -from django.utils.timezone import now - -from hct_mis_api.apps.accountability.models import Feedback, Message -from hct_mis_api.apps.geo.fixtures import AreaFactory, CountryFactory -from hct_mis_api.apps.grievance.models import ( - GrievanceDocument, - GrievanceTicket, - TicketNote, -) -from hct_mis_api.apps.household.fixtures import ( - BankAccountInfoFactory, - DocumentFactory, - HouseholdFactory, - IndividualFactory, - IndividualIdentityFactory, -) -from hct_mis_api.apps.household.models import ( - COLLECT_TYPE_NONE, - BankAccountInfo, - Document, - Household, - Individual, - IndividualIdentity, - IndividualRoleInHousehold, -) -from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.apps.program.models import Program -from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory -from hct_mis_api.apps.targeting.models import HouseholdSelection, TargetPopulation -from hct_mis_api.one_time_scripts.migrate_data_for_sync import ( - migrate_data_to_representations_per_business_area, -) -from hct_mis_api.one_time_scripts.migrate_grievance_for_sync import ( - migrate_grievance_to_representations_per_business_area, -) -from hct_mis_api.one_time_scripts.sync_representations import ( - ONE_TO_ONE_GREVIANCE_MODELS, - sync_representations_per_business_area, -) -from tests.unit.one_time_scripts.test_migrate_data_to_representations import ( - BaseMigrateDataTestCase, -) -from tests.unit.one_time_scripts.test_migrate_grievance_to_representations import ( - BaseGrievanceTestCase, -) - - -class TestSyncRepresentations(BaseMigrateDataTestCase, BaseGrievanceTestCase, TestCase): - def setUp(self) -> None: - super(TestSyncRepresentations, self).setUp() # BaseMigrateDataTestCase setUp - super(BaseMigrateDataTestCase, self).setUp() # BaseGrievanceTestCase setUp - - def prepare_data(self) -> None: - # remove all representations - hh_reprs = Household.original_and_repr_objects.filter(is_original=False, copied_from__isnull=False) - for hh_repr in hh_reprs: - hh_repr.selections(manager="original_and_repr_objects").all().delete() - hh_reprs.delete() - Individual.original_and_repr_objects.filter(is_original=False, copied_from__isnull=False).delete() - IndividualRoleInHousehold.original_and_repr_objects.filter( - is_original=False, copied_from__isnull=False - ).delete() - GrievanceTicket.default_for_migrations_fix.filter(is_original=False, copied_from__isnull=False).delete() - Message.original_and_repr_objects.filter(is_original=False, copied_from__isnull=False).delete() - Feedback.original_and_repr_objects.filter(is_original=False, copied_from__isnull=False).delete() - - # make originals again (managers...) - Household.original_and_repr_objects.all().update(is_original=True, is_migration_handled=False) - HouseholdSelection.original_and_repr_objects.all().update(is_original=True, is_migration_handled=False) - Individual.original_and_repr_objects.all().update(is_original=True, is_migration_handled=False) - IndividualRoleInHousehold.original_and_repr_objects.all().update(is_original=True, is_migration_handled=False) - GrievanceTicket.default_for_migrations_fix.all().update( - is_original=True, business_area=self.business_area, is_migration_handled=False - ) - Message.original_and_repr_objects.all().update( - is_original=True, business_area=self.business_area, is_migration_handled=False - ) - Feedback.original_and_repr_objects.all().update( - is_original=True, business_area=self.business_area, is_migration_handled=False - ) - - migrate_data_to_representations_per_business_area(business_area=self.business_area) - migrate_grievance_to_representations_per_business_area(business_area=self.business_area) - - # representations count - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=False, business_area=self.business_area).count(), 29 - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=False, business_area=self.business_area).count(), 44 - ) - self.assertEqual( - IndividualRoleInHousehold.original_and_repr_objects.filter( - is_original=False, household__business_area=self.business_area - ).count(), - 20, - ) - self.assertEqual( - BankAccountInfo.original_and_repr_objects.filter( - is_original=False, individual__business_area=self.business_area - ).count(), - 16, - ) - self.assertEqual( - Document.original_and_repr_objects.filter( - is_original=False, individual__business_area=self.business_area - ).count(), - 28, - ) - self.assertEqual( - IndividualIdentity.original_and_repr_objects.filter( - is_original=False, individual__business_area=self.business_area - ).count(), - 18, - ) - self.assertEqual( - GrievanceTicket.default_for_migrations_fix.filter( - is_original=False, business_area=self.business_area - ).count(), - 55, - ) - self.assertEqual( - Message.original_and_repr_objects.filter(is_original=False, business_area=self.business_area).count(), - 5, - ) - self.assertEqual( - Feedback.original_and_repr_objects.filter(is_original=False, business_area=self.business_area).count(), - 14, - ) - self.assertEqual( - TicketNote.objects.filter(ticket__is_original=False, ticket__business_area=self.business_area).count(), - 14, - ) - self.assertEqual( - GrievanceDocument.objects.filter( - grievance_ticket__is_original=False, grievance_ticket__business_area=self.business_area - ).count(), - 14, - ) - - @skip("XXX") - def test_remove_objects(self) -> None: - self.prepare_data() - - # soft delete originals - Household.original_and_repr_objects.filter(is_original=True, business_area=self.business_area).delete() - - sync_representations_per_business_area(self.business_area) - - # removed representations of removed originals - self.assertEqual( - Household.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - business_area=self.business_area, - is_removed=True, - is_original=False, - ) - .distinct() - .count(), - 117, - ) - - # soft delete originals - Individual.original_and_repr_objects.filter(is_original=True, business_area=self.business_area).delete() - IndividualRoleInHousehold.original_and_repr_objects.filter( - is_original=True, household__business_area=self.business_area - ).delete() - BankAccountInfo.original_and_repr_objects.filter( - is_original=True, individual__business_area=self.business_area - ).delete() - Document.original_and_repr_objects.filter( - is_original=True, individual__business_area=self.business_area - ).delete() - IndividualIdentity.original_and_repr_objects.filter( - is_original=True, individual__business_area=self.business_area - ).delete() - - # hard delete originals - GrievanceTicket.default_for_migrations_fix.filter(is_original=True).delete() - self.assertEqual(GrievanceTicket.default_for_migrations_fix.filter(is_original=True).count(), 0) - self.assertEqual( - GrievanceDocument.objects.filter( - grievance_ticket__is_original=False, grievance_ticket__business_area=self.business_area - ).count(), - 14, - ) - - sync_representations_per_business_area(self.business_area) - - self.assertEqual( - Individual.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - business_area=self.business_area, - is_removed=True, - is_original=False, - ).count(), - 238, - ) - self.assertEqual( - IndividualRoleInHousehold.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - household__business_area=self.business_area, - is_removed=True, - is_original=False, - ).count(), - 20, - ) - self.assertEqual( - BankAccountInfo.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - individual__business_area=self.business_area, - is_removed=True, - is_original=False, - ).count(), - 16, - ) - self.assertEqual( - Document.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - individual__business_area=self.business_area, - is_removed=True, - is_original=False, - ).count(), - 28, - ) - self.assertEqual( - IndividualIdentity.all_objects.filter( - Q(copied_from__isnull=True) | Q(copied_from__is_removed=True), - individual__business_area=self.business_area, - is_removed=True, - is_original=False, - ).count(), - 18, - ) - - # GRIEVANCE - self.assertEqual( - GrievanceTicket.objects.filter( - business_area=self.business_area, - is_original=False, - ).count(), - 0, - ) - - for _model in ONE_TO_ONE_GREVIANCE_MODELS: - self.assertEqual( - _model.objects.filter( - ticket__business_area=self.business_area, - ticket__is_original=False, - ).count(), - 0, - ) - - @skip("XXX") - def test_create_new_objects(self) -> None: - self.prepare_data() - - # new household, new rdi, 2 new target populations, 2 new programs - new_program = ProgramFactory( - status=Program.ACTIVE, - business_area=self.business_area, - data_collecting_type=self.full, - ) - new_program2 = ProgramFactory( - status=Program.ACTIVE, - business_area=self.business_area, - data_collecting_type=self.full, - ) - - # From HouseHoldSelection to details - new_rdi = RegistrationDataImportFactory(business_area=self.business_area) - new_target_population = TargetPopulationFactory( - program=new_program, - status=TargetPopulation.STATUS_READY_FOR_PAYMENT_MODULE, - business_area=self.business_area, - ) - new_target_population_2 = TargetPopulationFactory( - program=new_program2, - status=TargetPopulation.STATUS_READY_FOR_CASH_ASSIST, - business_area=self.business_area, - ) - new_head_of_household = IndividualFactory(business_area=self.business_area, household=None, is_original=True) - DocumentFactory(individual=new_head_of_household, program=None, is_original=True) - IndividualIdentityFactory(individual=new_head_of_household, is_original=True) - BankAccountInfoFactory(individual=new_head_of_household, is_original=True) - - new_household = HouseholdFactory( - business_area=self.business_area, - head_of_household=new_head_of_household, - registration_data_import=new_rdi, - collect_individual_data=COLLECT_TYPE_NONE, - is_original=True, - ) - new_head_of_household.household = new_household - new_head_of_household.save() - new_household.target_populations.set([new_target_population, new_target_population_2]) - new_household.selections(manager="original_and_repr_objects").all().update(is_original=True) - - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=False).count(), - 29, - ) - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=True).count(), - 76, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=False).count(), - 44, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=True).count(), - 139, - ) - - sync_representations_per_business_area(self.business_area) - - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=False).count(), - 31, - ) - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=True).count(), - 76, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=False).count(), - 46, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=True).count(), - 139, - ) - self.assertEqual( - new_head_of_household.copied_to(manager="original_and_repr_objects").all().count(), - 2, - ) - self.assertEqual(new_household.copied_to(manager="original_and_repr_objects").all().count(), 2) - - for new_head_of_household_representation in new_head_of_household.copied_to.all(): - self.assertEqual( - new_head_of_household_representation.documents(manager="original_and_repr_objects").all().count(), 1 - ) - self.assertEqual( - new_head_of_household_representation.identities(manager="original_and_repr_objects").all().count(), 1 - ) - self.assertEqual( - new_head_of_household_representation.bank_account_info(manager="original_and_repr_objects") - .all() - .count(), - 1, - ) - - # From Individual to details - new_individual = IndividualFactory(business_area=self.business_area, household=new_household, is_original=True) - DocumentFactory(individual=new_individual, program=None, is_original=True) - IndividualIdentityFactory(individual=new_individual, is_original=True) - BankAccountInfoFactory(individual=new_individual, is_original=True) - - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=True).count(), - 140, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=False).count(), - 46, - ) - - sync_representations_per_business_area(self.business_area) - - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=False).count(), - 31, - ) - self.assertEqual( - Household.original_and_repr_objects.filter(is_original=True).count(), - 76, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=False).count(), - 48, - ) - self.assertEqual( - Individual.original_and_repr_objects.filter(is_original=True).count(), - 140, - ) - self.assertEqual( - new_head_of_household.copied_to(manager="original_and_repr_objects").all().count(), - 2, - ) - self.assertEqual(new_household.copied_to(manager="original_and_repr_objects").all().count(), 2) - - for new_individual_representation in new_individual.copied_to(manager="original_and_repr_objects").all(): - self.assertEqual( - new_individual_representation.documents(manager="original_and_repr_objects").all().count(), 1 - ) - self.assertEqual( - new_individual_representation.identities(manager="original_and_repr_objects").all().count(), 1 - ) - self.assertEqual( - new_individual_representation.bank_account_info(manager="original_and_repr_objects").all().count(), 1 - ) - - # New details only - DocumentFactory(individual=new_individual, program=None, is_original=True) - IndividualIdentityFactory(individual=new_individual, is_original=True) - BankAccountInfoFactory(individual=new_individual, is_original=True) - - self.assertEqual( - Document.original_and_repr_objects.filter(is_original=True).count(), - 18, - ) - self.assertEqual( - Document.original_and_repr_objects.filter(is_original=False).count(), - 32, - ) - self.assertEqual( - IndividualIdentity.original_and_repr_objects.filter(is_original=True).count(), - 12, - ) - self.assertEqual( - IndividualIdentity.original_and_repr_objects.filter(is_original=False).count(), - 22, - ) - self.assertEqual( - BankAccountInfo.original_and_repr_objects.filter(is_original=True).count(), - 11, - ) - self.assertEqual( - BankAccountInfo.original_and_repr_objects.filter(is_original=False).count(), - 20, - ) - - sync_representations_per_business_area(self.business_area) - - self.assertEqual( - Document.original_and_repr_objects.filter(is_original=True).count(), - 18, - ) - self.assertEqual( - Document.original_and_repr_objects.filter(is_original=False).count(), - 34, - ) - self.assertEqual( - IndividualIdentity.original_and_repr_objects.filter(is_original=True).count(), - 12, - ) - self.assertEqual( - IndividualIdentity.original_and_repr_objects.filter(is_original=False).count(), - 24, - ) - self.assertEqual( - BankAccountInfo.original_and_repr_objects.filter(is_original=True).count(), - 11, - ) - self.assertEqual( - BankAccountInfo.original_and_repr_objects.filter(is_original=False).count(), - 22, - ) - self.assertEqual(new_household.copied_to(manager="original_and_repr_objects").all().count(), 2) - - for new_individual_representation in new_individual.copied_to.all(): - self.assertEqual( - new_individual_representation.documents(manager="original_and_repr_objects").all().count(), 2 - ) - self.assertEqual( - new_individual_representation.identities(manager="original_and_repr_objects").all().count(), 2 - ) - self.assertEqual( - new_individual_representation.bank_account_info(manager="original_and_repr_objects").all().count(), 2 - ) - - @skip("XXX") - def test_update_objects(self) -> None: - self.prepare_data() - # Household - hh = Household.original_and_repr_objects.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - copied_to__is_removed=False, - ).first() - hh.migrated_at = now() - hh_reprs = hh.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(hh_reprs.exists()) - # update head of household - new_head_of_household = IndividualFactory(business_area=self.business_area, household=None, is_original=True) - hh.head_of_household = new_head_of_household - new_head_of_household.household = hh - new_head_of_household.save() - - # update regular fields - hh.size = 16 - hh.save() - - sync_representations_per_business_area(self.business_area) - - for hh_repr in hh.copied_to(manager="original_and_repr_objects").all(): - self.assertEqual(hh_repr.size, 16) - self.assertIsNotNone(hh_repr.head_of_household) - self.assertEqual( - hh_repr.head_of_household, - hh.head_of_household.copied_to(manager="original_and_repr_objects") - .filter(program=hh_repr.program) - .first(), - ) - - # Individual - individual = Individual.original_and_repr_objects.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - copied_to__is_removed=False, - household__isnull=False, - ).first() - individual.migrated_at = now() - individual_reprs = individual.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(individual_reprs.exists()) - - # update regular fields - individual.full_name = "Marek Kowalski" - individual.save() - - sync_representations_per_business_area(self.business_area) - - for ind_repr in individual.copied_to(manager="original_and_repr_objects").all(): - self.assertEqual(ind_repr.full_name, "Marek Kowalski") - - # IndividualRoleInHousehold - individual_role_in_household = IndividualRoleInHousehold.original_and_repr_objects.filter( - is_original=True, - household__business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - copied_to__is_removed=False, - ).first() - individual_role_in_household.migrated_at = now() - individual_role_in_household_reprs = individual_role_in_household.copied_to( - manager="original_and_repr_objects" - ).all() - self.assertTrue(individual_role_in_household_reprs.exists()) - - _original_role = individual_role_in_household.role - - # update regular fields - if _original_role != "Primary collector": - _new_role = "Primary collector" - elif _original_role != "Alternate collector": - _new_role = "Alternate collector" - else: - _new_role = "None" - - individual_role_in_household.role = _new_role - - # update individual - new_individual = IndividualFactory(business_area=self.business_area, household=None, is_original=True) - individual_role_in_household.individual = new_individual - - individual_role_in_household.save() - - sync_representations_per_business_area(self.business_area) - - for irh_repr in individual_role_in_household.copied_to(manager="original_and_repr_objects").all(): - self.assertEqual(irh_repr.role, _new_role) - self.assertIsNotNone(irh_repr.individual) - self.assertEqual( - irh_repr.individual, - individual_role_in_household.individual.copied_to(manager="original_and_repr_objects") - .filter(program=irh_repr.household.program) - .first(), - ) - - # BankAccountInfo, Document, IndividualIdentity - individual = Individual.original_and_repr_objects.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - copied_to__is_removed=False, - household__isnull=False, - bank_account_info__isnull=False, - documents__isnull=False, - identities__isnull=False, - ).first() - individual.migrated_at = now() - individual.save() - individual_reprs = individual.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(individual_reprs.exists()) - - bank_account_infos = individual.bank_account_info(manager="original_and_repr_objects").filter(is_original=True) - self.assertTrue(bank_account_infos.exists()) - for bank_account_info in bank_account_infos: - bank_account_info.is_migration_handled = True - bank_account_info.bank_name = "New Bank Name" - bank_account_info.save() - - new_country = CountryFactory( - name="New Country", - short_name="Ne", - iso_code2="N", - iso_code3="NW", - iso_num="669", - ) - - identities = individual.identities(manager="original_and_repr_objects").filter(is_original=True) - self.assertTrue(identities.exists()) - for identity in identities: - identity.is_migration_handled = True - identity.number = "123" - identity.country = new_country - identity.save() - - documents = individual.documents(manager="original_and_repr_objects").filter(is_original=True) - self.assertTrue(documents.exists()) - for document in documents: - document.is_migration_handled = True - document.photo = ContentFile(b"...", name="foo.png") - document.document_number = "123" - document.country = new_country - document.save() - - sync_representations_per_business_area(self.business_area) - - for bank_account_info in bank_account_infos: - representations = bank_account_info.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertEqual(representation.bank_name, "New Bank Name") - - for identity in identities: - representations = identity.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertEqual(representation.number, "123") - self.assertEqual(representation.country.name, "New Country") - - for document in documents: - representations = document.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertTrue("foo" in representation.photo.name) - self.assertEqual(representation.document_number, "123") - self.assertEqual(representation.country.name, "New Country") - - # GrievanceTicket - gt = GrievanceTicket.default_for_migrations_fix.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - ticket_notes__isnull=False, - ).first() - gt.migrated_at = now() - gt_reprs = gt.copied_to(manager="default_for_migrations_fix").all() - self.assertTrue(gt_reprs.exists()) - - new_area = AreaFactory() - gt.description = "New description" - gt.admin2 = new_area - gt.save() - - ticket_notes = gt.ticket_notes.all() - self.assertEqual(ticket_notes.count(), 1) - for ticket_note in ticket_notes: - ticket_note.description = "New description" - ticket_note.save() - - sync_representations_per_business_area(self.business_area) - - representations = gt.copied_to(manager="default_for_migrations_fix").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertEqual(representation.description, "New description") - self.assertEqual(representation.admin2, new_area) - ticket_notes = representation.ticket_notes.all() - self.assertEqual(ticket_notes.count(), 1) - for ticket_note in ticket_notes: - self.assertEqual(ticket_note.description, "New description") - - # Message - message = Message.original_and_repr_objects.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - ).first() - message.migrated_at = now() - message_reprs = message.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(message_reprs.exists()) - message.title = "New title" - message.save() - - sync_representations_per_business_area(self.business_area) - - representations = message.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertEqual(representation.title, "New title") - - # Feedback, FeedbackMessage - feedback = Feedback.original_and_repr_objects.filter( - is_original=True, - business_area=self.business_area, - copied_to__isnull=False, - is_migration_handled=True, - feedback_messages__isnull=False, - ).first() - feedback.migrated_at = now() - feedback_reprs = feedback.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(feedback_reprs.exists()) - feedback.description = "New description" - # feedback.household_lookup = "New household lookup" - # feedback.individual_lookup = "New individual lookup" - feedback.save() - - feedback_messages = feedback.feedback_messages.all() - self.assertEqual(feedback_messages.count(), 2) - for feedback_message in feedback_messages: - feedback_message.description = "New description" - feedback_message.save() - - sync_representations_per_business_area(self.business_area) - - representations = feedback.copied_to(manager="original_and_repr_objects").all() - self.assertTrue(representations.exists()) - for representation in representations: - self.assertEqual(representation.description, "New description") - feedback_messages = representation.feedback_messages.all() - self.assertEqual(feedback_messages.count(), 2) - for feedback_message in feedback_messages: - self.assertEqual(feedback_message.description, "New description") From 2d4ed3cdbe5639b15dc60d5a6962d2c71e11e92b Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Tue, 26 Nov 2024 02:42:57 +0100 Subject: [PATCH 02/32] migration fix --- src/hct_mis_api/apps/payment/migrations/0003_migration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hct_mis_api/apps/payment/migrations/0003_migration.py b/src/hct_mis_api/apps/payment/migrations/0003_migration.py index 4dbc1594d0..2ff219155d 100644 --- a/src/hct_mis_api/apps/payment/migrations/0003_migration.py +++ b/src/hct_mis_api/apps/payment/migrations/0003_migration.py @@ -1,5 +1,6 @@ # Generated by Django 3.2.25 on 2024-10-23 23:15 from django.db import migrations, models, utils, transaction +import django.db.models.deletion class Migration(migrations.Migration): From 14e7454257d7c8a04165c7750c40ec4dc3c33842 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Tue, 26 Nov 2024 16:05:11 +0100 Subject: [PATCH 03/32] e2e --- .../payment_verification/test_payment_verification.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index f2e707e72c..6c54e61562 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -137,7 +137,7 @@ def payment_verification_multiple_verification_plans(number_verification_plans: ) PaymentVerificationFactory( - payment_obj=payment, + payment=payment, payment_verification_plan=payment_verification_plan, status=PV.STATUS_PENDING, ) @@ -221,9 +221,10 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - pv_summary = PaymentVerificationSummaryFactory(payment_plan=payment_plan) - pv_summary.activation_date = datetime.now() - relativedelta(months=1) - pv_summary.save() + PaymentVerificationSummaryFactory( + payment_plan=payment_plan, + activation_date=datetime.now() - relativedelta(months=1), + ) payment_verification_plan = PaymentVerificationPlanFactory( payment_plan=payment_plan, verification_channel=channel, From f54eb5b293063c20b88cf1e5d59d66c87a2e84a5 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Tue, 26 Nov 2024 17:00:27 +0100 Subject: [PATCH 04/32] e2e --- .../grievance/grievance_dashboard/test_grievance_dashboard.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/selenium/grievance/grievance_dashboard/test_grievance_dashboard.py b/tests/selenium/grievance/grievance_dashboard/test_grievance_dashboard.py index 4a3f91ad55..fc952d23f1 100644 --- a/tests/selenium/grievance/grievance_dashboard/test_grievance_dashboard.py +++ b/tests/selenium/grievance/grievance_dashboard/test_grievance_dashboard.py @@ -191,6 +191,7 @@ def test_grievance_dashboard_happy_path( pageGrievanceDetailsPage.getButtonSetInProgress().click() pageGrievanceDetailsPage.getButtonCloseTicket().click() pageGrievanceTickets.getButtonConfirm().click() + pageGrievanceTickets.wait_for_text("Closed", pageGrievanceTickets.statusContainer) pageGrievanceTickets.getNavGrievance().click() pageGrievanceDashboard.getNavGrievanceDashboard().click() assert "3" in pageGrievanceDashboard.getTotalNumberOfTicketsTopNumber().text From 9033887af48493daa4955f2e153fda7e04de559d Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Tue, 26 Nov 2024 21:55:30 +0100 Subject: [PATCH 05/32] e2e --- tests/selenium/payment_verification/test_payment_verification.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index 6c54e61562..8ad4d34655 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -228,6 +228,7 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA payment_verification_plan = PaymentVerificationPlanFactory( payment_plan=payment_plan, verification_channel=channel, + activation_date=datetime.now() - relativedelta(months=1), ) pv = PaymentVerificationFactory( payment=payment, From b2ec092c25339ce26d898d5e6024afa96f2c1d99 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 10:24:34 +0100 Subject: [PATCH 06/32] e2e --- .../payment_verification/test_payment_verification.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index 8ad4d34655..d51cb81bb3 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -221,20 +221,20 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - PaymentVerificationSummaryFactory( + pvs = PaymentVerificationSummaryFactory( payment_plan=payment_plan, - activation_date=datetime.now() - relativedelta(months=1), ) payment_verification_plan = PaymentVerificationPlanFactory( payment_plan=payment_plan, verification_channel=channel, - activation_date=datetime.now() - relativedelta(months=1), ) pv = PaymentVerificationFactory( payment=payment, payment_verification_plan=payment_verification_plan, status=PV.STATUS_PENDING, ) + # overwrite update_verification_status_in_cash_plan signal + pvs.activation_date = datetime.now() - relativedelta(months=1) return pv From 8c35504645c4f39e9094c548aeedb7014378b91d Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 12:08:47 +0100 Subject: [PATCH 07/32] e2e --- .github/workflows/ci.yml | 2 +- .../test_payment_verification.py | 20 ++++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f46939943..482c327bff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,7 +264,7 @@ jobs: -f ./.github/helpers/docker-compose.selenium.yml \ run backend bash -c " waitforit -host=db -port=5432 -timeout=30 - pytest -svvv -x -n 2 ./tests/selenium --cov-report xml:test-coverage/coverage.xml --html-report=./tests/selenium/output_data/report/report.html --randomly-seed=42 " + pytest -svvv -n 2 ./tests/selenium --cov-report xml:test-coverage/coverage.xml --html-report=./tests/selenium/output_data/report/report.html --randomly-seed=42 " - name: Upload Artifact uses: actions/upload-artifact@v4 if: always() diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index d51cb81bb3..a9c1f511fd 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -211,6 +211,9 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA payment_plan.unicef_id = "PP-0000-00-1122334" payment_plan.save() + PaymentVerificationSummaryFactory( + payment_plan=payment_plan, + ) payment = PaymentFactory( parent=payment_plan, @@ -221,9 +224,6 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA currency="PLN", status=GenericPayment.STATUS_DISTRIBUTION_SUCCESS, ) - pvs = PaymentVerificationSummaryFactory( - payment_plan=payment_plan, - ) payment_verification_plan = PaymentVerificationPlanFactory( payment_plan=payment_plan, verification_channel=channel, @@ -233,8 +233,7 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA payment_verification_plan=payment_verification_plan, status=PV.STATUS_PENDING, ) - # overwrite update_verification_status_in_cash_plan signal - pvs.activation_date = datetime.now() - relativedelta(months=1) + return pv @@ -287,12 +286,6 @@ def test_smoke_payment_verification_details( assert "0%" in pagePaymentVerificationDetails.getLabelErroneous().text assert "PENDING" in pagePaymentVerificationDetails.getLabelStatus().text assert "PENDING" in pagePaymentVerificationDetails.getVerificationPlansSummaryStatus().text - activation_date = (datetime.now() - relativedelta(months=1)).strftime("%-d %b %Y") - assert ( - f"ACTIVATION DATE {activation_date}" - in pagePaymentVerificationDetails.getLabelizedFieldContainerSummaryActivationDate().text.replace("\n", " ") - ) - assert activation_date in pagePaymentVerificationDetails.getLabelActivationDate().text assert ( "COMPLETION DATE -" in pagePaymentVerificationDetails.getLabelizedFieldContainerSummaryCompletionDate().text.replace("\n", " ") @@ -309,11 +302,6 @@ def test_smoke_payment_verification_details( assert "PENDING" in pagePaymentVerificationDetails.getLabelStatus().text assert "PENDING" in pagePaymentVerificationDetails.getVerificationPlanStatus().text assert "MANUAL" in pagePaymentVerificationDetails.getLabelVerificationChannel().text - assert ( - str((datetime.now() - relativedelta(months=1)).strftime("%-d %b %Y")) - in pagePaymentVerificationDetails.getLabelActivationDate().text - ) - assert "-" in pagePaymentVerificationDetails.getLabelCompletionDate().text def test_happy_path_payment_verification( self, From a8350044b7a9edbf29f7836d7b08a9d034fbbcfc Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 13:01:20 +0100 Subject: [PATCH 08/32] e2e --- development_tools/local_selenium_init.sh | 2 +- .../grievance/migrations/0004_migration.py | 28 ------------ .../migrate_cash_assist_models.py | 43 +++++++++++++++---- tests/selenium/conftest.py | 1 - .../test_grievance_tickets.py | 2 +- .../test_payment_verification.py | 2 +- 6 files changed, 38 insertions(+), 40 deletions(-) diff --git a/development_tools/local_selenium_init.sh b/development_tools/local_selenium_init.sh index 0643768d0e..435ae593e7 100755 --- a/development_tools/local_selenium_init.sh +++ b/development_tools/local_selenium_init.sh @@ -37,7 +37,7 @@ export CACHE_LOCATION=redis://localhost:6379/1 export USE_DUMMY_EXCHANGE_RATES=yes export ELASTICSEARCH_HOST=http://localhost:9200 export CELERY_TASK_ALWAYS_EAGER=true -# export LIBRARY_PATHS=true +export LIBRARY_PATHS=true SCRIPT_DIR=$(realpath "$(dirname $0)") MAIN_DIR=$(realpath $SCRIPT_DIR/..) echo "SCRIPT_DIR: $SCRIPT_DIR" diff --git a/src/hct_mis_api/apps/grievance/migrations/0004_migration.py b/src/hct_mis_api/apps/grievance/migrations/0004_migration.py index 65364def52..099d8f21a4 100644 --- a/src/hct_mis_api/apps/grievance/migrations/0004_migration.py +++ b/src/hct_mis_api/apps/grievance/migrations/0004_migration.py @@ -3,30 +3,6 @@ from django.db import migrations, models -def migrate_payment_tickets_generic_foreign_key_to_onetoone(apps, schema_editor): - TicketComplaintDetails = apps.get_model("grievance", "TicketComplaintDetails") - TicketSensitiveDetails = apps.get_model("grievance", "TicketSensitiveDetails") - - Payment = apps.get_model("payment", "Payment") - ContentType = apps.get_model("contenttypes", "ContentType") - - ticket_complaint_details_to_update = [] - ticket_sensitive_details_to_update = [] - - for model in [TicketComplaintDetails, TicketSensitiveDetails]: - for ticket_details in model.objects.exclude(payment_content_type__isnull=True, payment_object_id__isnull=True): - if ticket_details.payment_content_type.model == "payment": - related_instance = Payment.objects.get(id=ticket_details.payment_object_id) - ticket_details.payment = related_instance - if model == TicketComplaintDetails: - ticket_complaint_details_to_update.append(ticket_details) - else: - ticket_sensitive_details_to_update.append(ticket_details) - - TicketComplaintDetails.objects.bulk_update(ticket_complaint_details_to_update, ["payment"]) - TicketSensitiveDetails.objects.bulk_update(ticket_sensitive_details_to_update, ["payment"]) - - class Migration(migrations.Migration): dependencies = [ @@ -55,8 +31,4 @@ class Migration(migrations.Migration): related_name="ticket_sensitive_details", ), ), - migrations.RunPython( - migrate_payment_tickets_generic_foreign_key_to_onetoone, - migrations.RunPython.noop, - ), ] diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py index 3d46b810cd..f290f4d78e 100644 --- a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -22,6 +22,11 @@ create_payment_plan_snapshot_data, ) +content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) +content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) +content_type_for_payment = ContentType.objects.get_for_model(Payment) +content_type_for_payment_record = ContentType.objects.get_for_model(PaymentRecord) + def get_status(status: str) -> str: mapping = {"Transaction Successful": "Distribution Successful"} @@ -29,11 +34,6 @@ def get_status(status: str) -> str: def migrate_cash_plan_to_payment_plan() -> None: - content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) - content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) - content_type_for_payment = ContentType.objects.get_for_model(Payment) - content_type_for_payment_record = ContentType.objects.get_for_model(PaymentRecord) - delivery_type_to_obj = {obj.name: obj for obj in DeliveryMechanism.objects.all()} for sp in ServiceProvider.objects.all(): @@ -245,7 +245,7 @@ def migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() -> No for verification_plan in PaymentVerificationPlan.objects.exclude( payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True ): - if verification_plan.payment_plan_content_type.model == "paymentplan": + if verification_plan.payment_plan_content_type == content_type_for_payment_plan: payment_plan = PaymentPlan.objects.get(id=verification_plan.payment_plan_object_id) verification_plan.payment_plan = payment_plan verification_plans_to_update.append(verification_plan) @@ -259,7 +259,7 @@ def migrate_payment_verification_summary_generic_foreign_key_to_onetoone() -> No for verification_summary in PaymentVerificationSummary.objects.exclude( payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True ): - if verification_summary.payment_plan_content_type.model == "paymentplan": + if verification_summary.payment_plan_content_type == content_type_for_payment_plan: related_instance = PaymentPlan.objects.get(id=verification_summary.payment_plan_object_id) verification_summary.payment_plan = related_instance verification_summaries_to_update.append(verification_summary) @@ -273,7 +273,7 @@ def migrate_payment_verification_generic_foreign_key_to_onetoone() -> None: for verification in PaymentVerification.objects.exclude( payment_content_type__isnull=True, payment_object_id__isnull=True ): - if verification.payment_content_type.model == "payment": + if verification.payment_content_type == content_type_for_payment: related_instance = Payment.objects.get(id=verification.payment_object_id) verification.payment = related_instance verifications_to_update.append(verification) @@ -285,3 +285,30 @@ def migrate_payment_verification_models() -> None: migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() migrate_payment_verification_summary_generic_foreign_key_to_onetoone() migrate_payment_verification_generic_foreign_key_to_onetoone() + + +def migrate_payment_tickets_generic_foreign_key_to_onetoone() -> None: + with transaction.atomic(): + ticket_complaint_details_to_update = [] + ticket_sensitive_details_to_update = [] + + for model in [TicketComplaintDetails, TicketSensitiveDetails]: + for ticket_details in model.objects.exclude( + payment_content_type__isnull=True, payment_object_id__isnull=True + ): + if ticket_details.payment_content_type == content_type_for_payment: + related_instance = Payment.objects.get(id=ticket_details.payment_object_id) + ticket_details.payment = related_instance + if model == TicketComplaintDetails: + ticket_complaint_details_to_update.append(ticket_details) + else: + ticket_sensitive_details_to_update.append(ticket_details) + + TicketComplaintDetails.objects.bulk_update(ticket_complaint_details_to_update, ["payment"]) + TicketSensitiveDetails.objects.bulk_update(ticket_sensitive_details_to_update, ["payment"]) + + +def migrate_cash_assist_models() -> None: + migrate_cash_plan_to_payment_plan() + migrate_payment_verification_models() + migrate_payment_tickets_generic_foreign_key_to_onetoone() diff --git a/tests/selenium/conftest.py b/tests/selenium/conftest.py index b93b9561a8..d29b9e23eb 100644 --- a/tests/selenium/conftest.py +++ b/tests/selenium/conftest.py @@ -561,7 +561,6 @@ def create_super_user(business_area: BusinessArea) -> User: country = Country.objects.get(name="Afghanistan") business_area.countries.add(country) user = UserFactory.create( - pk="4196c2c5-c2dd-48d2-887f-3a9d39e78916", is_superuser=True, is_staff=True, username="superuser", diff --git a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py index 32b50224ff..7e5c2d2a5d 100644 --- a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py +++ b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py @@ -83,7 +83,7 @@ def household_social_worker() -> Household: @pytest.fixture def hh_with_payment_record(household_without_disabilities: Household) -> Payment: payment_plan = PaymentPlanFactory( - program=household_without_disabilities.program, + program_cycle=household_without_disabilities.program.cycles.first(), business_area=household_without_disabilities.business_area, ) payment = PaymentFactory( diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index a9c1f511fd..a8dc89dd43 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -349,7 +349,7 @@ def test_happy_path_payment_verification( pagePaymentVerificationDetails.getRows()[0].find_elements(By.TAG_NAME, "a")[0].click() payment_record = PR.objects.first() - assert "Payment Record" in pagePaymentRecord.getPageHeaderTitle().text + assert "Payment" in pagePaymentRecord.getPageHeaderTitle().text assert "VERIFY" in pagePaymentRecord.getButtonEdPlan().text assert "DELIVERED FULLY" in pagePaymentRecord.getLabelStatus()[0].text assert "DELIVERED FULLY" in pagePaymentRecord.getStatusContainer().text From 620d2803e8ea53978c1ae44c6d90363acd4d7109 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 14:11:10 +0100 Subject: [PATCH 09/32] e2e --- .../migrate_cash_assist_models.py | 19 +++++++++++++++---- tests/selenium/conftest.py | 17 ++++++++++------- .../test_payment_verification.py | 5 ++--- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py index f290f4d78e..d2cb7d50ce 100644 --- a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -1,3 +1,5 @@ +import logging + from django.contrib.contenttypes.models import ContentType from django.db import transaction @@ -22,6 +24,9 @@ create_payment_plan_snapshot_data, ) +logger = logging.getLogger(__name__) + + content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) content_type_for_payment = ContentType.objects.get_for_model(Payment) @@ -34,6 +39,7 @@ def get_status(status: str) -> str: def migrate_cash_plan_to_payment_plan() -> None: + logger.info("**Migrating Cash Plan to Payment Plan**") delivery_type_to_obj = {obj.name: obj for obj in DeliveryMechanism.objects.all()} for sp in ServiceProvider.objects.all(): @@ -240,6 +246,7 @@ def migrate_cash_plan_to_payment_plan() -> None: def migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() -> None: + logger.info("*Migrating Payment Verification Plan*") with transaction.atomic(): verification_plans_to_update = [] for verification_plan in PaymentVerificationPlan.objects.exclude( @@ -254,6 +261,7 @@ def migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() -> No def migrate_payment_verification_summary_generic_foreign_key_to_onetoone() -> None: + logger.info("*Migrating Payment Verification Summary*") with transaction.atomic(): verification_summaries_to_update = [] for verification_summary in PaymentVerificationSummary.objects.exclude( @@ -268,6 +276,7 @@ def migrate_payment_verification_summary_generic_foreign_key_to_onetoone() -> No def migrate_payment_verification_generic_foreign_key_to_onetoone() -> None: + logger.info("*Migrating Payment Verification*") with transaction.atomic(): verifications_to_update = [] for verification in PaymentVerification.objects.exclude( @@ -282,20 +291,21 @@ def migrate_payment_verification_generic_foreign_key_to_onetoone() -> None: def migrate_payment_verification_models() -> None: + logger.info("**Migrating Payment Verification models**") migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() migrate_payment_verification_summary_generic_foreign_key_to_onetoone() migrate_payment_verification_generic_foreign_key_to_onetoone() def migrate_payment_tickets_generic_foreign_key_to_onetoone() -> None: + logger.info("*Migrating Payment Tickets*") with transaction.atomic(): ticket_complaint_details_to_update = [] ticket_sensitive_details_to_update = [] - for model in [TicketComplaintDetails, TicketSensitiveDetails]: - for ticket_details in model.objects.exclude( - payment_content_type__isnull=True, payment_object_id__isnull=True - ): + tickets = model.objects.exclude(payment_content_type__isnull=True, payment_object_id__isnull=True) + logger.info(f"Processing {model.__name__} with {tickets.count()} records") + for ticket_details in tickets: if ticket_details.payment_content_type == content_type_for_payment: related_instance = Payment.objects.get(id=ticket_details.payment_object_id) ticket_details.payment = related_instance @@ -309,6 +319,7 @@ def migrate_payment_tickets_generic_foreign_key_to_onetoone() -> None: def migrate_cash_assist_models() -> None: + logger.info("***Migrating Cash Assist models to Payment models***") migrate_cash_plan_to_payment_plan() migrate_payment_verification_models() migrate_payment_tickets_generic_foreign_key_to_onetoone() diff --git a/tests/selenium/conftest.py b/tests/selenium/conftest.py index d29b9e23eb..d2e2926c42 100644 --- a/tests/selenium/conftest.py +++ b/tests/selenium/conftest.py @@ -560,13 +560,16 @@ def create_super_user(business_area: BusinessArea) -> User: call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/geo/fixtures/data_small.json", verbosity=0) country = Country.objects.get(name="Afghanistan") business_area.countries.add(country) - user = UserFactory.create( - is_superuser=True, - is_staff=True, - username="superuser", - password="testtest2", - email="test@example.com", - partner=partner, + user = UserFactory.get_or_create( + pk="4196c2c5-c2dd-48d2-887f-3a9d39e78916", + defaults=dict( + is_superuser=True, + is_staff=True, + username="superuser", + password="testtest2", + email="test@example.com", + partner=partner, + ), ) UserRole.objects.create( user=user, diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index a8dc89dd43..e692a4b57f 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -20,8 +20,7 @@ PaymentVerificationPlanFactory, PaymentVerificationSummaryFactory, ) -from hct_mis_api.apps.payment.models import GenericPayment, PaymentPlan -from hct_mis_api.apps.payment.models import PaymentRecord as PR +from hct_mis_api.apps.payment.models import GenericPayment, Payment, PaymentPlan from hct_mis_api.apps.payment.models import PaymentVerification as PV from hct_mis_api.apps.payment.models import PaymentVerificationPlan from hct_mis_api.apps.program.fixtures import ProgramFactory @@ -348,7 +347,7 @@ def test_happy_path_payment_verification( pagePaymentVerificationDetails.getButtonSubmit().click() pagePaymentVerificationDetails.getRows()[0].find_elements(By.TAG_NAME, "a")[0].click() - payment_record = PR.objects.first() + payment_record = Payment.objects.first() assert "Payment" in pagePaymentRecord.getPageHeaderTitle().text assert "VERIFY" in pagePaymentRecord.getButtonEdPlan().text assert "DELIVERED FULLY" in pagePaymentRecord.getLabelStatus()[0].text From 6fcee97d6c31c4f2dd5335c33e113c632a6f4cc0 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 14:27:37 +0100 Subject: [PATCH 10/32] e2e --- tests/selenium/conftest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/selenium/conftest.py b/tests/selenium/conftest.py index d2e2926c42..ea5f47144e 100644 --- a/tests/selenium/conftest.py +++ b/tests/selenium/conftest.py @@ -560,17 +560,18 @@ def create_super_user(business_area: BusinessArea) -> User: call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/geo/fixtures/data_small.json", verbosity=0) country = Country.objects.get(name="Afghanistan") business_area.countries.add(country) - user = UserFactory.get_or_create( - pk="4196c2c5-c2dd-48d2-887f-3a9d39e78916", - defaults=dict( + + user = User.objects.filter(pk="4196c2c5-c2dd-48d2-887f-3a9d39e78916").first() + if not user: + user = UserFactory.create( + pk="4196c2c5-c2dd-48d2-887f-3a9d39e78916", is_superuser=True, is_staff=True, username="superuser", password="testtest2", email="test@example.com", partner=partner, - ), - ) + ) UserRole.objects.create( user=user, role=Role.objects.get(name="Role"), From cc11cf28b2aac1f31db490b390484291cd5ccacb Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Wed, 27 Nov 2024 15:29:42 +0100 Subject: [PATCH 11/32] script fix --- .../apps/payment/migrations/0003_migration.py | 5 + src/hct_mis_api/apps/payment/models.py | 1 + .../migrate_cash_assist_models.py | 438 ++++++++---------- 3 files changed, 198 insertions(+), 246 deletions(-) diff --git a/src/hct_mis_api/apps/payment/migrations/0003_migration.py b/src/hct_mis_api/apps/payment/migrations/0003_migration.py index 2ff219155d..6989a81707 100644 --- a/src/hct_mis_api/apps/payment/migrations/0003_migration.py +++ b/src/hct_mis_api/apps/payment/migrations/0003_migration.py @@ -16,6 +16,11 @@ class Migration(migrations.Migration): name="is_migrated_to_payment_plan", field=models.BooleanField(default=False), ), + migrations.AddField( + model_name="serviceprovider", + name="is_migrated_to_payment_plan", + field=models.BooleanField(default=False), + ), migrations.AddField( model_name="paymentplan", name="internal_data", diff --git a/src/hct_mis_api/apps/payment/models.py b/src/hct_mis_api/apps/payment/models.py index baa7662171..e200eabd86 100644 --- a/src/hct_mis_api/apps/payment/models.py +++ b/src/hct_mis_api/apps/payment/models.py @@ -2055,6 +2055,7 @@ class ServiceProvider(TimeStampedUUIDModel): short_name = models.CharField(max_length=100, null=True) country = models.CharField(max_length=3) vision_id = models.CharField(max_length=255, null=True) + is_migrated_to_payment_plan = models.BooleanField(default=False) def __str__(self) -> str: return self.full_name or "" diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py index d2cb7d50ce..696e931e00 100644 --- a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -42,13 +42,20 @@ def migrate_cash_plan_to_payment_plan() -> None: logger.info("**Migrating Cash Plan to Payment Plan**") delivery_type_to_obj = {obj.name: obj for obj in DeliveryMechanism.objects.all()} - for sp in ServiceProvider.objects.all(): + logger.info("Creating FinancialServiceProviders") + for sp in ServiceProvider.objects.filter(is_migrated_to_payment_plan=False): + logger.info(f"\nProcessing Service Provider {sp}") if not sp.cash_plans.exists(): + logger.info(f"Service provider {sp} has no cash plans") continue if FinancialServiceProvider.objects.filter(vision_vendor_number=sp.vision_id).exists(): + logger.info(f"FinancialServiceProvider with vision_id {sp.vision_id} already exists") continue + if not sp.vision_id: + raise ValueError(f"Service Provider {sp} does not have vision_id") + delivery_mechanisms = set(sp.cash_plans.all().values_list("delivery_type", flat=True)) fsp = FinancialServiceProvider.objects.create( @@ -64,262 +71,201 @@ def migrate_cash_plan_to_payment_plan() -> None: }, ) fsp.delivery_mechanisms.set([delivery_type_to_obj[dt] for dt in delivery_mechanisms]) + sp.is_migrated_to_payment_plan = True + sp.save(update_fields=["is_migrated_to_payment_plan"]) fsp_vision_vendor_number_to_obj = {obj.vision_vendor_number: obj for obj in FinancialServiceProvider.objects.all()} dm_cash = delivery_type_to_obj["Cash"] - for cp in CashPlan.objects.filter(is_migrated_to_payment_plan=False): - with transaction.atomic(): - if not cp.payment_items.exists(): - continue - - # get target populations from payment records - target_populations = cp.payment_items.values_list("target_population", flat=True).distinct() - # for each target population create a payment plan within tp.payment_cycle - for tp in target_populations: - payment_records = cp.payment_items.filter(target_population=tp) - first_record = payment_records.first() - if first_record.delivery_type: - delivery_mechanism = delivery_type_to_obj[first_record.delivery_type.name] - else: - delivery_mechanism = dm_cash - currency = first_record.currency - - # create payment plan - pp = PaymentPlan.objects.create( - status="FINISHED", - name=tp.name, - business_area_id=tp.business_area.id, - created_by_id=tp.created_by.id, - created_at=tp.created_at, - target_population_id=tp.id, - program_cycle_id=tp.program_cycle.id, - currency=currency, - dispersion_start_date=cp.start_date or tp.program_cycle.start_date, - dispersion_end_date=cp.dispersion_date or tp.program_cycle.end_date, - start_date=cp.start_date or tp.program_cycle.start_date, - end_date=cp.end_date or tp.program_cycle.end_date, - status_date=cp.status_date, - exchange_rate=cp.exchange_rate, - total_entitled_quantity=cp.total_entitled_quantity, - total_entitled_quantity_usd=cp.total_entitled_quantity_usd, - total_entitled_quantity_revised=cp.total_entitled_quantity_revised, - total_entitled_quantity_revised_usd=cp.total_entitled_quantity_revised_usd, - total_delivered_quantity=cp.total_delivered_quantity, - total_delivered_quantity_usd=cp.total_delivered_quantity_usd, - total_undelivered_quantity=cp.total_undelivered_quantity, - total_undelivered_quantity_usd=cp.total_undelivered_quantity_usd, - is_cash_assist=True, - internal_data={ - "name": cp.name, - "ca_hash_id": str(cp.ca_hash_id), - "distribution_level": cp.distribution_level, - "coverage_duration": cp.coverage_duration, - "coverage_unit": cp.coverage_unit, - "comments": cp.comments, - "assistance_measurement": cp.assistance_measurement, - "assistance_through": cp.assistance_through, - "vision_id": cp.vision_id, - "funds_commitment": cp.funds_commitment, - "down_payment": cp.down_payment, - "validation_alerts_count": cp.validation_alerts_count, - "total_persons_covered": cp.total_persons_covered, - "total_persons_covered_revised": cp.total_persons_covered_revised, - }, - ) - pp.unicef_id = cp.ca_id - pp.save(update_fields=["unicef_id"]) - pp.update_population_count_fields() - - if not first_record.service_provider.vision_id: - raise Exception(f"Service provider {first_record.service_provider} vision_id is None") - financial_service_provider = fsp_vision_vendor_number_to_obj.get( - first_record.service_provider.vision_id - ) - if not financial_service_provider: - raise Exception( - f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" + cash_plans = CashPlan.objects.filter(is_migrated_to_payment_plan=False) + logger.info(f"Total Cash Plans to migrate: {cash_plans.count()}") + batch_count = cash_plans.count() // 50 + batch_i = 0 + for batch in cash_plans.iterator(chunk_size=50): + batch_i += 1 + logger.info(f"Processing batch {batch_i}/{batch_count}") + for cp in batch: + with transaction.atomic(): + if not cp.payment_items.exists(): + continue + + # get target populations from payment records + target_populations = cp.payment_items.values_list("target_population", flat=True).distinct() + # for each target population create a payment plan within tp.payment_cycle + for tp in target_populations: + payment_records = cp.payment_items.filter(target_population=tp) + first_record = payment_records.first() + if first_record.delivery_type: + delivery_mechanism = delivery_type_to_obj[first_record.delivery_type.name] + else: + delivery_mechanism = dm_cash + currency = first_record.currency + + # create payment plan + pp = PaymentPlan.objects.create( + status="FINISHED", + name=tp.name, + business_area_id=tp.business_area.id, + created_by_id=tp.created_by.id, + created_at=cp.created_at, + target_population_id=tp.id, + program_cycle_id=tp.program_cycle.id, + currency=currency, + dispersion_start_date=cp.start_date or tp.program_cycle.start_date, + dispersion_end_date=cp.dispersion_date or tp.program_cycle.end_date, + start_date=cp.start_date or tp.program_cycle.start_date, + end_date=cp.end_date or tp.program_cycle.end_date, + status_date=cp.status_date, + exchange_rate=cp.exchange_rate, + total_entitled_quantity=cp.total_entitled_quantity, + total_entitled_quantity_usd=cp.total_entitled_quantity_usd, + total_entitled_quantity_revised=cp.total_entitled_quantity_revised, + total_entitled_quantity_revised_usd=cp.total_entitled_quantity_revised_usd, + total_delivered_quantity=cp.total_delivered_quantity, + total_delivered_quantity_usd=cp.total_delivered_quantity_usd, + total_undelivered_quantity=cp.total_undelivered_quantity, + total_undelivered_quantity_usd=cp.total_undelivered_quantity_usd, + is_cash_assist=True, + internal_data={ + "name": cp.name, + "ca_hash_id": str(cp.ca_hash_id), + "distribution_level": cp.distribution_level, + "coverage_duration": cp.coverage_duration, + "coverage_unit": cp.coverage_unit, + "comments": cp.comments, + "assistance_measurement": cp.assistance_measurement, + "assistance_through": cp.assistance_through, + "vision_id": cp.vision_id, + "funds_commitment": cp.funds_commitment, + "down_payment": cp.down_payment, + "validation_alerts_count": cp.validation_alerts_count, + "total_persons_covered": cp.total_persons_covered, + "total_persons_covered_revised": cp.total_persons_covered_revised, + }, ) + pp.unicef_id = cp.ca_id + pp.save(update_fields=["unicef_id"]) + pp.update_population_count_fields() - DeliveryMechanismPerPaymentPlan.objects.update_or_create( - payment_plan_id=pp.id, - delivery_mechanism_id=delivery_mechanism.id, - sent_date=cp.status_date, - delivery_mechanism_order=1, - created_by_id=tp.created_by.id, - created_at=tp.created_at, - financial_service_provider_id=financial_service_provider.id, - ) - - # migrate payment verification summary, payment verification plans - - payment_verification_summary = PaymentVerificationSummary.objects.filter( - payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk - ).first() - if payment_verification_summary: - payment_verification_summary.payment_plan_content_type_id = content_type_for_payment_plan.id - payment_verification_summary.payment_plan_object_id = pp.id - payment_verification_summary.payment_plan = pp - payment_verification_summary.save() - - payment_verification_plan = PaymentVerificationPlan.objects.filter( - payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk - ).first() - if payment_verification_plan: - payment_verification_plan.payment_plan_content_type_id = content_type_for_payment_plan.id - payment_verification_plan.payment_plan_object_id = pp.id - payment_verification_plan.payment_plan = pp - payment_verification_plan.save() - - with transaction.atomic(): - for record in cp.payment_items.filter(target_population=tp).prefetch_related("service_provider"): - financial_service_provider = fsp_vision_vendor_number_to_obj.get( - record.service_provider.vision_id - ) - payment = Payment.objects.create( - parent_id=pp.id, - business_area_id=pp.business_area.id, - status=get_status(record.status), - status_date=record.status_date, - household_id=record.household_id, - head_of_household_id=record.head_of_household_id, - collector_id=record.head_of_household_id, - delivery_type_id=record.delivery_type_id, - currency=record.currency, - entitlement_quantity=record.entitlement_quantity, - entitlement_quantity_usd=record.entitlement_quantity_usd, - delivered_quantity=record.delivered_quantity, - delivered_quantity_usd=record.delivered_quantity_usd, - delivery_date=record.delivery_date, - transaction_reference_id=record.transaction_reference_id, - transaction_status_blockchain_link=record.transaction_status_blockchain_link, - financial_service_provider=financial_service_provider, - program_id=tp.program_cycle.program_id, - is_cash_assist=True, - internal_data={ - "ca_hash_id": str(record.ca_hash_id), - "full_name": record.full_name, - "total_persons_covered": record.total_persons_covered, - "distribution_modality": record.distribution_modality, - "target_population_cash_assist_id": record.target_population_cash_assist_id, - "target_population": str(record.target_population_id), - "entitlement_card_number": record.entitlement_card_number, - "entitlement_card_status": record.entitlement_card_status, - "entitlement_card_issue_date": str(record.entitlement_card_issue_date), - "vision_id": record.vision_id, - "registration_ca_id": record.registration_ca_id, - "service_provider": str(record.service_provider_id), - }, + financial_service_provider = fsp_vision_vendor_number_to_obj.get( + first_record.service_provider.vision_id + ) + if not financial_service_provider: + logger.error( + f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" + f"Cash Plan: {cp}" + f"Record: {first_record}" + f"Service Provider: {first_record.service_provider}" ) - payment.unicef_id = record.ca_id - payment.save(update_fields=["unicef_id"]) - - payment_record_verification = PaymentVerification.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if payment_record_verification: - payment_record_verification.payment_content_type_id = content_type_for_payment.id - payment_record_verification.payment_object_id = payment.id - payment_record_verification.save() - - ticket_complaint_details = TicketComplaintDetails.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if ticket_complaint_details: - ticket_complaint_details.payment_content_type_id = content_type_for_payment.id - ticket_complaint_details.payment_object_id = payment.id - ticket_complaint_details.save() - - ticket_sensitive_details = TicketSensitiveDetails.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if ticket_sensitive_details: - ticket_sensitive_details.payment_content_type_id = content_type_for_payment.id - ticket_sensitive_details.payment_object_id = payment.id - ticket_sensitive_details.save() - - create_payment_plan_snapshot_data(pp) - - cp.is_migrated_to_payment_plan = True - cp.save(update_fields=["is_migrated_to_payment_plan"]) - - -def migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() -> None: - logger.info("*Migrating Payment Verification Plan*") - with transaction.atomic(): - verification_plans_to_update = [] - for verification_plan in PaymentVerificationPlan.objects.exclude( - payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True - ): - if verification_plan.payment_plan_content_type == content_type_for_payment_plan: - payment_plan = PaymentPlan.objects.get(id=verification_plan.payment_plan_object_id) - verification_plan.payment_plan = payment_plan - verification_plans_to_update.append(verification_plan) - - PaymentVerificationPlan.objects.bulk_update(verification_plans_to_update, ["payment_plan"]) - - -def migrate_payment_verification_summary_generic_foreign_key_to_onetoone() -> None: - logger.info("*Migrating Payment Verification Summary*") - with transaction.atomic(): - verification_summaries_to_update = [] - for verification_summary in PaymentVerificationSummary.objects.exclude( - payment_plan_content_type__isnull=True, payment_plan_object_id__isnull=True - ): - if verification_summary.payment_plan_content_type == content_type_for_payment_plan: - related_instance = PaymentPlan.objects.get(id=verification_summary.payment_plan_object_id) - verification_summary.payment_plan = related_instance - verification_summaries_to_update.append(verification_summary) - - PaymentVerificationSummary.objects.bulk_update(verification_summaries_to_update, ["payment_plan"]) - - -def migrate_payment_verification_generic_foreign_key_to_onetoone() -> None: - logger.info("*Migrating Payment Verification*") - with transaction.atomic(): - verifications_to_update = [] - for verification in PaymentVerification.objects.exclude( - payment_content_type__isnull=True, payment_object_id__isnull=True - ): - if verification.payment_content_type == content_type_for_payment: - related_instance = Payment.objects.get(id=verification.payment_object_id) - verification.payment = related_instance - verifications_to_update.append(verification) - - PaymentVerification.objects.bulk_update(verifications_to_update, ["payment"]) - - -def migrate_payment_verification_models() -> None: - logger.info("**Migrating Payment Verification models**") - migrate_payment_verification_plan_generic_foreign_key_to_foreign_key() - migrate_payment_verification_summary_generic_foreign_key_to_onetoone() - migrate_payment_verification_generic_foreign_key_to_onetoone() - - -def migrate_payment_tickets_generic_foreign_key_to_onetoone() -> None: - logger.info("*Migrating Payment Tickets*") - with transaction.atomic(): - ticket_complaint_details_to_update = [] - ticket_sensitive_details_to_update = [] - for model in [TicketComplaintDetails, TicketSensitiveDetails]: - tickets = model.objects.exclude(payment_content_type__isnull=True, payment_object_id__isnull=True) - logger.info(f"Processing {model.__name__} with {tickets.count()} records") - for ticket_details in tickets: - if ticket_details.payment_content_type == content_type_for_payment: - related_instance = Payment.objects.get(id=ticket_details.payment_object_id) - ticket_details.payment = related_instance - if model == TicketComplaintDetails: - ticket_complaint_details_to_update.append(ticket_details) - else: - ticket_sensitive_details_to_update.append(ticket_details) + continue + + DeliveryMechanismPerPaymentPlan.objects.update_or_create( + payment_plan_id=pp.id, + delivery_mechanism_id=delivery_mechanism.id, + sent_date=cp.status_date, + delivery_mechanism_order=1, + created_by_id=tp.created_by.id, + created_at=tp.created_at, + financial_service_provider_id=financial_service_provider.id, + ) - TicketComplaintDetails.objects.bulk_update(ticket_complaint_details_to_update, ["payment"]) - TicketSensitiveDetails.objects.bulk_update(ticket_sensitive_details_to_update, ["payment"]) + payment_verification_summary = PaymentVerificationSummary.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_summary: + payment_verification_summary.payment_plan_content_type_id = content_type_for_payment_plan.id + payment_verification_summary.payment_plan_object_id = pp.id + payment_verification_summary.payment_plan = pp + payment_verification_summary.save() + + payment_verification_plan = PaymentVerificationPlan.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_plan: + payment_verification_plan.payment_plan_content_type_id = content_type_for_payment_plan.id + payment_verification_plan.payment_plan_object_id = pp.id + payment_verification_plan.payment_plan = pp + payment_verification_plan.save() + + with transaction.atomic(): + for record in cp.payment_items.filter(target_population=tp).prefetch_related( + "service_provider" + ): + financial_service_provider = fsp_vision_vendor_number_to_obj.get( + record.service_provider.vision_id + ) + payment = Payment.objects.create( + parent_id=pp.id, + business_area_id=pp.business_area.id, + status=get_status(record.status), + status_date=record.status_date, + household_id=record.household_id, + head_of_household_id=record.head_of_household_id, + collector_id=record.head_of_household_id, + delivery_type_id=record.delivery_type_id, + currency=record.currency, + entitlement_quantity=record.entitlement_quantity, + entitlement_quantity_usd=record.entitlement_quantity_usd, + delivered_quantity=record.delivered_quantity, + delivered_quantity_usd=record.delivered_quantity_usd, + delivery_date=record.delivery_date, + transaction_reference_id=record.transaction_reference_id, + transaction_status_blockchain_link=record.transaction_status_blockchain_link, + financial_service_provider=financial_service_provider, + program_id=tp.program_cycle.program_id, + is_cash_assist=True, + internal_data={ + "ca_hash_id": str(record.ca_hash_id), + "full_name": record.full_name, + "total_persons_covered": record.total_persons_covered, + "distribution_modality": record.distribution_modality, + "target_population_cash_assist_id": record.target_population_cash_assist_id, + "target_population": str(record.target_population_id), + "entitlement_card_number": record.entitlement_card_number, + "entitlement_card_status": record.entitlement_card_status, + "entitlement_card_issue_date": str(record.entitlement_card_issue_date), + "vision_id": record.vision_id, + "registration_ca_id": record.registration_ca_id, + "service_provider": str(record.service_provider_id), + }, + ) + payment.unicef_id = record.ca_id + payment.save(update_fields=["unicef_id"]) + + payment_record_verification = PaymentVerification.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if payment_record_verification: + payment_record_verification.payment_content_type_id = content_type_for_payment.id + payment_record_verification.payment_object_id = payment.id + payment_record_verification.payment = payment + payment_record_verification.save() + + ticket_complaint_details = TicketComplaintDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_complaint_details: + ticket_complaint_details.payment_content_type_id = content_type_for_payment.id + ticket_complaint_details.payment_object_id = payment.id + ticket_complaint_details.payment = payment + ticket_complaint_details.save() + + ticket_sensitive_details = TicketSensitiveDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_sensitive_details: + ticket_sensitive_details.payment_content_type_id = content_type_for_payment.id + ticket_sensitive_details.payment_object_id = payment.id + ticket_sensitive_details.payment = payment + ticket_sensitive_details.save() + + create_payment_plan_snapshot_data(pp) + + cp.is_migrated_to_payment_plan = True + cp.save(update_fields=["is_migrated_to_payment_plan"]) def migrate_cash_assist_models() -> None: logger.info("***Migrating Cash Assist models to Payment models***") migrate_cash_plan_to_payment_plan() - migrate_payment_verification_models() - migrate_payment_tickets_generic_foreign_key_to_onetoone() From 9b33d667bbbe68e6cf8094213273850ea95bb426 Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 28 Nov 2024 12:20:18 +0100 Subject: [PATCH 12/32] Fix e2e tests --- .../selenium/page_object/payment_verification/payment_record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/selenium/page_object/payment_verification/payment_record.py b/tests/selenium/page_object/payment_verification/payment_record.py index 7ddce2017d..2a2403b0eb 100644 --- a/tests/selenium/page_object/payment_verification/payment_record.py +++ b/tests/selenium/page_object/payment_verification/payment_record.py @@ -9,7 +9,7 @@ class PaymentRecord(BaseComponents): buttonEdPlan = 'button[data-cy="button-ed-plan"]' labelStatus = 'div[data-cy="label-STATUS"]' statusContainer = 'div[data-cy="status-container"]' - labelHousehold = 'div[data-cy="label-Household"]' + labelHousehold = 'div[data-cy="label-HOUSEHOLD ID"]' labelTargetPopulation = 'div[data-cy="label-TARGET POPULATION"]' labelDistributionModality = 'div[data-cy="label-DISTRIBUTION MODALITY"]' labelAmountReceived = 'div[data-cy="label-AMOUNT RECEIVED"]' From f374509292eb7711bbbaf295c8a05c68ff8001d0 Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 28 Nov 2024 12:21:59 +0100 Subject: [PATCH 13/32] Fix e2e tests --- .../selenium/payment_verification/test_payment_verification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index e692a4b57f..e2c932cce2 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -353,7 +353,7 @@ def test_happy_path_payment_verification( assert "DELIVERED FULLY" in pagePaymentRecord.getLabelStatus()[0].text assert "DELIVERED FULLY" in pagePaymentRecord.getStatusContainer().text assert payment_record.household.unicef_id in pagePaymentRecord.getLabelHousehold().text - assert payment_record.target_population.name in pagePaymentRecord.getLabelTargetPopulation().text + assert payment_record.parent.target_population.name in pagePaymentRecord.getLabelTargetPopulation().text assert payment_record.distribution_modality in pagePaymentRecord.getLabelDistributionModality().text assert payment_record.verification.status in pagePaymentRecord.getLabelStatus()[1].text assert "PLN 0.00" in pagePaymentRecord.getLabelAmountReceived().text From 910281f063cde1e61b5323bab940baf6d257b47a Mon Sep 17 00:00:00 2001 From: Szymon Wyderka Date: Thu, 28 Nov 2024 13:41:11 +0100 Subject: [PATCH 14/32] Fix e2e tests --- .../payment_verification/test_payment_verification.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index e2c932cce2..c36eb84828 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -354,15 +354,15 @@ def test_happy_path_payment_verification( assert "DELIVERED FULLY" in pagePaymentRecord.getStatusContainer().text assert payment_record.household.unicef_id in pagePaymentRecord.getLabelHousehold().text assert payment_record.parent.target_population.name in pagePaymentRecord.getLabelTargetPopulation().text - assert payment_record.distribution_modality in pagePaymentRecord.getLabelDistributionModality().text - assert payment_record.verification.status in pagePaymentRecord.getLabelStatus()[1].text + assert payment_record.parent.unicef_id in pagePaymentRecord.getLabelDistributionModality().text + assert payment_record.payment_verification.status in pagePaymentRecord.getLabelStatus()[1].text assert "PLN 0.00" in pagePaymentRecord.getLabelAmountReceived().text assert payment_record.household.unicef_id in pagePaymentRecord.getLabelHouseholdId().text assert "21.36" in pagePaymentRecord.getLabelEntitlementQuantity().text assert "21.36" in pagePaymentRecord.getLabelDeliveredQuantity().text assert "PLN" in pagePaymentRecord.getLabelCurrency().text - assert "-" in pagePaymentRecord.getLabelDeliveryType().text - assert payment_record.service_provider.full_name in pagePaymentRecord.getLabelFsp().text + assert payment_record.delivery_type.name in pagePaymentRecord.getLabelDeliveryType().text + assert payment_record.financial_service_provider.name in pagePaymentRecord.getLabelFsp().text pagePaymentRecord.getButtonEdPlan().click() From 620b8dc46a676f662d8008c911affa10be87ce9c Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 14:02:10 +0100 Subject: [PATCH 15/32] schema --- src/frontend/data/schema.graphql | 447 +---- src/frontend/src/__generated__/graphql.tsx | 1858 ++------------------ 2 files changed, 148 insertions(+), 2157 deletions(-) diff --git a/src/frontend/data/schema.graphql b/src/frontend/data/schema.graphql index 2f8e6fb271..64a5080be7 100644 --- a/src/frontend/data/schema.graphql +++ b/src/frontend/data/schema.graphql @@ -353,10 +353,7 @@ type BusinessAreaNode implements Node { ruleSet(offset: Int, before: String, after: String, first: Int, last: Int): SteficonRuleNodeConnection! paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! - serviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): ServiceProviderNodeConnection! tickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! programSet(offset: Int, before: String, after: String, first: Int, last: Int, name: String): ProgramNodeConnection! @@ -406,75 +403,6 @@ type CashPlanAndPaymentPlanNode { serviceProviderFullName: String } -type CashPlanNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - version: BigInt! - businessArea: UserBusinessAreaNode! - statusDate: DateTime! - startDate: DateTime - endDate: DateTime - program: ProgramNode! - exchangeRate: Float - totalEntitledQuantity: Float - totalEntitledQuantityUsd: Float - totalEntitledQuantityRevised: Float - totalEntitledQuantityRevisedUsd: Float - totalDeliveredQuantity: Float - totalDeliveredQuantityUsd: Float - totalUndeliveredQuantity: Float - totalUndeliveredQuantityUsd: Float - name: String! - caId: String - caHashId: UUID - status: CashPlanStatus! - distributionLevel: String! - dispersionDate: DateTime! - coverageDuration: Int! - coverageUnit: String! - comments: String - deliveryType: String - assistanceMeasurement: String! - assistanceThrough: String! - serviceProvider: ServiceProviderNode - visionId: String - fundsCommitment: String - downPayment: String - validationAlertsCount: Int! - totalPersonsCovered: Int! - totalPersonsCoveredRevised: Int! - paymentItems(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! - bankReconciliationSuccess: Int - bankReconciliationError: Int - totalNumberOfHouseholds: Int - currency: String - canCreatePaymentVerificationPlan: Boolean - availablePaymentRecordsCount: Int - verificationPlans(offset: Int, before: String, after: String, first: Int, last: Int, programId: String): PaymentVerificationPlanNodeConnection - paymentVerificationSummary: PaymentVerificationSummaryNode - unicefId: String -} - -type CashPlanNodeConnection { - pageInfo: PageInfo! - edges: [CashPlanNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type CashPlanNodeEdge { - node: CashPlanNode - cursor: String! -} - -enum CashPlanStatus { - DISTRIBUTION_COMPLETED - DISTRIBUTION_COMPLETED_WITH_ERRORS - TRANSACTION_COMPLETED - TRANSACTION_COMPLETED_WITH_ERRORS -} - input CategoryExtrasInput { sensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras grievanceComplaintTicketExtras: GrievanceComplaintTicketExtras @@ -671,18 +599,6 @@ type CreateCommunicationMessageMutation { message: CommunicationMessageNode } -type CreateDashboardReport { - success: Boolean -} - -input CreateDashboardReportInput { - reportTypes: [String]! - businessAreaSlug: String! - year: Int! - adminArea: ID - program: ID -} - input CreateFeedbackInput { issueType: String! householdLookup: ID @@ -1009,7 +925,6 @@ type DeliveryMechanismNode implements Node { transferType: DeliveryMechanismTransferType! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! deliverymechanismperpaymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismPerPaymentPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! deliverymechanismdataSet(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismDataNodeConnection! } @@ -1319,11 +1234,11 @@ type FinancialServiceProviderNode implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! + internalData: JSONString! allowedBusinessAreas(offset: Int, before: String, after: String, first: Int, last: Int, id: UUID): UserBusinessAreaNodeConnection! createdBy: UserNode name: String! visionVendorNumber: String! - deliveryMechanismsChoices: [String!] deliveryMechanisms(offset: Int, before: String, after: String, first: Int, last: Int): DeliveryMechanismNodeConnection! distributionLimit: Float communicationChannel: FinancialServiceProviderCommunicationChannel! @@ -1631,6 +1546,7 @@ type HouseholdNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! withdrawn: Boolean! withdrawnDate: DateTime consentSign: String! @@ -1694,7 +1610,6 @@ type HouseholdNode implements Node { collectIndividualData: HouseholdCollectIndividualData! currency: String unhcrId: String! - userFields: JSONString! detailId: String registrationId: String programRegistrationId: String @@ -1716,7 +1631,6 @@ type HouseholdNode implements Node { copiedTo(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection! individualsAndRoles: [IndividualRoleInHouseholdNode!]! individuals(offset: Int, before: String, after: String, first: Int, last: Int, household_Id: UUID, businessArea: String, fullName: String, fullName_Startswith: String, fullName_Endswith: String, sex: [String], household_AdminArea: ID, withdrawn: Boolean, program: ID, age: String, programs: [ID], search: String, documentType: String, documentNumber: String, lastRegistrationDate: String, admin1: [ID], admin2: [ID], status: [String], excludedId: String, flags: [String], isActiveProgram: Boolean, rdiId: String, duplicatesOnly: Boolean, rdiMergeStatus: String, orderBy: String): IndividualNodeConnection - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! complaintTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection! sensitiveTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection! @@ -1995,6 +1909,7 @@ type IndividualNode implements Node { lastSyncAt: DateTime version: BigInt! unicefId: String + internalData: JSONString! duplicate: Boolean! duplicateDate: DateTime withdrawn: Boolean! @@ -2022,7 +1937,6 @@ type IndividualNode implements Node { firstRegistrationDate: Date! lastRegistrationDate: Date! flexFields: FlexFieldsScalar - userFields: JSONString! enrolledInNutritionProgramme: Boolean administrationOfRutf: Boolean deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus! @@ -2069,9 +1983,8 @@ type IndividualNode implements Node { householdsAndRoles: [IndividualRoleInHouseholdNode!]! copiedTo(offset: Int, before: String, after: String, first: Int, last: Int): IndividualNodeConnection! bankAccountInfo: BankAccountInfoNode - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! - collectorPayments(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + collectorPayments(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! deliveryMechanismsData: [DeliveryMechanismDataNode] complaintTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection! sensitiveTicketDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection! @@ -2346,10 +2259,6 @@ type MarkPaymentAsFailedMutation { payment: PaymentNode } -type MarkPaymentRecordAsFailedMutation { - paymentRecord: PaymentRecordNode -} - type MergeRegistrationDataImportMutation { registrationDataImport: RegistrationDataImportNode } @@ -2368,7 +2277,6 @@ type Mutations { exportSurveySample(surveyId: ID!): ExportSurveySampleMutationMutation createReport(reportData: CreateReportInput!): CreateReport restartCreateReport(reportData: RestartCreateReportInput!): RestartCreateReport - createDashboardReport(reportData: CreateDashboardReportInput!): CreateDashboardReport createGrievanceTicket(input: CreateGrievanceTicketInput!): CreateGrievanceTicketMutation updateGrievanceTicket(input: UpdateGrievanceTicketInput!, version: BigInt): UpdateGrievanceTicketMutation grievanceStatusChange(grievanceTicketId: ID, status: Int, version: BigInt): GrievanceStatusChangeMutation @@ -2396,8 +2304,6 @@ type Mutations { invalidPaymentVerificationPlan(paymentVerificationPlanId: ID!, version: BigInt): InvalidPaymentVerificationPlan deletePaymentVerificationPlan(paymentVerificationPlanId: ID!, version: BigInt): DeletePaymentVerificationPlan updatePaymentVerificationStatusAndReceivedAmount(paymentVerificationId: ID!, receivedAmount: Decimal!, status: PaymentVerificationStatusForUpdate, version: BigInt): UpdatePaymentVerificationStatusAndReceivedAmount - markPaymentRecordAsFailed(paymentRecordId: ID!): MarkPaymentRecordAsFailedMutation - revertMarkPaymentRecordAsFailed(deliveredQuantity: Decimal!, deliveryDate: Date!, paymentRecordId: ID!): RevertMarkPaymentRecordAsFailedMutation markPaymentAsFailed(paymentId: ID!): MarkPaymentAsFailedMutation revertMarkPaymentAsFailed(deliveredQuantity: Decimal!, deliveryDate: Date!, paymentId: ID!): RevertMarkPaymentAsFailedMutation updatePaymentVerificationReceivedAndReceivedAmount(paymentVerificationId: ID!, received: Boolean!, receivedAmount: Decimal!, version: BigInt): UpdatePaymentVerificationReceivedAndReceivedAmount @@ -2551,23 +2457,6 @@ type PaymentConflictDataNode { paymentUnicefId: String } -enum PaymentDeliveryTypeChoice { - CARDLESS_CASH_WITHDRAWAL - CASH - CASH_BY_FSP - CHEQUE - DEPOSIT_TO_CARD - MOBILE_MONEY - PRE_PAID_CARD - REFERRAL - TRANSFER - TRANSFER_TO_ACCOUNT - VOUCHER - ATM_CARD - CASH_OVER_THE_COUNTER - TRANSFER_TO_DIGITAL_WALLET -} - type PaymentDetailsApproveMutation { grievanceTicket: GrievanceTicketNode } @@ -2588,12 +2477,12 @@ type PaymentNode implements Node { updatedAt: DateTime! unicefId: String signatureHash: String! + internalData: JSONString! businessArea: UserBusinessAreaNode! status: PaymentStatus! statusDate: DateTime! household: HouseholdNode! headOfHousehold: IndividualNode - deliveryTypeChoice: PaymentDeliveryTypeChoice deliveryType: DeliveryMechanismNode currency: String! entitlementQuantity: Float @@ -2619,8 +2508,12 @@ type PaymentNode implements Node { additionalDocumentType: String additionalDocumentNumber: String fspAuthCode: String + isCashAssist: Boolean! followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + paymentVerification: PaymentVerificationNode householdSnapshot: PaymentHouseholdSnapshotNode + ticketComplaintDetails: TicketComplaintDetailsNode + ticketSensitiveDetails: TicketSensitiveDetailsNode adminUrl: String paymentPlanHardConflicted: Boolean paymentPlanHardConflictedData: [PaymentConflictDataNode] @@ -2667,172 +2560,6 @@ enum PaymentPlanBackgroundActionStatus { SEND_TO_PAYMENT_GATEWAY_ERROR } -enum PaymentPlanCurrency { - A_ - AED - AFN - ALL - AMD - ANG - AOA - ARS - AUD - AWG - AZN - BAM - BBD - BDT - BGN - BHD - BIF - BMD - BND - BOB - BOV - BRL - BSD - BTN - BWP - BYN - BZD - CAD - CDF - CHF - CLP - CNY - COP - CRC - CUC - CUP - CVE - CZK - DJF - DKK - DOP - DZD - EGP - ERN - ETB - EUR - FJD - FKP - GBP - GEL - GHS - GIP - GMD - GNF - GTQ - GYD - HKD - HNL - HRK - HTG - HUF - IDR - ILS - INR - IQD - IRR - ISK - JMD - JOD - JPY - KES - KGS - KHR - KMF - KPW - KRW - KWD - KYD - KZT - LAK - LBP - LKR - LRD - LSL - LYD - MAD - MDL - MGA - MKD - MMK - MNT - MOP - MRU - MUR - MVR - MWK - MXN - MYR - MZN - NAD - NGN - NIO - NOK - NPR - NZD - OMR - PAB - PEN - PGK - PHP - PKR - PLN - PYG - QAR - RON - RSD - RUB - RWF - SAR - SBD - SCR - SDG - SEK - SGD - SHP - SLL - SOS - SRD - SSP - STN - SVC - SYP - SZL - THB - TJS - TMT - TND - TOP - TRY - TTD - TWD - TZS - UAH - UGX - USD - UYU - UYW - UZS - VES - VND - VUV - WST - XAF - XAG - XAU - XCD - XOF - XPF - YER - ZAR - ZMW - ZWL - USDC -} - type PaymentPlanNode implements Node { isRemoved: Boolean! id: ID! @@ -2840,11 +2567,11 @@ type PaymentPlanNode implements Node { updatedAt: DateTime! version: BigInt! unicefId: String + internalData: JSONString! businessArea: UserBusinessAreaNode! statusDate: DateTime! startDate: Date endDate: Date - program: ProgramNode! exchangeRate: Float totalEntitledQuantity: Float totalEntitledQuantityUsd: Float @@ -2854,12 +2581,12 @@ type PaymentPlanNode implements Node { totalDeliveredQuantityUsd: Float totalUndeliveredQuantity: Float totalUndeliveredQuantityUsd: Float - programCycle: ProgramCycleNode + programCycle: ProgramCycleNode! createdBy: UserNode! status: PaymentPlanStatus! backgroundActionStatus: PaymentPlanBackgroundActionStatus targetPopulation: TargetPopulationNode! - currency: PaymentPlanCurrency! + currency: String dispersionStartDate: Date dispersionEndDate: Date femaleChildrenCount: Int! @@ -2876,9 +2603,12 @@ type PaymentPlanNode implements Node { exclusionReason: String! excludeHouseholdError: String! name: String + isCashAssist: Boolean! followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! deliveryMechanisms: [DeliveryMechanismPerPaymentPlanNode] paymentItems(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! + paymentVerificationPlans(offset: Int, before: String, after: String, first: Int, last: Int): PaymentVerificationPlanNodeConnection! + paymentVerificationSummary: PaymentVerificationSummaryNode approvalProcess(offset: Int, before: String, after: String, first: Int, last: Int): ApprovalProcessNodeConnection! documents(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanSupportingDocumentNodeConnection! adminUrl: String @@ -2890,7 +2620,6 @@ type PaymentPlanNode implements Node { volumeByDeliveryMechanism: [VolumeByDeliveryMechanismNode] splitChoices: [ChoiceObject] verificationPlans(offset: Int, before: String, after: String, first: Int, last: Int, programId: String): PaymentVerificationPlanNodeConnection - paymentVerificationSummary: PaymentVerificationSummaryNode bankReconciliationSuccess: Int bankReconciliationError: Int canCreatePaymentVerificationPlan: Boolean @@ -2904,6 +2633,7 @@ type PaymentPlanNode implements Node { canSendToPaymentGateway: Boolean canSplit: Boolean supportingDocuments: [PaymentPlanSupportingDocumentNode] + program: ProgramNode } type PaymentPlanNodeConnection { @@ -2964,92 +2694,6 @@ type PaymentRecordAndPaymentNode { verification: PaymentVerificationNode } -enum PaymentRecordDeliveryTypeChoice { - CARDLESS_CASH_WITHDRAWAL - CASH - CASH_BY_FSP - CHEQUE - DEPOSIT_TO_CARD - MOBILE_MONEY - PRE_PAID_CARD - REFERRAL - TRANSFER - TRANSFER_TO_ACCOUNT - VOUCHER - ATM_CARD - CASH_OVER_THE_COUNTER - TRANSFER_TO_DIGITAL_WALLET -} - -enum PaymentRecordEntitlementCardStatus { - ACTIVE - INACTIVE -} - -type PaymentRecordNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - version: BigInt! - businessArea: UserBusinessAreaNode! - status: PaymentRecordStatus! - statusDate: DateTime! - household: HouseholdNode! - headOfHousehold: IndividualNode - deliveryTypeChoice: PaymentRecordDeliveryTypeChoice - deliveryType: DeliveryMechanismNode - currency: String! - entitlementQuantity: Float - entitlementQuantityUsd: Float - deliveredQuantity: Float - deliveredQuantityUsd: Float - deliveryDate: DateTime - transactionReferenceId: String - transactionStatusBlockchainLink: String - caId: String - caHashId: UUID - parent: CashPlanNode - fullName: String! - totalPersonsCovered: Int! - distributionModality: String! - targetPopulation: TargetPopulationNode! - targetPopulationCashAssistId: String! - entitlementCardNumber: String - entitlementCardStatus: PaymentRecordEntitlementCardStatus - entitlementCardIssueDate: Date - visionId: String - registrationCaId: String - serviceProvider: ServiceProviderNode! - adminUrl: String - verification: PaymentVerificationNode - unicefId: String -} - -type PaymentRecordNodeConnection { - pageInfo: PageInfo! - edges: [PaymentRecordNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type PaymentRecordNodeEdge { - node: PaymentRecordNode - cursor: String! -} - -enum PaymentRecordStatus { - DISTRIBUTION_SUCCESSFUL - NOT_DISTRIBUTED - TRANSACTION_SUCCESSFUL - TRANSACTION_ERRONEOUS - FORCE_FAILED - PARTIALLY_DISTRIBUTED - PENDING - SENT_TO_PAYMENT_GATEWAY - SENT_TO_FSP - MANUALLY_CANCELLED -} - type PaymentRecordsAndPaymentsEdges { cursor: String node: PaymentRecordAndPaymentNode @@ -3101,8 +2745,9 @@ type PaymentVerificationNode implements Node { updatedAt: DateTime! version: BigInt! paymentVerificationPlan: PaymentVerificationPlanNode! - paymentContentType: ContentTypeObjectType! - paymentObjectId: UUID! + paymentContentType: ContentTypeObjectType + paymentObjectId: UUID + payment: GenericPaymentNode status: PaymentVerificationStatus! statusDate: DateTime receivedAmount: Float @@ -3111,7 +2756,6 @@ type PaymentVerificationNode implements Node { ticketDetail(offset: Int, before: String, after: String, first: Int, last: Int): TicketPaymentVerificationDetailsNodeConnection! adminUrl: String isManuallyEditable: Boolean - payment: GenericPaymentNode } type PaymentVerificationNodeConnection { @@ -3133,8 +2777,9 @@ type PaymentVerificationPlanNode implements Node { version: BigInt! unicefId: String status: PaymentVerificationPlanStatus! - paymentPlanContentType: ContentTypeObjectType! - paymentPlanObjectId: UUID! + paymentPlanContentType: ContentTypeObjectType + paymentPlanObjectId: UUID + paymentPlan: PaymentPlanNode sampling: PaymentVerificationPlanSampling! verificationChannel: PaymentVerificationPlanVerificationChannel! sampleSize: Int @@ -3158,7 +2803,6 @@ type PaymentVerificationPlanNode implements Node { adminUrl: String xlsxFileWasDownloaded: Boolean hasXlsxFile: Boolean - paymentPlan: PaymentPlanNode } type PaymentVerificationPlanNodeConnection { @@ -3213,8 +2857,9 @@ type PaymentVerificationSummaryNode implements Node { status: PaymentVerificationSummaryStatus! activationDate: DateTime completionDate: DateTime - paymentPlanContentType: ContentTypeObjectType! - paymentPlanObjectId: UUID! + paymentPlan: PaymentPlanNode + paymentPlanContentType: ContentTypeObjectType + paymentPlanObjectId: UUID } type PaymentVerificationSummaryNodeConnection { @@ -3345,8 +2990,6 @@ type ProgramNode implements Node { householdSet(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection! individuals(offset: Int, before: String, after: String, first: Int, last: Int): IndividualNodeConnection! registrationImports(offset: Int, before: String, after: String, first: Int, last: Int): RegistrationDataImportNodeConnection! - paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! grievanceTickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! @@ -3462,8 +3105,6 @@ type Query { allSteficonRules(offset: Int, before: String, after: String, first: Int, last: Int, enabled: Boolean, deprecated: Boolean, type: String!): SteficonRuleNodeConnection payment(id: ID!): PaymentNode allPayments(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, paymentPlanId: String!, programId: String, orderBy: String): PaymentNodeConnection - paymentRecord(id: ID!): PaymentRecordNode - allPaymentRecords(offset: Int, before: String, after: String, first: Int, last: Int, parent: ID, household: ID, individual: String, businessArea: String, programId: String, orderBy: String): PaymentRecordNodeConnection allPaymentRecordsAndPayments(businessArea: String!, program: String, household: ID, orderBy: String, first: Int, last: Int, before: String, after: String): PaginatedPaymentRecordsAndPaymentsNode financialServiceProviderXlsxTemplate(id: ID!): FinancialServiceProviderXlsxTemplateNode allFinancialServiceProviderXlsxTemplates(offset: Int, before: String, after: String, first: Int, last: Int, name: String, createdBy: ID, orderBy: String): FinancialServiceProviderXlsxTemplateNodeConnection @@ -3516,8 +3157,6 @@ type Query { allPrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, name: String, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, compatibleDct: Boolean, orderBy: String): ProgramNodeConnection chartProgrammesBySector(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode chartTotalTransferredByMonth(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode - cashPlan(id: ID!): CashPlanNode - allCashPlans(offset: Int, before: String, after: String, first: Int, last: Int, program: ID, assistanceThrough: String, assistanceThrough_Startswith: String, serviceProvider_FullName: String, serviceProvider_FullName_Startswith: String, startDate: DateTime, startDate_Lte: DateTime, startDate_Gte: DateTime, endDate: DateTime, endDate_Lte: DateTime, endDate_Gte: DateTime, businessArea: String, search: String, deliveryType: [String], verificationStatus: [String], orderBy: String): CashPlanNodeConnection programStatusChoices: [ChoiceObject] programCycleStatusChoices: [ChoiceObject] programFrequencyOfPaymentsChoices: [ChoiceObject] @@ -3873,10 +3512,6 @@ type RevertMarkPaymentAsFailedMutation { payment: PaymentNode } -type RevertMarkPaymentRecordAsFailedMutation { - paymentRecord: PaymentRecordNode -} - type RoleChoiceObject { name: String value: String @@ -4109,32 +3744,6 @@ input SensitiveGrievanceTicketExtras { paymentRecord: [ID] } -type ServiceProviderNode implements Node { - id: ID! - createdAt: DateTime! - updatedAt: DateTime! - businessArea: UserBusinessAreaNode! - caId: String! - fullName: String - shortName: String - country: String! - visionId: String - cashPlans(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! -} - -type ServiceProviderNodeConnection { - pageInfo: PageInfo! - edges: [ServiceProviderNodeEdge]! - totalCount: Int - edgeCount: Int -} - -type ServiceProviderNodeEdge { - node: ServiceProviderNode - cursor: String! -} - type SetSteficonRuleOnPaymentPlanPaymentListMutation { paymentPlan: PaymentPlanNode } @@ -4292,7 +3901,6 @@ type TargetPopulationNode implements Node { adultMaleCount: Int adultFemaleCount: Int paymentPlans(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! - paymentRecords(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! selections: [HouseholdSelectionNode!]! messages(offset: Int, before: String, after: String, first: Int, last: Int): CommunicationMessageNodeConnection! surveys(offset: Int, before: String, after: String, first: Int, last: Int): SurveyNodeConnection! @@ -4519,6 +4127,7 @@ type TicketComplaintDetailsNode implements Node { paymentObjectId: UUID household: HouseholdNode individual: IndividualNode + payment: PaymentNode paymentRecord: PaymentRecordAndPaymentNode } @@ -4791,6 +4400,7 @@ type TicketSensitiveDetailsNode implements Node { paymentObjectId: UUID household: HouseholdNode individual: IndividualNode + payment: PaymentNode paymentRecord: PaymentRecordAndPaymentNode } @@ -5022,10 +4632,7 @@ type UserBusinessAreaNode implements Node { ruleSet(offset: Int, before: String, after: String, first: Int, last: Int): SteficonRuleNodeConnection! paymentplanSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentPlanNodeConnection! financialserviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): FinancialServiceProviderNodeConnection! - cashplanSet(offset: Int, before: String, after: String, first: Int, last: Int): CashPlanNodeConnection! - paymentrecordSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentRecordNodeConnection! paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection! - serviceproviderSet(offset: Int, before: String, after: String, first: Int, last: Int): ServiceProviderNodeConnection! tickets(offset: Int, before: String, after: String, first: Int, last: Int): GrievanceTicketNodeConnection! targetpopulationSet(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, programCycle: String, orderBy: String): TargetPopulationNodeConnection! programSet(offset: Int, before: String, after: String, first: Int, last: Int, name: String): ProgramNodeConnection! diff --git a/src/frontend/src/__generated__/graphql.tsx b/src/frontend/src/__generated__/graphql.tsx index 8450cb9b04..e0e9478798 100644 --- a/src/frontend/src/__generated__/graphql.tsx +++ b/src/frontend/src/__generated__/graphql.tsx @@ -440,7 +440,6 @@ export type BusinessAreaNode = Node & { active: Scalars['Boolean']['output']; biometricDeduplicationThreshold: Scalars['Float']['output']; businessAreaPartnerThrough: Array; - cashplanSet: CashPlanNodeConnection; children: UserBusinessAreaNodeConnection; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; @@ -475,7 +474,6 @@ export type BusinessAreaNode = Node & { partners: Array; paymentSet: PaymentNodeConnection; paymentplanSet: PaymentPlanNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; postponeDeduplication: Scalars['Boolean']['output']; programSet: ProgramNodeConnection; rapidProHost?: Maybe; @@ -488,7 +486,6 @@ export type BusinessAreaNode = Node & { reports: ReportNodeConnection; ruleSet: SteficonRuleNodeConnection; screenBeneficiary: Scalars['Boolean']['output']; - serviceproviderSet: ServiceProviderNodeConnection; slug: Scalars['String']['output']; surveySet: SurveyNodeConnection; targetpopulationSet: TargetPopulationNodeConnection; @@ -498,15 +495,6 @@ export type BusinessAreaNode = Node & { }; -export type BusinessAreaNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeChildrenArgs = { after?: InputMaybe; before?: InputMaybe; @@ -598,15 +586,6 @@ export type BusinessAreaNodePaymentplanSetArgs = { }; -export type BusinessAreaNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeProgramSetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -644,15 +623,6 @@ export type BusinessAreaNodeRuleSetArgs = { }; -export type BusinessAreaNodeServiceproviderSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type BusinessAreaNodeSurveySetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -745,97 +715,6 @@ export type CashPlanAndPaymentPlanNode = { verificationStatus?: Maybe; }; -export type CashPlanNode = Node & { - __typename?: 'CashPlanNode'; - assistanceMeasurement: Scalars['String']['output']; - assistanceThrough: Scalars['String']['output']; - availablePaymentRecordsCount?: Maybe; - bankReconciliationError?: Maybe; - bankReconciliationSuccess?: Maybe; - businessArea: UserBusinessAreaNode; - caHashId?: Maybe; - caId?: Maybe; - canCreatePaymentVerificationPlan?: Maybe; - comments?: Maybe; - coverageDuration: Scalars['Int']['output']; - coverageUnit: Scalars['String']['output']; - createdAt: Scalars['DateTime']['output']; - currency?: Maybe; - deliveryType?: Maybe; - dispersionDate: Scalars['DateTime']['output']; - distributionLevel: Scalars['String']['output']; - downPayment?: Maybe; - endDate?: Maybe; - exchangeRate?: Maybe; - fundsCommitment?: Maybe; - id: Scalars['ID']['output']; - name: Scalars['String']['output']; - paymentItems: PaymentRecordNodeConnection; - paymentVerificationSummary?: Maybe; - program: ProgramNode; - serviceProvider?: Maybe; - startDate?: Maybe; - status: CashPlanStatus; - statusDate: Scalars['DateTime']['output']; - totalDeliveredQuantity?: Maybe; - totalDeliveredQuantityUsd?: Maybe; - totalEntitledQuantity?: Maybe; - totalEntitledQuantityRevised?: Maybe; - totalEntitledQuantityRevisedUsd?: Maybe; - totalEntitledQuantityUsd?: Maybe; - totalNumberOfHouseholds?: Maybe; - totalPersonsCovered: Scalars['Int']['output']; - totalPersonsCoveredRevised: Scalars['Int']['output']; - totalUndeliveredQuantity?: Maybe; - totalUndeliveredQuantityUsd?: Maybe; - unicefId?: Maybe; - updatedAt: Scalars['DateTime']['output']; - validationAlertsCount: Scalars['Int']['output']; - verificationPlans?: Maybe; - version: Scalars['BigInt']['output']; - visionId?: Maybe; -}; - - -export type CashPlanNodePaymentItemsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - -export type CashPlanNodeVerificationPlansArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - programId?: InputMaybe; -}; - -export type CashPlanNodeConnection = { - __typename?: 'CashPlanNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type CashPlanNodeEdge = { - __typename?: 'CashPlanNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - -export enum CashPlanStatus { - DistributionCompleted = 'DISTRIBUTION_COMPLETED', - DistributionCompletedWithErrors = 'DISTRIBUTION_COMPLETED_WITH_ERRORS', - TransactionCompleted = 'TRANSACTION_COMPLETED', - TransactionCompletedWithErrors = 'TRANSACTION_COMPLETED_WITH_ERRORS' -} - export type CategoryExtrasInput = { grievanceComplaintTicketExtras?: InputMaybe; negativeFeedbackTicketExtras?: InputMaybe; @@ -1124,19 +1003,6 @@ export type CreateCommunicationMessageMutation = { message?: Maybe; }; -export type CreateDashboardReport = { - __typename?: 'CreateDashboardReport'; - success?: Maybe; -}; - -export type CreateDashboardReportInput = { - adminArea?: InputMaybe; - businessAreaSlug: Scalars['String']['input']; - program?: InputMaybe; - reportTypes: Array>; - year: Scalars['Int']['input']; -}; - export type CreateFeedbackInput = { admin2?: InputMaybe; area?: InputMaybe; @@ -1512,7 +1378,6 @@ export type DeliveryMechanismNode = Node & { optionalFields: Array; paymentGatewayId?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; requiredFields: Array; transferType: DeliveryMechanismTransferType; uniqueFields: Array; @@ -1555,15 +1420,6 @@ export type DeliveryMechanismNodePaymentSetArgs = { offset?: InputMaybe; }; - -export type DeliveryMechanismNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - export type DeliveryMechanismNodeConnection = { __typename?: 'DeliveryMechanismNodeConnection'; edgeCount?: Maybe; @@ -1928,11 +1784,11 @@ export type FinancialServiceProviderNode = Node & { createdBy?: Maybe; dataTransferConfiguration?: Maybe; deliveryMechanisms: DeliveryMechanismNodeConnection; - deliveryMechanismsChoices?: Maybe>; deliveryMechanismsPerPaymentPlan: DeliveryMechanismPerPaymentPlanNodeConnection; distributionLimit?: Maybe; fullName?: Maybe; id: Scalars['ID']['output']; + internalData: Scalars['JSONString']['output']; isPaymentGateway?: Maybe; name: Scalars['String']['output']; paymentGatewayId?: Maybe; @@ -2399,6 +2255,7 @@ export type HouseholdNode = Node & { importId?: Maybe; individuals?: Maybe; individualsAndRoles: Array; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRecalculatedGroupAges: Scalars['Boolean']['output']; @@ -2428,7 +2285,6 @@ export type HouseholdNode = Node & { orgNameEnumerator: Scalars['String']['output']; originUnicefId?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; positiveFeedbackTicketDetails: TicketPositiveFeedbackDetailsNodeConnection; pregnantCount?: Maybe; program?: Maybe; @@ -2458,7 +2314,6 @@ export type HouseholdNode = Node & { unhcrId: Scalars['String']['output']; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; village: Scalars['String']['output']; withdrawn: Scalars['Boolean']['output']; @@ -2582,15 +2437,6 @@ export type HouseholdNodePaymentSetArgs = { }; -export type HouseholdNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type HouseholdNodePositiveFeedbackTicketDetailsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -2996,6 +2842,7 @@ export type IndividualNode = Node & { importedIndividualId?: Maybe; individualDataUpdateTicketDetails: TicketIndividualDataUpdateDetailsNodeConnection; individualId: Scalars['String']['output']; + internalData: Scalars['JSONString']['output']; isMigrationHandled: Scalars['Boolean']['output']; isOriginal: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; @@ -3012,7 +2859,6 @@ export type IndividualNode = Node & { paymentChannels?: Maybe>>; paymentDeliveryPhoneNo?: Maybe; paymentSet: PaymentNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; phoneNo: Scalars['String']['output']; phoneNoAlternative: Scalars['String']['output']; phoneNoAlternativeValid?: Maybe; @@ -3048,7 +2894,6 @@ export type IndividualNode = Node & { ticketsystemflaggingdetailsSet: TicketSystemFlaggingDetailsNodeConnection; unicefId?: Maybe; updatedAt: Scalars['DateTime']['output']; - userFields: Scalars['JSONString']['output']; version: Scalars['BigInt']['output']; walletAddress: Scalars['String']['output']; walletName: Scalars['String']['output']; @@ -3150,15 +2995,6 @@ export type IndividualNodePaymentSetArgs = { }; -export type IndividualNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type IndividualNodePositiveFeedbackTicketDetailsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -3517,11 +3353,6 @@ export type MarkPaymentAsFailedMutation = { payment?: Maybe; }; -export type MarkPaymentRecordAsFailedMutation = { - __typename?: 'MarkPaymentRecordAsFailedMutation'; - paymentRecord?: Maybe; -}; - export type MergeRegistrationDataImportMutation = { __typename?: 'MergeRegistrationDataImportMutation'; registrationDataImport?: Maybe; @@ -3554,7 +3385,6 @@ export type Mutations = { copyProgram?: Maybe; copyTargetPopulation?: Maybe; createAccountabilityCommunicationMessage?: Maybe; - createDashboardReport?: Maybe; createFeedback?: Maybe; createFeedbackMessage?: Maybe; createFollowUpPaymentPlan?: Maybe; @@ -3589,7 +3419,6 @@ export type Mutations = { invalidPaymentVerificationPlan?: Maybe; lockTargetPopulation?: Maybe; markPaymentAsFailed?: Maybe; - markPaymentRecordAsFailed?: Maybe; mergeRegistrationDataImport?: Maybe; reassignRole?: Maybe; refuseRegistrationDataImport?: Maybe; @@ -3599,7 +3428,6 @@ export type Mutations = { rerunDedupe?: Maybe; restartCreateReport?: Maybe; revertMarkPaymentAsFailed?: Maybe; - revertMarkPaymentRecordAsFailed?: Maybe; saveKoboImportDataAsync?: Maybe; setSteficonRuleOnPaymentPlanPaymentList?: Maybe; setSteficonRuleOnTargetPopulation?: Maybe; @@ -3761,11 +3589,6 @@ export type MutationsCreateAccountabilityCommunicationMessageArgs = { }; -export type MutationsCreateDashboardReportArgs = { - reportData: CreateDashboardReportInput; -}; - - export type MutationsCreateFeedbackArgs = { input: CreateFeedbackInput; }; @@ -3955,11 +3778,6 @@ export type MutationsMarkPaymentAsFailedArgs = { }; -export type MutationsMarkPaymentRecordAsFailedArgs = { - paymentRecordId: Scalars['ID']['input']; -}; - - export type MutationsMergeRegistrationDataImportArgs = { id: Scalars['ID']['input']; version?: InputMaybe; @@ -4018,13 +3836,6 @@ export type MutationsRevertMarkPaymentAsFailedArgs = { }; -export type MutationsRevertMarkPaymentRecordAsFailedArgs = { - deliveredQuantity: Scalars['Decimal']['input']; - deliveryDate: Scalars['Date']['input']; - paymentRecordId: Scalars['ID']['input']; -}; - - export type MutationsSaveKoboImportDataAsyncArgs = { businessAreaSlug: Scalars['String']['input']; onlyActiveSubmissions: Scalars['Boolean']['input']; @@ -4349,23 +4160,6 @@ export type PaymentConflictDataNode = { paymentUnicefId?: Maybe; }; -export enum PaymentDeliveryTypeChoice { - AtmCard = 'ATM_CARD', - CardlessCashWithdrawal = 'CARDLESS_CASH_WITHDRAWAL', - Cash = 'CASH', - CashByFsp = 'CASH_BY_FSP', - CashOverTheCounter = 'CASH_OVER_THE_COUNTER', - Cheque = 'CHEQUE', - DepositToCard = 'DEPOSIT_TO_CARD', - MobileMoney = 'MOBILE_MONEY', - PrePaidCard = 'PRE_PAID_CARD', - Referral = 'REFERRAL', - Transfer = 'TRANSFER', - TransferToAccount = 'TRANSFER_TO_ACCOUNT', - TransferToDigitalWallet = 'TRANSFER_TO_DIGITAL_WALLET', - Voucher = 'VOUCHER' -} - export type PaymentDetailsApproveMutation = { __typename?: 'PaymentDetailsApproveMutation'; grievanceTicket?: Maybe; @@ -4398,7 +4192,6 @@ export type PaymentNode = Node & { deliveredQuantityUsd?: Maybe; deliveryDate?: Maybe; deliveryType?: Maybe; - deliveryTypeChoice?: Maybe; distributionModality?: Maybe; entitlementDate?: Maybe; entitlementQuantity?: Maybe; @@ -4412,6 +4205,8 @@ export type PaymentNode = Node & { household: HouseholdNode; householdSnapshot?: Maybe; id: Scalars['ID']['output']; + internalData: Scalars['JSONString']['output']; + isCashAssist: Scalars['Boolean']['output']; isFollowUp: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; orderNumber?: Maybe; @@ -4420,6 +4215,7 @@ export type PaymentNode = Node & { paymentPlanHardConflictedData?: Maybe>>; paymentPlanSoftConflicted?: Maybe; paymentPlanSoftConflictedData?: Maybe>>; + paymentVerification?: Maybe; program?: Maybe; reasonForUnsuccessfulPayment?: Maybe; serviceProvider?: Maybe; @@ -4433,6 +4229,8 @@ export type PaymentNode = Node & { status: PaymentStatus; statusDate: Scalars['DateTime']['output']; targetPopulation?: Maybe; + ticketComplaintDetails?: Maybe; + ticketSensitiveDetails?: Maybe; tokenNumber?: Maybe; totalPersonsCovered?: Maybe; transactionReferenceId?: Maybe; @@ -4479,172 +4277,6 @@ export enum PaymentPlanBackgroundActionStatus { XlsxImportError = 'XLSX_IMPORT_ERROR' } -export enum PaymentPlanCurrency { - Aed = 'AED', - Afn = 'AFN', - All = 'ALL', - Amd = 'AMD', - Ang = 'ANG', - Aoa = 'AOA', - Ars = 'ARS', - Aud = 'AUD', - Awg = 'AWG', - Azn = 'AZN', - A = 'A_', - Bam = 'BAM', - Bbd = 'BBD', - Bdt = 'BDT', - Bgn = 'BGN', - Bhd = 'BHD', - Bif = 'BIF', - Bmd = 'BMD', - Bnd = 'BND', - Bob = 'BOB', - Bov = 'BOV', - Brl = 'BRL', - Bsd = 'BSD', - Btn = 'BTN', - Bwp = 'BWP', - Byn = 'BYN', - Bzd = 'BZD', - Cad = 'CAD', - Cdf = 'CDF', - Chf = 'CHF', - Clp = 'CLP', - Cny = 'CNY', - Cop = 'COP', - Crc = 'CRC', - Cuc = 'CUC', - Cup = 'CUP', - Cve = 'CVE', - Czk = 'CZK', - Djf = 'DJF', - Dkk = 'DKK', - Dop = 'DOP', - Dzd = 'DZD', - Egp = 'EGP', - Ern = 'ERN', - Etb = 'ETB', - Eur = 'EUR', - Fjd = 'FJD', - Fkp = 'FKP', - Gbp = 'GBP', - Gel = 'GEL', - Ghs = 'GHS', - Gip = 'GIP', - Gmd = 'GMD', - Gnf = 'GNF', - Gtq = 'GTQ', - Gyd = 'GYD', - Hkd = 'HKD', - Hnl = 'HNL', - Hrk = 'HRK', - Htg = 'HTG', - Huf = 'HUF', - Idr = 'IDR', - Ils = 'ILS', - Inr = 'INR', - Iqd = 'IQD', - Irr = 'IRR', - Isk = 'ISK', - Jmd = 'JMD', - Jod = 'JOD', - Jpy = 'JPY', - Kes = 'KES', - Kgs = 'KGS', - Khr = 'KHR', - Kmf = 'KMF', - Kpw = 'KPW', - Krw = 'KRW', - Kwd = 'KWD', - Kyd = 'KYD', - Kzt = 'KZT', - Lak = 'LAK', - Lbp = 'LBP', - Lkr = 'LKR', - Lrd = 'LRD', - Lsl = 'LSL', - Lyd = 'LYD', - Mad = 'MAD', - Mdl = 'MDL', - Mga = 'MGA', - Mkd = 'MKD', - Mmk = 'MMK', - Mnt = 'MNT', - Mop = 'MOP', - Mru = 'MRU', - Mur = 'MUR', - Mvr = 'MVR', - Mwk = 'MWK', - Mxn = 'MXN', - Myr = 'MYR', - Mzn = 'MZN', - Nad = 'NAD', - Ngn = 'NGN', - Nio = 'NIO', - Nok = 'NOK', - Npr = 'NPR', - Nzd = 'NZD', - Omr = 'OMR', - Pab = 'PAB', - Pen = 'PEN', - Pgk = 'PGK', - Php = 'PHP', - Pkr = 'PKR', - Pln = 'PLN', - Pyg = 'PYG', - Qar = 'QAR', - Ron = 'RON', - Rsd = 'RSD', - Rub = 'RUB', - Rwf = 'RWF', - Sar = 'SAR', - Sbd = 'SBD', - Scr = 'SCR', - Sdg = 'SDG', - Sek = 'SEK', - Sgd = 'SGD', - Shp = 'SHP', - Sll = 'SLL', - Sos = 'SOS', - Srd = 'SRD', - Ssp = 'SSP', - Stn = 'STN', - Svc = 'SVC', - Syp = 'SYP', - Szl = 'SZL', - Thb = 'THB', - Tjs = 'TJS', - Tmt = 'TMT', - Tnd = 'TND', - Top = 'TOP', - Try = 'TRY', - Ttd = 'TTD', - Twd = 'TWD', - Tzs = 'TZS', - Uah = 'UAH', - Ugx = 'UGX', - Usd = 'USD', - Usdc = 'USDC', - Uyu = 'UYU', - Uyw = 'UYW', - Uzs = 'UZS', - Ves = 'VES', - Vnd = 'VND', - Vuv = 'VUV', - Wst = 'WST', - Xaf = 'XAF', - Xag = 'XAG', - Xau = 'XAU', - Xcd = 'XCD', - Xof = 'XOF', - Xpf = 'XPF', - Yer = 'YER', - Zar = 'ZAR', - Zmw = 'ZMW', - Zwl = 'ZWL' -} - export type PaymentPlanNode = Node & { __typename?: 'PaymentPlanNode'; adminUrl?: Maybe; @@ -4660,7 +4292,7 @@ export type PaymentPlanNode = Node & { canSplit?: Maybe; createdAt: Scalars['DateTime']['output']; createdBy: UserNode; - currency: PaymentPlanCurrency; + currency?: Maybe; currencyName?: Maybe; deliveryMechanisms?: Maybe>>; dispersionEndDate?: Maybe; @@ -4680,16 +4312,19 @@ export type PaymentPlanNode = Node & { id: Scalars['ID']['output']; importedFileDate?: Maybe; importedFileName?: Maybe; + internalData: Scalars['JSONString']['output']; + isCashAssist: Scalars['Boolean']['output']; isFollowUp: Scalars['Boolean']['output']; isRemoved: Scalars['Boolean']['output']; maleAdultsCount: Scalars['Int']['output']; maleChildrenCount: Scalars['Int']['output']; name?: Maybe; paymentItems: PaymentNodeConnection; + paymentVerificationPlans: PaymentVerificationPlanNodeConnection; paymentVerificationSummary?: Maybe; paymentsConflictsCount?: Maybe; - program: ProgramNode; - programCycle?: Maybe; + program?: Maybe; + programCycle: ProgramCycleNode; reconciliationSummary?: Maybe; sourcePaymentPlan?: Maybe; splitChoices?: Maybe>>; @@ -4756,6 +4391,15 @@ export type PaymentPlanNodePaymentItemsArgs = { }; +export type PaymentPlanNodePaymentVerificationPlansArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + offset?: InputMaybe; +}; + + export type PaymentPlanNodeVerificationPlansArgs = { after?: InputMaybe; before?: InputMaybe; @@ -4829,95 +4473,6 @@ export type PaymentRecordAndPaymentNode = { verification?: Maybe; }; -export enum PaymentRecordDeliveryTypeChoice { - AtmCard = 'ATM_CARD', - CardlessCashWithdrawal = 'CARDLESS_CASH_WITHDRAWAL', - Cash = 'CASH', - CashByFsp = 'CASH_BY_FSP', - CashOverTheCounter = 'CASH_OVER_THE_COUNTER', - Cheque = 'CHEQUE', - DepositToCard = 'DEPOSIT_TO_CARD', - MobileMoney = 'MOBILE_MONEY', - PrePaidCard = 'PRE_PAID_CARD', - Referral = 'REFERRAL', - Transfer = 'TRANSFER', - TransferToAccount = 'TRANSFER_TO_ACCOUNT', - TransferToDigitalWallet = 'TRANSFER_TO_DIGITAL_WALLET', - Voucher = 'VOUCHER' -} - -export enum PaymentRecordEntitlementCardStatus { - Active = 'ACTIVE', - Inactive = 'INACTIVE' -} - -export type PaymentRecordNode = Node & { - __typename?: 'PaymentRecordNode'; - adminUrl?: Maybe; - businessArea: UserBusinessAreaNode; - caHashId?: Maybe; - caId?: Maybe; - createdAt: Scalars['DateTime']['output']; - currency: Scalars['String']['output']; - deliveredQuantity?: Maybe; - deliveredQuantityUsd?: Maybe; - deliveryDate?: Maybe; - deliveryType?: Maybe; - deliveryTypeChoice?: Maybe; - distributionModality: Scalars['String']['output']; - entitlementCardIssueDate?: Maybe; - entitlementCardNumber?: Maybe; - entitlementCardStatus?: Maybe; - entitlementQuantity?: Maybe; - entitlementQuantityUsd?: Maybe; - fullName: Scalars['String']['output']; - headOfHousehold?: Maybe; - household: HouseholdNode; - id: Scalars['ID']['output']; - parent?: Maybe; - registrationCaId?: Maybe; - serviceProvider: ServiceProviderNode; - status: PaymentRecordStatus; - statusDate: Scalars['DateTime']['output']; - targetPopulation: TargetPopulationNode; - targetPopulationCashAssistId: Scalars['String']['output']; - totalPersonsCovered: Scalars['Int']['output']; - transactionReferenceId?: Maybe; - transactionStatusBlockchainLink?: Maybe; - unicefId?: Maybe; - updatedAt: Scalars['DateTime']['output']; - verification?: Maybe; - version: Scalars['BigInt']['output']; - visionId?: Maybe; -}; - -export type PaymentRecordNodeConnection = { - __typename?: 'PaymentRecordNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type PaymentRecordNodeEdge = { - __typename?: 'PaymentRecordNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - -export enum PaymentRecordStatus { - DistributionSuccessful = 'DISTRIBUTION_SUCCESSFUL', - ForceFailed = 'FORCE_FAILED', - ManuallyCancelled = 'MANUALLY_CANCELLED', - NotDistributed = 'NOT_DISTRIBUTED', - PartiallyDistributed = 'PARTIALLY_DISTRIBUTED', - Pending = 'PENDING', - SentToFsp = 'SENT_TO_FSP', - SentToPaymentGateway = 'SENT_TO_PAYMENT_GATEWAY', - TransactionErroneous = 'TRANSACTION_ERRONEOUS', - TransactionSuccessful = 'TRANSACTION_SUCCESSFUL' -} - export type PaymentRecordsAndPaymentsEdges = { __typename?: 'PaymentRecordsAndPaymentsEdges'; cursor?: Maybe; @@ -4984,8 +4539,8 @@ export type PaymentVerificationNode = Node & { id: Scalars['ID']['output']; isManuallyEditable?: Maybe; payment?: Maybe; - paymentContentType: ContentTypeObjectType; - paymentObjectId: Scalars['UUID']['output']; + paymentContentType?: Maybe; + paymentObjectId?: Maybe; paymentVerificationPlan: PaymentVerificationPlanNode; receivedAmount?: Maybe; sentToRapidPro: Scalars['Boolean']['output']; @@ -5044,8 +4599,8 @@ export type PaymentVerificationPlanNode = Node & { marginOfError?: Maybe; notReceivedCount?: Maybe; paymentPlan?: Maybe; - paymentPlanContentType: ContentTypeObjectType; - paymentPlanObjectId: Scalars['UUID']['output']; + paymentPlanContentType?: Maybe; + paymentPlanObjectId?: Maybe; paymentRecordVerifications: PaymentVerificationNodeConnection; rapidProFlowId: Scalars['String']['output']; rapidProFlowStartUuids: Array; @@ -5127,8 +4682,9 @@ export type PaymentVerificationSummaryNode = Node & { completionDate?: Maybe; createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; - paymentPlanContentType: ContentTypeObjectType; - paymentPlanObjectId: Scalars['UUID']['output']; + paymentPlan?: Maybe; + paymentPlanContentType?: Maybe; + paymentPlanObjectId?: Maybe; status: PaymentVerificationSummaryStatus; updatedAt: Scalars['DateTime']['output']; }; @@ -5285,7 +4841,6 @@ export type ProgramNode = Node & { caId?: Maybe; canFinish?: Maybe; cashPlus: Scalars['Boolean']['output']; - cashplanSet: CashPlanNodeConnection; createdAt: Scalars['DateTime']['output']; cycles?: Maybe; dataCollectingType?: Maybe; @@ -5310,7 +4865,6 @@ export type ProgramNode = Node & { partnerAccess: ProgramPartnerAccess; partners?: Maybe>>; paymentSet: PaymentNodeConnection; - paymentplanSet: PaymentPlanNodeConnection; pduFields?: Maybe>>; populationGoal: Scalars['Int']['output']; programmeCode?: Maybe; @@ -5352,15 +4906,6 @@ export type ProgramNodeAdminAreasArgs = { }; -export type ProgramNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type ProgramNodeCyclesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -5440,15 +4985,6 @@ export type ProgramNodePaymentSetArgs = { }; -export type ProgramNodePaymentplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type ProgramNodeRegistrationImportsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -5569,7 +5105,6 @@ export type Query = { allAdminAreas?: Maybe; allAreasTree?: Maybe>>; allBusinessAreas?: Maybe; - allCashPlans?: Maybe; allCashPlansAndPaymentPlans?: Maybe; allCollectorFieldsAttributes?: Maybe>>; allDeliveryMechanisms?: Maybe>>; @@ -5591,7 +5126,6 @@ export type Query = { allMergedHouseholds?: Maybe; allMergedIndividuals?: Maybe; allPaymentPlans?: Maybe; - allPaymentRecords?: Maybe; allPaymentRecordsAndPayments?: Maybe; allPaymentVerificationLogEntries?: Maybe; allPaymentVerificationPlan?: Maybe; @@ -5612,7 +5146,6 @@ export type Query = { businessArea?: Maybe; canRunDeduplication?: Maybe; cashAssistUrlPrefix?: Maybe; - cashPlan?: Maybe; cashPlanStatusChoices?: Maybe>>; cashPlanVerificationSamplingChoices?: Maybe>>; cashPlanVerificationStatusChoices?: Maybe>>; @@ -5671,7 +5204,6 @@ export type Query = { paymentPlan?: Maybe; paymentPlanBackgroundActionStatusChoices?: Maybe>>; paymentPlanStatusChoices?: Maybe>>; - paymentRecord?: Maybe; paymentRecordDeliveryTypeChoices?: Maybe>>; paymentRecordEntitlementCardStatusChoices?: Maybe>>; paymentRecordStatusChoices?: Maybe>>; @@ -5863,31 +5395,6 @@ export type QueryAllBusinessAreasArgs = { }; -export type QueryAllCashPlansArgs = { - after?: InputMaybe; - assistanceThrough?: InputMaybe; - assistanceThrough_Startswith?: InputMaybe; - before?: InputMaybe; - businessArea?: InputMaybe; - deliveryType?: InputMaybe>>; - endDate?: InputMaybe; - endDate_Gte?: InputMaybe; - endDate_Lte?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - orderBy?: InputMaybe; - program?: InputMaybe; - search?: InputMaybe; - serviceProvider_FullName?: InputMaybe; - serviceProvider_FullName_Startswith?: InputMaybe; - startDate?: InputMaybe; - startDate_Gte?: InputMaybe; - startDate_Lte?: InputMaybe; - verificationStatus?: InputMaybe>>; -}; - - export type QueryAllCashPlansAndPaymentPlansArgs = { after?: InputMaybe; before?: InputMaybe; @@ -6158,21 +5665,6 @@ export type QueryAllPaymentPlansArgs = { }; -export type QueryAllPaymentRecordsArgs = { - after?: InputMaybe; - before?: InputMaybe; - businessArea?: InputMaybe; - first?: InputMaybe; - household?: InputMaybe; - individual?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; - orderBy?: InputMaybe; - parent?: InputMaybe; - programId?: InputMaybe; -}; - - export type QueryAllPaymentRecordsAndPaymentsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -6426,11 +5918,6 @@ export type QueryBusinessAreaArgs = { }; -export type QueryCashPlanArgs = { - id: Scalars['ID']['input']; -}; - - export type QueryChartGrievancesArgs = { administrativeArea?: InputMaybe; businessAreaSlug: Scalars['String']['input']; @@ -6623,11 +6110,6 @@ export type QueryPaymentPlanArgs = { }; -export type QueryPaymentRecordArgs = { - id: Scalars['ID']['input']; -}; - - export type QueryPaymentRecordVerificationArgs = { id: Scalars['ID']['input']; }; @@ -7168,11 +6650,6 @@ export type RevertMarkPaymentAsFailedMutation = { payment?: Maybe; }; -export type RevertMarkPaymentRecordAsFailedMutation = { - __typename?: 'RevertMarkPaymentRecordAsFailedMutation'; - paymentRecord?: Maybe; -}; - export type RoleChoiceObject = { __typename?: 'RoleChoiceObject'; name?: Maybe; @@ -7516,53 +6993,6 @@ export type SensitiveGrievanceTicketExtras = { paymentRecord?: InputMaybe>>; }; -export type ServiceProviderNode = Node & { - __typename?: 'ServiceProviderNode'; - businessArea: UserBusinessAreaNode; - caId: Scalars['String']['output']; - cashPlans: CashPlanNodeConnection; - country: Scalars['String']['output']; - createdAt: Scalars['DateTime']['output']; - fullName?: Maybe; - id: Scalars['ID']['output']; - paymentrecordSet: PaymentRecordNodeConnection; - shortName?: Maybe; - updatedAt: Scalars['DateTime']['output']; - visionId?: Maybe; -}; - - -export type ServiceProviderNodeCashPlansArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - -export type ServiceProviderNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - -export type ServiceProviderNodeConnection = { - __typename?: 'ServiceProviderNodeConnection'; - edgeCount?: Maybe; - edges: Array>; - pageInfo: PageInfo; - totalCount?: Maybe; -}; - -export type ServiceProviderNodeEdge = { - __typename?: 'ServiceProviderNodeEdge'; - cursor: Scalars['String']['output']; - node?: Maybe; -}; - export type SetSteficonRuleOnPaymentPlanPaymentListMutation = { __typename?: 'SetSteficonRuleOnPaymentPlanPaymentListMutation'; paymentPlan?: Maybe; @@ -7753,7 +7183,6 @@ export type TargetPopulationNode = Node & { messages: CommunicationMessageNodeConnection; name: Scalars['String']['output']; paymentPlans: PaymentPlanNodeConnection; - paymentRecords: PaymentRecordNodeConnection; program: ProgramNode; programCycle: ProgramCycleNode; selections: Array; @@ -7814,15 +7243,6 @@ export type TargetPopulationNodePaymentPlansArgs = { }; -export type TargetPopulationNodePaymentRecordsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type TargetPopulationNodeSurveysArgs = { after?: InputMaybe; before?: InputMaybe; @@ -8057,6 +7477,7 @@ export type TicketComplaintDetailsNode = Node & { household?: Maybe; id: Scalars['ID']['output']; individual?: Maybe; + payment?: Maybe; paymentContentType?: Maybe; paymentObjectId?: Maybe; paymentRecord?: Maybe; @@ -8381,6 +7802,7 @@ export type TicketSensitiveDetailsNode = Node & { household?: Maybe; id: Scalars['ID']['output']; individual?: Maybe; + payment?: Maybe; paymentContentType?: Maybe; paymentObjectId?: Maybe; paymentRecord?: Maybe; @@ -8584,7 +8006,6 @@ export type UserBusinessAreaNode = Node & { active: Scalars['Boolean']['output']; biometricDeduplicationThreshold: Scalars['Float']['output']; businessAreaPartnerThrough: Array; - cashplanSet: CashPlanNodeConnection; children: UserBusinessAreaNodeConnection; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; @@ -8619,7 +8040,6 @@ export type UserBusinessAreaNode = Node & { partners: Array; paymentSet: PaymentNodeConnection; paymentplanSet: PaymentPlanNodeConnection; - paymentrecordSet: PaymentRecordNodeConnection; permissions?: Maybe>>; postponeDeduplication: Scalars['Boolean']['output']; programSet: ProgramNodeConnection; @@ -8633,7 +8053,6 @@ export type UserBusinessAreaNode = Node & { reports: ReportNodeConnection; ruleSet: SteficonRuleNodeConnection; screenBeneficiary: Scalars['Boolean']['output']; - serviceproviderSet: ServiceProviderNodeConnection; slug: Scalars['String']['output']; surveySet: SurveyNodeConnection; targetpopulationSet: TargetPopulationNodeConnection; @@ -8643,15 +8062,6 @@ export type UserBusinessAreaNode = Node & { }; -export type UserBusinessAreaNodeCashplanSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeChildrenArgs = { after?: InputMaybe; before?: InputMaybe; @@ -8743,15 +8153,6 @@ export type UserBusinessAreaNodePaymentplanSetArgs = { }; -export type UserBusinessAreaNodePaymentrecordSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeProgramSetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -8789,15 +8190,6 @@ export type UserBusinessAreaNodeRuleSetArgs = { }; -export type UserBusinessAreaNodeServiceproviderSetArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type UserBusinessAreaNodeSurveySetArgs = { after?: InputMaybe; before?: InputMaybe; @@ -9235,11 +8627,11 @@ export type _TableTotalCashTransferredDataNode = { totalHouseholds?: Maybe; }; -export type GrievanceTicketDetailedFragment = { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null }; +export type GrievanceTicketDetailedFragment = { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null }; export type HouseholdMinimalFragment = { __typename?: 'HouseholdNode', id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, flexFields?: any | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, address: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } }; -export type HouseholdDetailedFragment = { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null }; +export type HouseholdDetailedFragment = { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null }; export type MergedHouseholdMinimalFragment = { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, firstRegistrationDate: any, hasDuplicates?: boolean | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null }; @@ -9249,8 +8641,6 @@ export type IndividualDetailedFragment = { __typename?: 'IndividualNode', givenN export type MergedIndividualMinimalFragment = { __typename?: 'IndividualNode', id: string, unicefId?: string | null, age?: number | null, fullName: string, birthDate: any, sex: IndividualSex, role?: string | null, relationship?: IndividualRelationship | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, importId?: string | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, fullName?: string | null, score?: number | null, proximityToScore?: number | null, age?: number | null, location?: string | null } | null> | null, deduplicationBatchResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, fullName?: string | null, score?: number | null, proximityToScore?: number | null, age?: number | null, location?: string | null } | null> | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string } }; -export type PaymentRecordDetailsFragment = { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } }; - export type ProgramDetailsFragment = { __typename?: 'ProgramNode', id: string, name: string, programmeCode?: string | null, startDate: any, endDate?: any | null, status: ProgramStatus, caId?: string | null, caHashId?: string | null, description: string, budget?: any | null, frequencyOfPayments: ProgramFrequencyOfPayments, cashPlus: boolean, populationGoal: number, scope?: ProgramScope | null, sector: ProgramSector, totalNumberOfHouseholds?: number | null, totalNumberOfHouseholdsWithTpInProgram?: number | null, administrativeAreasOfImplementation: string, isSocialWorkerProgram?: boolean | null, version: any, adminUrl?: string | null, partnerAccess: ProgramPartnerAccess, targetPopulationsCount?: number | null, canFinish?: boolean | null, dataCollectingType?: { __typename?: 'DataCollectingTypeNode', id: string, code: string, label: string, active: boolean, individualFiltersAvailable: boolean, householdFiltersAvailable: boolean, description: string, type?: DataCollectingTypeType | null } | null, partners?: Array<{ __typename?: 'PartnerNode', id: string, name?: string | null, areaAccess?: string | null, areas?: Array<{ __typename?: 'AreaNode', id: string, level: number } | null> | null } | null> | null, registrationImports: { __typename?: 'RegistrationDataImportNodeConnection', totalCount?: number | null }, pduFields?: Array<{ __typename?: 'PeriodicFieldNode', id: string, label: any, pduData?: { __typename?: 'PeriodicFieldDataNode', id: string, subtype: PeriodicFieldDataSubtype, numberOfRounds: number, roundsNames: Array } | null } | null> | null }; export type RegistrationMinimalFragment = { __typename?: 'RegistrationDataImportNode', id: string, createdAt: any, name: string, status: RegistrationDataImportStatus, erased: boolean, importDate: any, dataSource: RegistrationDataImportDataSource, numberOfHouseholds: number, numberOfIndividuals: number, refuseReason?: string | null, totalHouseholdsCountWithValidPhoneNo?: number | null, adminUrl?: string | null, biometricDeduplicated?: string | null, importedBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, program?: { __typename?: 'ProgramNode', id: string, name: string, startDate: any, endDate?: any | null, status: ProgramStatus } | null }; @@ -9342,7 +8732,7 @@ export type ApproveHouseholdDataChangeMutationVariables = Exact<{ }>; -export type ApproveHouseholdDataChangeMutation = { __typename?: 'Mutations', approveHouseholdDataChange?: { __typename?: 'HouseholdDataChangeApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null } | null } | null }; +export type ApproveHouseholdDataChangeMutation = { __typename?: 'Mutations', approveHouseholdDataChange?: { __typename?: 'HouseholdDataChangeApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null } | null } | null }; export type ApproveIndividualDataChangeMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -9374,7 +8764,7 @@ export type ApproveNeedsAdjudicationMutationVariables = Exact<{ }>; -export type ApproveNeedsAdjudicationMutation = { __typename?: 'Mutations', approveNeedsAdjudication?: { __typename?: 'NeedsAdjudicationApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null } | null } | null }; +export type ApproveNeedsAdjudicationMutation = { __typename?: 'Mutations', approveNeedsAdjudication?: { __typename?: 'NeedsAdjudicationApproveMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, status: number, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null } | null } | null }; export type ApprovePaymentDetailsMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -9448,7 +8838,7 @@ export type GrievanceTicketStatusChangeMutationVariables = Exact<{ }>; -export type GrievanceTicketStatusChangeMutation = { __typename?: 'Mutations', grievanceStatusChange?: { __typename?: 'GrievanceStatusChangeMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null }; +export type GrievanceTicketStatusChangeMutation = { __typename?: 'Mutations', grievanceStatusChange?: { __typename?: 'GrievanceStatusChangeMutation', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null }; export type ReassignRoleGrievanceMutationVariables = Exact<{ grievanceTicketId: Scalars['ID']['input']; @@ -9654,22 +9044,6 @@ export type InvalidPaymentVerificationPlanMutationVariables = Exact<{ export type InvalidPaymentVerificationPlanMutation = { __typename?: 'Mutations', invalidPaymentVerificationPlan?: { __typename?: 'InvalidPaymentVerificationPlan', paymentPlan?: { __typename?: 'GenericPaymentPlanNode', id?: string | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean } | null } | null> } | null } | null } | null }; -export type MarkPrAsFailedMutationVariables = Exact<{ - paymentRecordId: Scalars['ID']['input']; -}>; - - -export type MarkPrAsFailedMutation = { __typename?: 'Mutations', markPaymentRecordAsFailed?: { __typename?: 'MarkPaymentRecordAsFailedMutation', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null } | null }; - -export type RevertMarkPrAsFailedMutationVariables = Exact<{ - paymentRecordId: Scalars['ID']['input']; - deliveredQuantity: Scalars['Decimal']['input']; - deliveryDate: Scalars['Date']['input']; -}>; - - -export type RevertMarkPrAsFailedMutation = { __typename?: 'Mutations', revertMarkPaymentRecordAsFailed?: { __typename?: 'RevertMarkPaymentRecordAsFailedMutation', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, transactionReferenceId?: string | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null } | null, household: { __typename?: 'HouseholdNode', id: string, status?: string | null, size?: number | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null } | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, parent?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null } | null }; - export type SplitPpMutationVariables = Exact<{ paymentPlanId: Scalars['ID']['input']; splitType: Scalars['String']['input']; @@ -9812,13 +9186,6 @@ export type UploadImportDataXlsxFileAsyncMutationVariables = Exact<{ export type UploadImportDataXlsxFileAsyncMutation = { __typename?: 'Mutations', uploadImportDataXlsxFileAsync?: { __typename?: 'UploadImportDataXLSXFileAsync', errors?: Array<{ __typename?: 'XlsxRowErrorNode', header?: string | null, message?: string | null, rowNumber?: number | null } | null> | null, importData?: { __typename?: 'ImportDataNode', id: string, numberOfIndividuals?: number | null, numberOfHouseholds?: number | null, registrationDataImport?: { __typename?: 'RegistrationDataImportDatahubNode', id: string } | null } | null } | null }; -export type CreateDashboardReportMutationVariables = Exact<{ - reportData: CreateDashboardReportInput; -}>; - - -export type CreateDashboardReportMutation = { __typename?: 'Mutations', createDashboardReport?: { __typename?: 'CreateDashboardReport', success?: boolean | null } | null }; - export type CreateReportMutationVariables = Exact<{ reportData: CreateReportInput; }>; @@ -10235,7 +9602,7 @@ export type GrievanceTicketQueryVariables = Exact<{ }>; -export type GrievanceTicketQuery = { __typename?: 'Query', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null }; +export type GrievanceTicketQuery = { __typename?: 'Query', grievanceTicket?: { __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, category: number, consent: boolean, targetId?: string | null, createdAt: any, updatedAt: any, description: string, language: string, admin?: string | null, area: string, adminUrl?: string | null, issueType?: number | null, priority?: number | null, urgency?: number | null, comments?: string | null, partner?: { __typename?: 'PartnerType', id: string, name: string } | null, businessArea: { __typename?: 'UserBusinessAreaNode', postponeDeduplication: boolean }, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, pCode?: string | null } | null, assignedTo?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, paymentRecord?: { __typename?: 'PaymentRecordAndPaymentNode', id?: string | null, caId?: string | null, deliveredQuantity?: number | null, entitlementQuantity?: number | null, objType?: string | null, parent?: { __typename?: 'CashPlanAndPaymentPlanNode', id?: string | null, unicefId?: string | null, objType?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null, relatedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, linkedTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, unicefId?: string | null, category: number, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, existingTickets?: Array<{ __typename?: 'GrievanceTicketNode', id: string, category: number, unicefId?: string | null, status: number, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null> | null, addIndividualTicketDetails?: { __typename?: 'TicketAddIndividualDetailsNode', id: string, individualData?: any | null, approveStatus: boolean, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, individualDataUpdateTicketDetails?: { __typename?: 'TicketIndividualDataUpdateDetailsNode', id: string, individualData?: any | null, roleReassignData: any, individual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null } | null, householdDataUpdateTicketDetails?: { __typename?: 'TicketHouseholdDataUpdateDetailsNode', id: string, householdData?: any | null, household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null } | null, deleteIndividualTicketDetails?: { __typename?: 'TicketDeleteIndividualDetailsNode', id: string, roleReassignData: any, approveStatus: boolean } | null, deleteHouseholdTicketDetails?: { __typename?: 'TicketDeleteHouseholdDetailsNode', id: string, approveStatus: boolean, reasonHousehold?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null } | null, systemFlaggingTicketDetails?: { __typename?: 'TicketSystemFlaggingDetailsNode', id: string, approveStatus: boolean, roleReassignData: any, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, duplicate: boolean, fullName: string, birthDate: any, lastRegistrationDate: any, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null }, sanctionListIndividual: { __typename?: 'SanctionListIndividualNode', id: string, fullName: string, referenceNumber: string, datesOfBirth: { __typename?: 'SanctionListIndividualDateOfBirthNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDateOfBirthNodeEdge', node?: { __typename?: 'SanctionListIndividualDateOfBirthNode', id: string, date: any } | null } | null> }, documents: { __typename?: 'SanctionListIndividualDocumentNodeConnection', edges: Array<{ __typename?: 'SanctionListIndividualDocumentNodeEdge', node?: { __typename?: 'SanctionListIndividualDocumentNode', id: string, documentNumber: string, typeOfDocument: string } | null } | null> } } } | null, paymentVerificationTicketDetails?: { __typename?: 'TicketPaymentVerificationDetailsNode', id: string, newStatus?: TicketPaymentVerificationDetailsNewStatus | null, oldReceivedAmount?: number | null, newReceivedAmount?: number | null, approveStatus: boolean, paymentVerificationStatus: TicketPaymentVerificationDetailsPaymentVerificationStatus, hasMultiplePaymentVerifications?: boolean | null, paymentVerification?: { __typename?: 'PaymentVerificationNode', id: string, receivedAmount?: number | null } | null, paymentVerifications: { __typename?: 'PaymentVerificationNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationNodeEdge', node?: { __typename?: 'PaymentVerificationNode', id: string } | null } | null> } } | null, needsAdjudicationTicketDetails?: { __typename?: 'TicketNeedsAdjudicationDetailsNode', id: string, hasDuplicatedDocument?: boolean | null, isMultipleDuplicatesVersion: boolean, roleReassignData: any, extraData?: { __typename?: 'TicketNeedsAdjudicationDetailsExtraDataNode', goldenRecords?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, possibleDuplicate?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null, dedupEngineSimilarityPair?: { __typename?: 'DeduplicationEngineSimilarityPairNode', similarityScore?: string | null, individual1?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null, individual2?: { __typename?: 'DeduplicationEngineSimilarityPairIndividualNode', unicefId?: string | null, fullName?: string | null, photo?: string | null } | null } | null } | null, goldenRecordsIndividual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, birthDate: any, lastRegistrationDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null }, possibleDuplicate?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null, possibleDuplicates?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null, lastRegistrationDate: any, fullName: string, birthDate: any, sex: IndividualSex, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', unicefId?: string | null, id: string, village: string, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null } | null, deduplicationGoldenRecordResults?: Array<{ __typename?: 'DeduplicationResultNode', hitId?: string | null, proximityToScore?: number | null, score?: number | null } | null> | null } | null> | null, selectedIndividual?: { __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null, selectedDuplicates?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null, selectedDistinct?: Array<{ __typename?: 'IndividualNode', givenName: string, familyName: string, estimatedBirthDate?: boolean | null, pregnant?: boolean | null, lastSyncAt?: any | null, deduplicationBatchStatus: IndividualDeduplicationBatchStatus, disability: IndividualDisability, commsDisability: string, firstRegistrationDate: any, whoAnswersAltPhone: string, memoryDisability: string, middleName: string, whoAnswersPhone: string, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null, email?: string | null, hearingDisability: string, observedDisability?: Array | null, individualId: string, seeingDisability: string, physicalDisability: string, selfcareDisability: string, photo?: string | null, workStatus: string, enrolledInNutritionProgramme?: boolean | null, administrationOfRutf?: boolean | null, flexFields?: any | null, preferredLanguage?: string | null, paymentDeliveryPhoneNo?: string | null, walletName: string, walletAddress: string, blockchainName: string, importId?: string | null, id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, household?: { __typename?: 'HouseholdNode', status?: string | null, id: string, residenceStatus?: string | null, address: string, village: string, zipCode?: string | null, geopoint?: any | null, country?: string | null, countryOrigin?: string | null, unicefId?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, activeIndividualsCount?: number | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, currency?: string | null, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unhcrId: string, adminAreaTitle?: string | null, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, adminArea?: { __typename?: 'AreaNode', id: string, name: string, level: number } | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null, householdsAndRoles: Array<{ __typename?: 'IndividualRoleInHouseholdNode', id: any, role?: IndividualRoleInHouseholdRole | null, individual: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null } }>, paymentChannels?: Array<{ __typename?: 'BankAccountInfoNode', id: string, bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null> | null, deliveryMechanismsData?: Array<{ __typename?: 'DeliveryMechanismDataNode', name?: string | null, isValid?: boolean | null, individualTabData?: any | null } | null> | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, photo?: string | null, documentNumber: string, countryIso3?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, headingHousehold?: { __typename?: 'HouseholdNode', id: string, headOfHousehold?: { __typename?: 'IndividualNode', id: string, givenName: string, familyName: string, fullName: string } | null } | null, bankAccountInfo?: { __typename?: 'BankAccountInfoNode', bankName: string, bankAccountNumber: string, accountHolderName: string, bankBranchName: string } | null, registrationDataImport: { __typename?: 'RegistrationDataImportNode', id: string, name: string }, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null } | null> | null } | null, ticketNotes: { __typename?: 'TicketNoteNodeConnection', edges: Array<{ __typename?: 'TicketNoteNodeEdge', node?: { __typename?: 'TicketNoteNode', id: string, createdAt: any, updatedAt: any, description: string, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null } | null> }, programs?: Array<{ __typename?: 'ProgramNode', name: string, id: string } | null> | null, documentation?: Array<{ __typename?: 'GrievanceDocumentNode', id: string, createdAt: any, updatedAt: any, name?: string | null, fileSize?: number | null, contentType: string, filePath?: string | null, fileName?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null }; export type GrievanceTicketFlexFieldsQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -10295,7 +9662,7 @@ export type AllPaymentPlansForTableQueryVariables = Exact<{ }>; -export type AllPaymentPlansForTableQuery = { __typename?: 'Query', allPaymentPlans?: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', cursor: string, node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, name?: string | null, isFollowUp: boolean, status: PaymentPlanStatus, currency: PaymentPlanCurrency, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null } | null } | null> }, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program: { __typename?: 'ProgramNode', id: string, name: string }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } | null }; +export type AllPaymentPlansForTableQuery = { __typename?: 'Query', allPaymentPlans?: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', cursor: string, node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, name?: string | null, isFollowUp: boolean, status: PaymentPlanStatus, currency?: string | null, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null } | null } | null> }, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program?: { __typename?: 'ProgramNode', id: string, name: string } | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } | null }; export type AvailableFspsForDeliveryMechanismsQueryVariables = Exact<{ input: AvailableFspsForDeliveryMechanismsInput; @@ -10309,33 +9676,14 @@ export type PaymentQueryVariables = Exact<{ }>; -export type PaymentQuery = { __typename?: 'Query', payment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, distributionModality?: string | null, status: PaymentStatus, statusDate: any, snapshotCollectorBankName?: string | null, snapshotCollectorBankAccountNumber?: string | null, debitCardNumber?: string | null, debitCardIssuer?: string | null, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, additionalCollectorName?: string | null, additionalDocumentType?: string | null, additionalDocumentNumber?: string | null, reasonForUnsuccessfulPayment?: string | null, snapshotCollectorFullName?: string | null, adminUrl?: string | null, targetPopulation?: { __typename?: 'TargetPopulationNode', id: string, name: string } | null, sourcePayment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, email?: string | null, phoneNo: string, phoneNoValid?: boolean | null, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null }, parent: { __typename?: 'PaymentPlanNode', id: string, status: PaymentPlanStatus, isFollowUp: boolean, unicefId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null }, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, fullName?: string | null } | null } | null }; +export type PaymentQuery = { __typename?: 'Query', payment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, distributionModality?: string | null, status: PaymentStatus, statusDate: any, snapshotCollectorBankName?: string | null, snapshotCollectorBankAccountNumber?: string | null, debitCardNumber?: string | null, debitCardIssuer?: string | null, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, additionalCollectorName?: string | null, additionalDocumentType?: string | null, additionalDocumentNumber?: string | null, reasonForUnsuccessfulPayment?: string | null, snapshotCollectorFullName?: string | null, adminUrl?: string | null, targetPopulation?: { __typename?: 'TargetPopulationNode', id: string, name: string } | null, sourcePayment?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null } | null, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string, email?: string | null, phoneNo: string, phoneNoValid?: boolean | null, phoneNoAlternative: string, phoneNoAlternativeValid?: boolean | null }, parent: { __typename?: 'PaymentPlanNode', id: string, status: PaymentPlanStatus, isFollowUp: boolean, unicefId?: string | null, program?: { __typename?: 'ProgramNode', id: string, name: string } | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null }, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, fullName?: string | null } | null } | null }; export type PaymentPlanQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; -export type PaymentPlanQuery = { __typename?: 'Query', paymentPlan?: { __typename?: 'PaymentPlanNode', id: string, version: any, unicefId?: string | null, status: PaymentPlanStatus, canCreateFollowUp?: boolean | null, backgroundActionStatus?: PaymentPlanBackgroundActionStatus | null, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, exchangeRate?: number | null, adminUrl?: string | null, currency: PaymentPlanCurrency, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, totalWithdrawnHouseholdsCount?: number | null, hasPaymentListExportFile?: boolean | null, hasFspDeliveryMechanismXlsxTemplate?: boolean | null, importedFileDate?: any | null, importedFileName?: string | null, totalEntitledQuantityUsd?: number | null, paymentsConflictsCount?: number | null, canSendToPaymentGateway?: boolean | null, canSplit?: boolean | null, exclusionReason: string, excludeHouseholdError: string, isFollowUp: boolean, unsuccessfulPaymentsCount?: number | null, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null }, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, approvalProcess: { __typename?: 'ApprovalProcessNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'ApprovalProcessNodeEdge', node?: { __typename?: 'ApprovalProcessNode', id: string, sentForApprovalDate?: any | null, sentForAuthorizationDate?: any | null, sentForFinanceReleaseDate?: any | null, approvalNumberRequired: number, authorizationNumberRequired: number, financeReleaseNumberRequired: number, rejectedOn?: string | null, sentForApprovalBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForAuthorizationBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForFinanceReleaseBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, actions?: { __typename?: 'FilteredActionsListNode', approval?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, authorization?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, financeRelease?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, reject?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null } | null> }, steficonRule?: { __typename?: 'RuleCommitNode', id: string, rule?: { __typename?: 'SteficonRuleNode', id: string, name: string } | null } | null, deliveryMechanisms?: Array<{ __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, code?: string | null, order?: number | null, sentToPaymentGateway: boolean, chosenConfiguration?: string | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string, communicationChannel: FinancialServiceProviderCommunicationChannel, isPaymentGateway?: boolean | null } | null } | null> | null, splitChoices?: Array<{ __typename?: 'ChoiceObject', name?: string | null, value?: string | null } | null> | null, volumeByDeliveryMechanism?: Array<{ __typename?: 'VolumeByDeliveryMechanismNode', volume?: number | null, volumeUsd?: number | null, deliveryMechanism?: { __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, order?: number | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentNodeEdge', node?: { __typename?: 'PaymentNode', id: string, status: PaymentStatus } | null } | null> }, reconciliationSummary?: { __typename?: 'ReconciliationSummaryNode', deliveredFully?: number | null, deliveredPartially?: number | null, notDelivered?: number | null, unsuccessful?: number | null, pending?: number | null, numberOfPayments?: number | null, reconciled?: number | null } | null, excludedHouseholds?: Array<{ __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null> | null, excludedIndividuals?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null } | null> | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, createdAt: any, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null } } | null } | null> }, sourcePaymentPlan?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null } | null, supportingDocuments?: Array<{ __typename?: 'PaymentPlanSupportingDocumentNode', id: string, title: string, file: string } | null> | null } | null }; - -export type AllCashPlansQueryVariables = Exact<{ - program?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - orderBy?: InputMaybe; - search?: InputMaybe; - serviceProvider?: InputMaybe; - deliveryType?: InputMaybe> | InputMaybe>; - verificationStatus?: InputMaybe> | InputMaybe>; - startDateGte?: InputMaybe; - endDateLte?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type AllCashPlansQuery = { __typename?: 'Query', allCashPlans?: { __typename?: 'CashPlanNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'CashPlanNodeEdge', cursor: string, node?: { __typename?: 'CashPlanNode', id: string, caId?: string | null, assistanceThrough: string, totalNumberOfHouseholds?: number | null, deliveryType?: string | null, startDate?: any | null, endDate?: any | null, totalPersonsCovered: number, dispersionDate: any, assistanceMeasurement: string, status: CashPlanStatus, currency?: string | null, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, updatedAt: any, serviceProvider?: { __typename?: 'ServiceProviderNode', id: string, caId: string, fullName?: string | null } | null, program: { __typename?: 'ProgramNode', id: string, name: string }, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, status: PaymentVerificationSummaryStatus } | null } | null } | null> } | null }; +export type PaymentPlanQuery = { __typename?: 'Query', paymentPlan?: { __typename?: 'PaymentPlanNode', id: string, version: any, unicefId?: string | null, status: PaymentPlanStatus, canCreateFollowUp?: boolean | null, backgroundActionStatus?: PaymentPlanBackgroundActionStatus | null, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, exchangeRate?: number | null, adminUrl?: string | null, currency?: string | null, currencyName?: string | null, startDate?: any | null, endDate?: any | null, dispersionStartDate?: any | null, dispersionEndDate?: any | null, femaleChildrenCount: number, femaleAdultsCount: number, maleChildrenCount: number, maleAdultsCount: number, totalHouseholdsCount: number, totalIndividualsCount: number, totalEntitledQuantity?: number | null, totalDeliveredQuantity?: number | null, totalUndeliveredQuantity?: number | null, totalWithdrawnHouseholdsCount?: number | null, hasPaymentListExportFile?: boolean | null, hasFspDeliveryMechanismXlsxTemplate?: boolean | null, importedFileDate?: any | null, importedFileName?: string | null, totalEntitledQuantityUsd?: number | null, paymentsConflictsCount?: number | null, canSendToPaymentGateway?: boolean | null, canSplit?: boolean | null, exclusionReason: string, excludeHouseholdError: string, isFollowUp: boolean, unsuccessfulPaymentsCount?: number | null, createdBy: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string }, program?: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null } | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, approvalProcess: { __typename?: 'ApprovalProcessNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'ApprovalProcessNodeEdge', node?: { __typename?: 'ApprovalProcessNode', id: string, sentForApprovalDate?: any | null, sentForAuthorizationDate?: any | null, sentForFinanceReleaseDate?: any | null, approvalNumberRequired: number, authorizationNumberRequired: number, financeReleaseNumberRequired: number, rejectedOn?: string | null, sentForApprovalBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForAuthorizationBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, sentForFinanceReleaseBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null, actions?: { __typename?: 'FilteredActionsListNode', approval?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, authorization?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, financeRelease?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null, reject?: Array<{ __typename?: 'ApprovalNode', createdAt: any, comment?: string | null, info?: string | null, createdBy?: { __typename?: 'UserNode', id: string, firstName: string, lastName: string, email: string } | null } | null> | null } | null } | null } | null> }, steficonRule?: { __typename?: 'RuleCommitNode', id: string, rule?: { __typename?: 'SteficonRuleNode', id: string, name: string } | null } | null, deliveryMechanisms?: Array<{ __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, code?: string | null, order?: number | null, sentToPaymentGateway: boolean, chosenConfiguration?: string | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string, communicationChannel: FinancialServiceProviderCommunicationChannel, isPaymentGateway?: boolean | null } | null } | null> | null, splitChoices?: Array<{ __typename?: 'ChoiceObject', name?: string | null, value?: string | null } | null> | null, volumeByDeliveryMechanism?: Array<{ __typename?: 'VolumeByDeliveryMechanismNode', volume?: number | null, volumeUsd?: number | null, deliveryMechanism?: { __typename?: 'DeliveryMechanismPerPaymentPlanNode', id: string, name?: string | null, order?: number | null, fsp?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentNodeEdge', node?: { __typename?: 'PaymentNode', id: string, status: PaymentStatus } | null } | null> }, reconciliationSummary?: { __typename?: 'ReconciliationSummaryNode', deliveredFully?: number | null, deliveredPartially?: number | null, notDelivered?: number | null, unsuccessful?: number | null, pending?: number | null, numberOfPayments?: number | null, reconciled?: number | null } | null, excludedHouseholds?: Array<{ __typename?: 'HouseholdNode', id: string, unicefId?: string | null } | null> | null, excludedIndividuals?: Array<{ __typename?: 'IndividualNode', id: string, unicefId?: string | null } | null> | null, followUps: { __typename?: 'PaymentPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentPlanNodeEdge', node?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null, createdAt: any, paymentItems: { __typename?: 'PaymentNodeConnection', totalCount?: number | null } } | null } | null> }, sourcePaymentPlan?: { __typename?: 'PaymentPlanNode', id: string, unicefId?: string | null } | null, supportingDocuments?: Array<{ __typename?: 'PaymentPlanSupportingDocumentNode', id: string, title: string, file: string } | null> | null } | null }; export type AllCashPlansAndPaymentPlansQueryVariables = Exact<{ businessArea: Scalars['String']['input']; @@ -10357,20 +9705,6 @@ export type AllCashPlansAndPaymentPlansQueryVariables = Exact<{ export type AllCashPlansAndPaymentPlansQuery = { __typename?: 'Query', allCashPlansAndPaymentPlans?: { __typename?: 'PaginatedCashPlanAndPaymentPlanNode', totalCount?: number | null, pageInfo?: { __typename?: 'PageInfoNode', startCursor?: string | null, endCursor?: string | null, hasNextPage?: boolean | null, hasPreviousPage?: boolean | null } | null, edges?: Array<{ __typename?: 'CashPlanAndPaymentPlanEdges', cursor?: string | null, node?: { __typename?: 'CashPlanAndPaymentPlanNode', objType?: string | null, id?: string | null, unicefId?: string | null, verificationStatus?: string | null, status?: string | null, currency?: string | null, totalDeliveredQuantity?: number | null, startDate?: string | null, endDate?: string | null, programName?: string | null, updatedAt?: string | null, totalNumberOfHouseholds?: number | null, assistanceMeasurement?: string | null, totalEntitledQuantity?: number | null, totalUndeliveredQuantity?: number | null, dispersionDate?: string | null, serviceProviderFullName?: string | null, verificationPlans?: Array<{ __typename?: 'PaymentVerificationPlanNode', id: string, createdAt: any, unicefId?: string | null } | null> | null } | null } | null> | null } | null }; -export type AllPaymentRecordsQueryVariables = Exact<{ - parent?: InputMaybe; - household?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type AllPaymentRecordsQuery = { __typename?: 'Query', allPaymentRecords?: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', cursor: string, node?: { __typename?: 'PaymentRecordNode', id: string, createdAt: any, updatedAt: any, fullName: string, statusDate: any, status: PaymentRecordStatus, caId?: string | null, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, deliveryDate?: any | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null }, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string } | null, parent?: { __typename?: 'CashPlanNode', id: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> } | null }; - export type AllPaymentRecordsAndPaymentsQueryVariables = Exact<{ household?: InputMaybe; after?: InputMaybe; @@ -10397,13 +9731,6 @@ export type AllPaymentsForTableQueryVariables = Exact<{ export type AllPaymentsForTableQuery = { __typename?: 'Query', allPayments?: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentNodeEdge', cursor: string, node?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, status: PaymentStatus, entitlementQuantity?: number | null, entitlementQuantityUsd?: number | null, currency: string, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, paymentPlanHardConflicted?: boolean | null, paymentPlanSoftConflicted?: boolean | null, fspAuthCode?: string | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string } | null } | null> } | null }, paymentPlanHardConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, paymentPlanSoftConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, financialServiceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> } | null }; -export type CashPlanQueryVariables = Exact<{ - id: Scalars['ID']['input']; -}>; - - -export type CashPlanQuery = { __typename?: 'Query', cashPlan?: { __typename?: 'CashPlanNode', id: string, version: any, canCreatePaymentVerificationPlan?: boolean | null, availablePaymentRecordsCount?: number | null, name: string, startDate?: any | null, endDate?: any | null, updatedAt: any, status: CashPlanStatus, deliveryType?: string | null, fundsCommitment?: string | null, downPayment?: string | null, dispersionDate: any, assistanceThrough: string, caId?: string | null, caHashId?: any | null, bankReconciliationSuccess?: number | null, bankReconciliationError?: number | null, totalNumberOfHouseholds?: number | null, serviceProvider?: { __typename?: 'ServiceProviderNode', id: string, caId: string, fullName?: string | null } | null, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, unicefId?: string | null, adminUrl?: string | null, status: PaymentVerificationPlanStatus, sampleSize?: number | null, receivedCount?: number | null, notReceivedCount?: number | null, respondedCount?: number | null, verificationChannel: PaymentVerificationPlanVerificationChannel, sampling: PaymentVerificationPlanSampling, receivedWithProblemsCount?: number | null, rapidProFlowId: string, confidenceInterval?: number | null, marginOfError?: number | null, activationDate?: any | null, completionDate?: any | null, excludedAdminAreasFilter?: Array | null, sexFilter?: string | null, xlsxFileExporting: boolean, hasXlsxFile?: boolean | null, xlsxFileWasDownloaded?: boolean | null, xlsxFileImported: boolean, ageFilter?: { __typename?: 'AgeFilterObject', min?: number | null, max?: number | null } | null } | null } | null> } | null, paymentVerificationSummary?: { __typename?: 'PaymentVerificationSummaryNode', id: string, createdAt: any, updatedAt: any, status: PaymentVerificationSummaryStatus, activationDate?: any | null, completionDate?: any | null } | null, program: { __typename?: 'ProgramNode', id: string, name: string, caId?: string | null }, paymentItems: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string } } | null } | null> } } | null }; - export type IndividualPhotosQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; @@ -10411,27 +9738,6 @@ export type IndividualPhotosQueryVariables = Exact<{ export type IndividualPhotosQuery = { __typename?: 'Query', individual?: { __typename?: 'IndividualNode', id: string, photo?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, documentNumber: string, photo?: string | null } | null } | null> } | null } | null }; -export type LookUpPaymentRecordsQueryVariables = Exact<{ - parent?: InputMaybe; - household?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - businessArea?: InputMaybe; -}>; - - -export type LookUpPaymentRecordsQuery = { __typename?: 'Query', allPaymentRecords?: { __typename?: 'PaymentRecordNodeConnection', totalCount?: number | null, edgeCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentRecordNodeEdge', cursor: string, node?: { __typename?: 'PaymentRecordNode', id: string, caId?: string | null, deliveredQuantity?: number | null, parent?: { __typename?: 'CashPlanNode', id: string, name: string } | null } | null } | null> } | null }; - -export type PaymentRecordQueryVariables = Exact<{ - id: Scalars['ID']['input']; -}>; - - -export type PaymentRecordQuery = { __typename?: 'Query', paymentRecord?: { __typename?: 'PaymentRecordNode', id: string, status: PaymentRecordStatus, statusDate: any, caId?: string | null, caHashId?: any | null, registrationCaId?: string | null, fullName: string, distributionModality: string, totalPersonsCovered: number, currency: string, entitlementQuantity?: number | null, deliveredQuantity?: number | null, deliveryDate?: any | null, entitlementCardIssueDate?: any | null, entitlementCardNumber?: string | null, deliveredQuantityUsd?: number | null, transactionReferenceId?: string | null, targetPopulation: { __typename?: 'TargetPopulationNode', id: string, name: string }, verification?: { __typename?: 'PaymentVerificationNode', id: string, status: PaymentVerificationStatus, statusDate?: any | null, receivedAmount?: number | null, isManuallyEditable?: boolean | null, adminUrl?: string | null } | null, household: { __typename?: 'HouseholdNode', id: string, size?: number | null, status?: string | null, unicefId?: string | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, phoneNo: string, phoneNoAlternative: string, phoneNoValid?: boolean | null, phoneNoAlternativeValid?: boolean | null, fullName: string } | null }, parent?: { __typename?: 'CashPlanNode', id: string, unicefId?: string | null, caId?: string | null, program: { __typename?: 'ProgramNode', id: string, name: string }, verificationPlans?: { __typename?: 'PaymentVerificationPlanNodeConnection', edges: Array<{ __typename?: 'PaymentVerificationPlanNodeEdge', node?: { __typename?: 'PaymentVerificationPlanNode', id: string, status: PaymentVerificationPlanStatus, verificationChannel: PaymentVerificationPlanVerificationChannel } | null } | null> } | null } | null, deliveryType?: { __typename?: 'DeliveryMechanismNode', name?: string | null } | null, serviceProvider: { __typename?: 'ServiceProviderNode', id: string, fullName?: string | null, shortName?: string | null } } | null }; - export type AllPaymentVerificationLogEntriesQueryVariables = Exact<{ businessArea: Scalars['String']['input']; objectId?: InputMaybe; @@ -10630,7 +9936,7 @@ export type HouseholdQueryVariables = Exact<{ }>; -export type HouseholdQuery = { __typename?: 'Query', household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, paymentrecordSet: { __typename?: 'PaymentRecordNodeConnection', edges: Array<{ __typename?: 'PaymentRecordNodeEdge', node?: { __typename?: 'PaymentRecordNode', id: string, fullName: string, parent?: { __typename?: 'CashPlanNode', id: string, totalPersonsCovered: number, totalDeliveredQuantity?: number | null, assistanceMeasurement: string, program: { __typename?: 'ProgramNode', id: string, name: string } } | null } | null } | null> }, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null }; +export type HouseholdQuery = { __typename?: 'Query', household?: { __typename?: 'HouseholdNode', activeIndividualsCount?: number | null, countryOrigin?: string | null, country?: string | null, zipCode?: string | null, femaleAgeGroup05Count?: number | null, femaleAgeGroup611Count?: number | null, femaleAgeGroup1217Count?: number | null, femaleAgeGroup1859Count?: number | null, femaleAgeGroup60Count?: number | null, pregnantCount?: number | null, maleAgeGroup05Count?: number | null, maleAgeGroup611Count?: number | null, maleAgeGroup1217Count?: number | null, maleAgeGroup1859Count?: number | null, maleAgeGroup60Count?: number | null, femaleAgeGroup05DisabledCount?: number | null, femaleAgeGroup611DisabledCount?: number | null, femaleAgeGroup1217DisabledCount?: number | null, femaleAgeGroup1859DisabledCount?: number | null, femaleAgeGroup60DisabledCount?: number | null, maleAgeGroup05DisabledCount?: number | null, maleAgeGroup611DisabledCount?: number | null, maleAgeGroup1217DisabledCount?: number | null, maleAgeGroup1859DisabledCount?: number | null, maleAgeGroup60DisabledCount?: number | null, fchildHoh?: boolean | null, childHoh?: boolean | null, start?: any | null, deviceid: string, orgNameEnumerator: string, returnee?: boolean | null, address: string, nameEnumerator: string, lastSyncAt?: any | null, consentSharing?: Array | null, orgEnumerator: HouseholdOrgEnumerator, updatedAt: any, consent?: boolean | null, collectIndividualData: HouseholdCollectIndividualData, flexFields?: any | null, programRegistrationId?: string | null, id: string, status?: string | null, adminUrl?: string | null, createdAt: any, rdiMergeStatus: HouseholdRdiMergeStatus, residenceStatus?: string | null, maleChildrenCount?: number | null, femaleChildrenCount?: number | null, childrenDisabledCount?: number | null, size?: number | null, totalCashReceived?: any | null, totalCashReceivedUsd?: any | null, currency?: string | null, firstRegistrationDate: any, lastRegistrationDate: any, sanctionListPossibleMatch?: boolean | null, sanctionListConfirmedMatch?: boolean | null, hasDuplicates?: boolean | null, unicefId?: string | null, unhcrId: string, geopoint?: any | null, village: string, adminAreaTitle?: string | null, individuals?: { __typename?: 'IndividualNodeConnection', totalCount?: number | null, edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, age?: number | null, lastRegistrationDate: any, rdiMergeStatus: IndividualRdiMergeStatus, adminUrl?: string | null, createdAt: any, updatedAt: any, fullName: string, sex: IndividualSex, unicefId?: string | null, birthDate: any, maritalStatus: IndividualMaritalStatus, phoneNo: string, phoneNoValid?: boolean | null, email?: string | null, sanctionListPossibleMatch: boolean, sanctionListConfirmedMatch: boolean, deduplicationGoldenRecordStatus: IndividualDeduplicationGoldenRecordStatus, sanctionListLastCheck?: any | null, role?: string | null, relationship?: IndividualRelationship | null, status?: string | null, documents?: { __typename?: 'DocumentNodeConnection', edges: Array<{ __typename?: 'DocumentNodeEdge', node?: { __typename?: 'DocumentNode', id: string, country?: string | null, countryIso3?: string | null, documentNumber: string, photo?: string | null, type: { __typename?: 'ImportedDocumentTypeNode', label: string, key: string } } | null } | null> } | null, identities?: { __typename?: 'IndividualIdentityNodeConnection', edges: Array<{ __typename?: 'IndividualIdentityNodeEdge', node?: { __typename?: 'IndividualIdentityNode', id: string, partner?: string | null, country?: string | null, number: string } | null } | null> } | null, household?: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, status?: string | null, importId?: string | null, totalCashReceivedUsd?: any | null, lastRegistrationDate: any, start?: any | null, firstRegistrationDate: any, countryOrigin?: string | null, village: string, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> } } | null } | null } | null> } | null, programs: { __typename?: 'ProgramNodeConnection', edges: Array<{ __typename?: 'ProgramNodeEdge', node?: { __typename?: 'ProgramNode', id: string, name: string } | null } | null> }, registrationDataImport?: { __typename?: 'RegistrationDataImportNode', name: string, dataSource: RegistrationDataImportDataSource, importDate: any, importedBy?: { __typename?: 'UserNode', firstName: string, lastName: string, email: string, username: string } | null } | null, deliveredQuantities?: Array<{ __typename?: 'DeliveredQuantityNode', totalDeliveredQuantity?: any | null, currency?: string | null } | null> | null, admin1?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin2?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin3?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, admin4?: { __typename?: 'AreaNode', id: string, name: string, level: number, pCode?: string | null } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, fullName: string, givenName: string, familyName: string } | null } | null }; export type HouseholdChoiceDataQueryVariables = Exact<{ [key: string]: never; }>; @@ -11416,24 +10722,6 @@ export const HouseholdDetailedFragmentDoc = gql` username } } - paymentrecordSet { - edges { - node { - id - fullName - parent { - id - totalPersonsCovered - program { - id - name - } - totalDeliveredQuantity - assistanceMeasurement - } - } - } - } flexFields deliveredQuantities { totalDeliveredQuantity @@ -11943,75 +11231,6 @@ export const MergedIndividualMinimalFragmentDoc = gql` importId } `; -export const PaymentRecordDetailsFragmentDoc = gql` - fragment paymentRecordDetails on PaymentRecordNode { - id - status - statusDate - caId - caHashId - registrationCaId - verification { - id - status - statusDate - receivedAmount - } - household { - id - status - size - unicefId - headOfHousehold { - id - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - } - } - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - parent { - id - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } - } - } - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - deliveryType { - name - } - entitlementCardIssueDate - entitlementCardNumber - transactionReferenceId - serviceProvider { - id - fullName - shortName - } -} - `; export const ProgramDetailsFragmentDoc = gql` fragment programDetails on ProgramNode { id @@ -14597,82 +13816,6 @@ export function useInvalidPaymentVerificationPlanMutation(baseOptions?: Apollo.M export type InvalidPaymentVerificationPlanMutationHookResult = ReturnType; export type InvalidPaymentVerificationPlanMutationResult = Apollo.MutationResult; export type InvalidPaymentVerificationPlanMutationOptions = Apollo.BaseMutationOptions; -export const MarkPrAsFailedDocument = gql` - mutation markPRAsFailed($paymentRecordId: ID!) { - markPaymentRecordAsFailed(paymentRecordId: $paymentRecordId) { - paymentRecord { - ...paymentRecordDetails - } - } -} - ${PaymentRecordDetailsFragmentDoc}`; -export type MarkPrAsFailedMutationFn = Apollo.MutationFunction; - -/** - * __useMarkPrAsFailedMutation__ - * - * To run a mutation, you first call `useMarkPrAsFailedMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useMarkPrAsFailedMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [markPrAsFailedMutation, { data, loading, error }] = useMarkPrAsFailedMutation({ - * variables: { - * paymentRecordId: // value for 'paymentRecordId' - * }, - * }); - */ -export function useMarkPrAsFailedMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(MarkPrAsFailedDocument, options); - } -export type MarkPrAsFailedMutationHookResult = ReturnType; -export type MarkPrAsFailedMutationResult = Apollo.MutationResult; -export type MarkPrAsFailedMutationOptions = Apollo.BaseMutationOptions; -export const RevertMarkPrAsFailedDocument = gql` - mutation revertMarkPRAsFailed($paymentRecordId: ID!, $deliveredQuantity: Decimal!, $deliveryDate: Date!) { - revertMarkPaymentRecordAsFailed( - paymentRecordId: $paymentRecordId - deliveredQuantity: $deliveredQuantity - deliveryDate: $deliveryDate - ) { - paymentRecord { - ...paymentRecordDetails - } - } -} - ${PaymentRecordDetailsFragmentDoc}`; -export type RevertMarkPrAsFailedMutationFn = Apollo.MutationFunction; - -/** - * __useRevertMarkPrAsFailedMutation__ - * - * To run a mutation, you first call `useRevertMarkPrAsFailedMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useRevertMarkPrAsFailedMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [revertMarkPrAsFailedMutation, { data, loading, error }] = useRevertMarkPrAsFailedMutation({ - * variables: { - * paymentRecordId: // value for 'paymentRecordId' - * deliveredQuantity: // value for 'deliveredQuantity' - * deliveryDate: // value for 'deliveryDate' - * }, - * }); - */ -export function useRevertMarkPrAsFailedMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(RevertMarkPrAsFailedDocument, options); - } -export type RevertMarkPrAsFailedMutationHookResult = ReturnType; -export type RevertMarkPrAsFailedMutationResult = Apollo.MutationResult; -export type RevertMarkPrAsFailedMutationOptions = Apollo.BaseMutationOptions; export const SplitPpDocument = gql` mutation SplitPP($paymentPlanId: ID!, $splitType: String!, $paymentsNo: Int!) { splitPaymentPlan( @@ -15384,39 +14527,6 @@ export function useUploadImportDataXlsxFileAsyncMutation(baseOptions?: Apollo.Mu export type UploadImportDataXlsxFileAsyncMutationHookResult = ReturnType; export type UploadImportDataXlsxFileAsyncMutationResult = Apollo.MutationResult; export type UploadImportDataXlsxFileAsyncMutationOptions = Apollo.BaseMutationOptions; -export const CreateDashboardReportDocument = gql` - mutation CreateDashboardReport($reportData: CreateDashboardReportInput!) { - createDashboardReport(reportData: $reportData) { - success - } -} - `; -export type CreateDashboardReportMutationFn = Apollo.MutationFunction; - -/** - * __useCreateDashboardReportMutation__ - * - * To run a mutation, you first call `useCreateDashboardReportMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useCreateDashboardReportMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [createDashboardReportMutation, { data, loading, error }] = useCreateDashboardReportMutation({ - * variables: { - * reportData: // value for 'reportData' - * }, - * }); - */ -export function useCreateDashboardReportMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(CreateDashboardReportDocument, options); - } -export type CreateDashboardReportMutationHookResult = ReturnType; -export type CreateDashboardReportMutationResult = Apollo.MutationResult; -export type CreateDashboardReportMutationOptions = Apollo.BaseMutationOptions; export const CreateReportDocument = gql` mutation CreateReport($reportData: CreateReportInput!) { createReport(reportData: $reportData) { @@ -19027,116 +18137,10 @@ export type PaymentPlanQueryHookResult = ReturnType; export type PaymentPlanLazyQueryHookResult = ReturnType; export type PaymentPlanSuspenseQueryHookResult = ReturnType; export type PaymentPlanQueryResult = Apollo.QueryResult; -export const AllCashPlansDocument = gql` - query AllCashPlans($program: ID, $after: String, $before: String, $first: Int, $last: Int, $orderBy: String, $search: String, $serviceProvider: String, $deliveryType: [String], $verificationStatus: [String], $startDateGte: DateTime, $endDateLte: DateTime, $businessArea: String) { - allCashPlans( - program: $program - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - search: $search - serviceProvider_FullName_Startswith: $serviceProvider - deliveryType: $deliveryType - verificationStatus: $verificationStatus - startDate_Gte: $startDateGte - endDate_Lte: $endDateLte - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - totalCount - edges { - cursor - node { - id - caId - assistanceThrough - totalNumberOfHouseholds - serviceProvider { - id - caId - fullName - } - deliveryType - startDate - endDate - program { - id - name - } - totalPersonsCovered - dispersionDate - assistanceMeasurement - status - currency - totalEntitledQuantity - totalDeliveredQuantity - totalUndeliveredQuantity - updatedAt - paymentVerificationSummary { - id - status - } - } - } - } -} - `; - -/** - * __useAllCashPlansQuery__ - * - * To run a query within a React component, call `useAllCashPlansQuery` and pass it any options that fit your needs. - * When your component renders, `useAllCashPlansQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAllCashPlansQuery({ - * variables: { - * program: // value for 'program' - * after: // value for 'after' - * before: // value for 'before' - * first: // value for 'first' - * last: // value for 'last' - * orderBy: // value for 'orderBy' - * search: // value for 'search' - * serviceProvider: // value for 'serviceProvider' - * deliveryType: // value for 'deliveryType' - * verificationStatus: // value for 'verificationStatus' - * startDateGte: // value for 'startDateGte' - * endDateLte: // value for 'endDateLte' - * businessArea: // value for 'businessArea' - * }, - * }); - */ -export function useAllCashPlansQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AllCashPlansDocument, options); - } -export function useAllCashPlansLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AllCashPlansDocument, options); - } -export function useAllCashPlansSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(AllCashPlansDocument, options); - } -export type AllCashPlansQueryHookResult = ReturnType; -export type AllCashPlansLazyQueryHookResult = ReturnType; -export type AllCashPlansSuspenseQueryHookResult = ReturnType; -export type AllCashPlansQueryResult = Apollo.QueryResult; -export const AllCashPlansAndPaymentPlansDocument = gql` - query allCashPlansAndPaymentPlans($businessArea: String!, $program: String, $search: String, $serviceProvider: String, $deliveryType: [String], $verificationStatus: [String], $startDateGte: String, $endDateLte: String, $orderBy: String, $first: Int, $last: Int, $before: String, $after: String, $isPaymentVerificationPage: Boolean) { - allCashPlansAndPaymentPlans( - businessArea: $businessArea +export const AllCashPlansAndPaymentPlansDocument = gql` + query allCashPlansAndPaymentPlans($businessArea: String!, $program: String, $search: String, $serviceProvider: String, $deliveryType: [String], $verificationStatus: [String], $startDateGte: String, $endDateLte: String, $orderBy: String, $first: Int, $last: Int, $before: String, $after: String, $isPaymentVerificationPage: Boolean) { + allCashPlansAndPaymentPlans( + businessArea: $businessArea program: $program search: $search serviceProvider: $serviceProvider @@ -19234,103 +18238,6 @@ export type AllCashPlansAndPaymentPlansQueryHookResult = ReturnType; export type AllCashPlansAndPaymentPlansSuspenseQueryHookResult = ReturnType; export type AllCashPlansAndPaymentPlansQueryResult = Apollo.QueryResult; -export const AllPaymentRecordsDocument = gql` - query AllPaymentRecords($parent: ID, $household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - createdAt - updatedAt - fullName - statusDate - status - caId - totalPersonsCovered - household { - id - unicefId - size - } - headOfHousehold { - id - fullName - } - currency - entitlementQuantity - deliveredQuantity - deliveredQuantityUsd - deliveryDate - parent { - id - program { - id - name - } - } - } - } - totalCount - edgeCount - } -} - `; - -/** - * __useAllPaymentRecordsQuery__ - * - * To run a query within a React component, call `useAllPaymentRecordsQuery` and pass it any options that fit your needs. - * When your component renders, `useAllPaymentRecordsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAllPaymentRecordsQuery({ - * variables: { - * parent: // value for 'parent' - * household: // value for 'household' - * after: // value for 'after' - * before: // value for 'before' - * orderBy: // value for 'orderBy' - * first: // value for 'first' - * last: // value for 'last' - * businessArea: // value for 'businessArea' - * }, - * }); - */ -export function useAllPaymentRecordsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AllPaymentRecordsDocument, options); - } -export function useAllPaymentRecordsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AllPaymentRecordsDocument, options); - } -export function useAllPaymentRecordsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(AllPaymentRecordsDocument, options); - } -export type AllPaymentRecordsQueryHookResult = ReturnType; -export type AllPaymentRecordsLazyQueryHookResult = ReturnType; -export type AllPaymentRecordsSuspenseQueryHookResult = ReturnType; -export type AllPaymentRecordsQueryResult = Apollo.QueryResult; export const AllPaymentRecordsAndPaymentsDocument = gql` query AllPaymentRecordsAndPayments($household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String!) { allPaymentRecordsAndPayments( @@ -19477,421 +18384,114 @@ export const AllPaymentsForTableDocument = gql` paymentPlanId paymentPlanStartDate paymentPlanEndDate - paymentPlanStatus - paymentId - paymentUnicefId - } - collector { - id - unicefId - fullName - } - financialServiceProvider { - id - name - } - fspAuthCode - } - } - } -} - `; - -/** - * __useAllPaymentsForTableQuery__ - * - * To run a query within a React component, call `useAllPaymentsForTableQuery` and pass it any options that fit your needs. - * When your component renders, `useAllPaymentsForTableQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAllPaymentsForTableQuery({ - * variables: { - * after: // value for 'after' - * before: // value for 'before' - * first: // value for 'first' - * last: // value for 'last' - * orderBy: // value for 'orderBy' - * businessArea: // value for 'businessArea' - * paymentPlanId: // value for 'paymentPlanId' - * }, - * }); - */ -export function useAllPaymentsForTableQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: AllPaymentsForTableQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AllPaymentsForTableDocument, options); - } -export function useAllPaymentsForTableLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AllPaymentsForTableDocument, options); - } -export function useAllPaymentsForTableSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(AllPaymentsForTableDocument, options); - } -export type AllPaymentsForTableQueryHookResult = ReturnType; -export type AllPaymentsForTableLazyQueryHookResult = ReturnType; -export type AllPaymentsForTableSuspenseQueryHookResult = ReturnType; -export type AllPaymentsForTableQueryResult = Apollo.QueryResult; -export const CashPlanDocument = gql` - query CashPlan($id: ID!) { - cashPlan(id: $id) { - id - version - canCreatePaymentVerificationPlan - availablePaymentRecordsCount - name - startDate - endDate - updatedAt - status - deliveryType - fundsCommitment - downPayment - dispersionDate - assistanceThrough - serviceProvider { - id - caId - fullName - } - caId - caHashId - dispersionDate - bankReconciliationSuccess - bankReconciliationError - totalNumberOfHouseholds - verificationPlans { - totalCount - edges { - node { - id - unicefId - adminUrl - status - sampleSize - receivedCount - notReceivedCount - respondedCount - verificationChannel - sampling - receivedCount - receivedWithProblemsCount - rapidProFlowId - confidenceInterval - marginOfError - activationDate - completionDate - ageFilter { - min - max - } - excludedAdminAreasFilter - sexFilter - xlsxFileExporting - hasXlsxFile - xlsxFileWasDownloaded - xlsxFileImported - } - } - } - paymentVerificationSummary { - id - createdAt - updatedAt - status - activationDate - completionDate - } - program { - id - name - caId - } - paymentItems { - totalCount - edgeCount - edges { - node { - targetPopulation { - id - name - } - } - } - } - } -} - `; - -/** - * __useCashPlanQuery__ - * - * To run a query within a React component, call `useCashPlanQuery` and pass it any options that fit your needs. - * When your component renders, `useCashPlanQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useCashPlanQuery({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function useCashPlanQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: CashPlanQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(CashPlanDocument, options); - } -export function useCashPlanLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(CashPlanDocument, options); - } -export function useCashPlanSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(CashPlanDocument, options); - } -export type CashPlanQueryHookResult = ReturnType; -export type CashPlanLazyQueryHookResult = ReturnType; -export type CashPlanSuspenseQueryHookResult = ReturnType; -export type CashPlanQueryResult = Apollo.QueryResult; -export const IndividualPhotosDocument = gql` - query IndividualPhotos($id: ID!) { - individual(id: $id) { - id - photo - documents { - edges { - node { - id - documentNumber - photo - } - } - } - } -} - `; - -/** - * __useIndividualPhotosQuery__ - * - * To run a query within a React component, call `useIndividualPhotosQuery` and pass it any options that fit your needs. - * When your component renders, `useIndividualPhotosQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useIndividualPhotosQuery({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function useIndividualPhotosQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: IndividualPhotosQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(IndividualPhotosDocument, options); - } -export function useIndividualPhotosLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(IndividualPhotosDocument, options); + paymentPlanStatus + paymentId + paymentUnicefId } -export function useIndividualPhotosSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(IndividualPhotosDocument, options); + collector { + id + unicefId + fullName } -export type IndividualPhotosQueryHookResult = ReturnType; -export type IndividualPhotosLazyQueryHookResult = ReturnType; -export type IndividualPhotosSuspenseQueryHookResult = ReturnType; -export type IndividualPhotosQueryResult = Apollo.QueryResult; -export const LookUpPaymentRecordsDocument = gql` - query LookUpPaymentRecords($parent: ID, $household: ID, $after: String, $before: String, $orderBy: String, $first: Int, $last: Int, $businessArea: String) { - allPaymentRecords( - parent: $parent - household: $household - after: $after - before: $before - first: $first - last: $last - orderBy: $orderBy - businessArea: $businessArea - ) { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - caId - parent { + financialServiceProvider { id name } - deliveredQuantity + fspAuthCode } } - totalCount - edgeCount } } `; /** - * __useLookUpPaymentRecordsQuery__ + * __useAllPaymentsForTableQuery__ * - * To run a query within a React component, call `useLookUpPaymentRecordsQuery` and pass it any options that fit your needs. - * When your component renders, `useLookUpPaymentRecordsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useAllPaymentsForTableQuery` and pass it any options that fit your needs. + * When your component renders, `useAllPaymentsForTableQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example - * const { data, loading, error } = useLookUpPaymentRecordsQuery({ + * const { data, loading, error } = useAllPaymentsForTableQuery({ * variables: { - * parent: // value for 'parent' - * household: // value for 'household' * after: // value for 'after' * before: // value for 'before' - * orderBy: // value for 'orderBy' * first: // value for 'first' * last: // value for 'last' + * orderBy: // value for 'orderBy' * businessArea: // value for 'businessArea' + * paymentPlanId: // value for 'paymentPlanId' * }, * }); */ -export function useLookUpPaymentRecordsQuery(baseOptions?: Apollo.QueryHookOptions) { +export function useAllPaymentsForTableQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: AllPaymentsForTableQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(LookUpPaymentRecordsDocument, options); + return Apollo.useQuery(AllPaymentsForTableDocument, options); } -export function useLookUpPaymentRecordsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { +export function useAllPaymentsForTableLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(LookUpPaymentRecordsDocument, options); + return Apollo.useLazyQuery(AllPaymentsForTableDocument, options); } -export function useLookUpPaymentRecordsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { +export function useAllPaymentsForTableSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(LookUpPaymentRecordsDocument, options); - } -export type LookUpPaymentRecordsQueryHookResult = ReturnType; -export type LookUpPaymentRecordsLazyQueryHookResult = ReturnType; -export type LookUpPaymentRecordsSuspenseQueryHookResult = ReturnType; -export type LookUpPaymentRecordsQueryResult = Apollo.QueryResult; -export const PaymentRecordDocument = gql` - query PaymentRecord($id: ID!) { - paymentRecord(id: $id) { + return Apollo.useSuspenseQuery(AllPaymentsForTableDocument, options); + } +export type AllPaymentsForTableQueryHookResult = ReturnType; +export type AllPaymentsForTableLazyQueryHookResult = ReturnType; +export type AllPaymentsForTableSuspenseQueryHookResult = ReturnType; +export type AllPaymentsForTableQueryResult = Apollo.QueryResult; +export const IndividualPhotosDocument = gql` + query IndividualPhotos($id: ID!) { + individual(id: $id) { id - status - statusDate - caId - caHashId - registrationCaId - fullName - distributionModality - totalPersonsCovered - targetPopulation { - id - name - } - verification { - id - status - statusDate - receivedAmount - isManuallyEditable - adminUrl - } - currency - entitlementQuantity - deliveredQuantity - deliveryDate - entitlementCardIssueDate - entitlementCardNumber - household { - id - size - status - unicefId - headOfHousehold { - id - unicefId - phoneNo - phoneNoAlternative - phoneNoValid - phoneNoAlternativeValid - fullName - } - } - parent { - id - unicefId - caId - program { - id - name - } - verificationPlans { - edges { - node { - id - status - verificationChannel - } + photo + documents { + edges { + node { + id + documentNumber + photo } } } - deliveredQuantityUsd - deliveryType { - name - } - transactionReferenceId - serviceProvider { - id - fullName - shortName - } } } `; /** - * __usePaymentRecordQuery__ + * __useIndividualPhotosQuery__ * - * To run a query within a React component, call `usePaymentRecordQuery` and pass it any options that fit your needs. - * When your component renders, `usePaymentRecordQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useIndividualPhotosQuery` and pass it any options that fit your needs. + * When your component renders, `useIndividualPhotosQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example - * const { data, loading, error } = usePaymentRecordQuery({ + * const { data, loading, error } = useIndividualPhotosQuery({ * variables: { * id: // value for 'id' * }, * }); */ -export function usePaymentRecordQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: PaymentRecordQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { +export function useIndividualPhotosQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: IndividualPhotosQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PaymentRecordDocument, options); + return Apollo.useQuery(IndividualPhotosDocument, options); } -export function usePaymentRecordLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { +export function useIndividualPhotosLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PaymentRecordDocument, options); + return Apollo.useLazyQuery(IndividualPhotosDocument, options); } -export function usePaymentRecordSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { +export function useIndividualPhotosSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(PaymentRecordDocument, options); + return Apollo.useSuspenseQuery(IndividualPhotosDocument, options); } -export type PaymentRecordQueryHookResult = ReturnType; -export type PaymentRecordLazyQueryHookResult = ReturnType; -export type PaymentRecordSuspenseQueryHookResult = ReturnType; -export type PaymentRecordQueryResult = Apollo.QueryResult; +export type IndividualPhotosQueryHookResult = ReturnType; +export type IndividualPhotosLazyQueryHookResult = ReturnType; +export type IndividualPhotosSuspenseQueryHookResult = ReturnType; +export type IndividualPhotosQueryResult = Apollo.QueryResult; export const AllPaymentVerificationLogEntriesDocument = gql` query AllPaymentVerificationLogEntries($businessArea: String!, $objectId: UUID, $objectType: String, $after: String, $before: String, $first: Int, $last: Int, $search: String, $module: String) { allPaymentVerificationLogEntries( @@ -23699,7 +22299,7 @@ export type DirectiveResolverFn> = { - Node: ( ApprovalProcessNode ) | ( AreaNode ) | ( AreaTypeNode ) | ( BankAccountInfoNode ) | ( BusinessAreaNode ) | ( CashPlanNode ) | ( CommunicationMessageNode ) | ( CommunicationMessageRecipientMapNode ) | ( DataCollectingTypeNode ) | ( DeliveryMechanismDataNode ) | ( DeliveryMechanismNode ) | ( DeliveryMechanismPerPaymentPlanNode ) | ( DocumentNode ) | ( FeedbackMessageNode ) | ( FeedbackNode ) | ( FinancialServiceProviderNode ) | ( FinancialServiceProviderXlsxTemplateNode ) | ( GrievanceDocumentNode ) | ( GrievanceTicketNode ) | ( HouseholdNode ) | ( ImportDataNode ) | ( IndividualIdentityNode ) | ( IndividualNode ) | ( KoboImportDataNode ) | ( LogEntryNode ) | ( PaymentHouseholdSnapshotNode ) | ( PaymentNode ) | ( PaymentPlanNode ) | ( PaymentPlanSupportingDocumentNode ) | ( PaymentRecordNode ) | ( PaymentVerificationLogEntryNode ) | ( PaymentVerificationNode ) | ( PaymentVerificationPlanNode ) | ( PaymentVerificationSummaryNode ) | ( PeriodicFieldNode ) | ( ProgramCycleNode ) | ( ProgramNode ) | ( RecipientNode ) | ( RegistrationDataImportDatahubNode ) | ( RegistrationDataImportNode ) | ( ReportNode ) | ( RuleCommitNode ) | ( SanctionListIndividualAliasNameNode ) | ( SanctionListIndividualCountriesNode ) | ( SanctionListIndividualDateOfBirthNode ) | ( SanctionListIndividualDocumentNode ) | ( SanctionListIndividualNationalitiesNode ) | ( SanctionListIndividualNode ) | ( ServiceProviderNode ) | ( SteficonRuleNode ) | ( SurveyNode ) | ( TargetPopulationNode ) | ( TicketAddIndividualDetailsNode ) | ( TicketComplaintDetailsNode ) | ( TicketDeleteHouseholdDetailsNode ) | ( TicketDeleteIndividualDetailsNode ) | ( TicketHouseholdDataUpdateDetailsNode ) | ( TicketIndividualDataUpdateDetailsNode ) | ( TicketNeedsAdjudicationDetailsNode ) | ( TicketNegativeFeedbackDetailsNode ) | ( TicketNoteNode ) | ( TicketPaymentVerificationDetailsNode ) | ( TicketPositiveFeedbackDetailsNode ) | ( TicketReferralDetailsNode ) | ( TicketSensitiveDetailsNode ) | ( TicketSystemFlaggingDetailsNode ) | ( UserBusinessAreaNode ) | ( UserNode ) | ( VolumeByDeliveryMechanismNode ); + Node: ( ApprovalProcessNode ) | ( AreaNode ) | ( AreaTypeNode ) | ( BankAccountInfoNode ) | ( BusinessAreaNode ) | ( CommunicationMessageNode ) | ( CommunicationMessageRecipientMapNode ) | ( DataCollectingTypeNode ) | ( DeliveryMechanismDataNode ) | ( DeliveryMechanismNode ) | ( DeliveryMechanismPerPaymentPlanNode ) | ( DocumentNode ) | ( FeedbackMessageNode ) | ( FeedbackNode ) | ( FinancialServiceProviderNode ) | ( FinancialServiceProviderXlsxTemplateNode ) | ( GrievanceDocumentNode ) | ( GrievanceTicketNode ) | ( HouseholdNode ) | ( ImportDataNode ) | ( IndividualIdentityNode ) | ( IndividualNode ) | ( KoboImportDataNode ) | ( LogEntryNode ) | ( PaymentHouseholdSnapshotNode ) | ( PaymentNode ) | ( PaymentPlanNode ) | ( PaymentPlanSupportingDocumentNode ) | ( PaymentVerificationLogEntryNode ) | ( PaymentVerificationNode ) | ( PaymentVerificationPlanNode ) | ( PaymentVerificationSummaryNode ) | ( PeriodicFieldNode ) | ( ProgramCycleNode ) | ( ProgramNode ) | ( RecipientNode ) | ( RegistrationDataImportDatahubNode ) | ( RegistrationDataImportNode ) | ( ReportNode ) | ( RuleCommitNode ) | ( SanctionListIndividualAliasNameNode ) | ( SanctionListIndividualCountriesNode ) | ( SanctionListIndividualDateOfBirthNode ) | ( SanctionListIndividualDocumentNode ) | ( SanctionListIndividualNationalitiesNode ) | ( SanctionListIndividualNode ) | ( SteficonRuleNode ) | ( SurveyNode ) | ( TargetPopulationNode ) | ( TicketAddIndividualDetailsNode ) | ( TicketComplaintDetailsNode ) | ( TicketDeleteHouseholdDetailsNode ) | ( TicketDeleteIndividualDetailsNode ) | ( TicketHouseholdDataUpdateDetailsNode ) | ( TicketIndividualDataUpdateDetailsNode ) | ( TicketNeedsAdjudicationDetailsNode ) | ( TicketNegativeFeedbackDetailsNode ) | ( TicketNoteNode ) | ( TicketPaymentVerificationDetailsNode ) | ( TicketPositiveFeedbackDetailsNode ) | ( TicketReferralDetailsNode ) | ( TicketSensitiveDetailsNode ) | ( TicketSystemFlaggingDetailsNode ) | ( UserBusinessAreaNode ) | ( UserNode ) | ( VolumeByDeliveryMechanismNode ); }; /** Mapping between all available schema types and the resolvers types */ @@ -23748,10 +22348,6 @@ export type ResolversTypes = { BusinessAreaNodeEdge: ResolverTypeWrapper; CashPlanAndPaymentPlanEdges: ResolverTypeWrapper; CashPlanAndPaymentPlanNode: ResolverTypeWrapper; - CashPlanNode: ResolverTypeWrapper; - CashPlanNodeConnection: ResolverTypeWrapper; - CashPlanNodeEdge: ResolverTypeWrapper; - CashPlanStatus: CashPlanStatus; CategoryExtrasInput: CategoryExtrasInput; ChartDatasetNode: ResolverTypeWrapper; ChartDetailedDatasetsNode: ResolverTypeWrapper; @@ -23778,8 +22374,6 @@ export type ResolversTypes = { CountAndPercentageNode: ResolverTypeWrapper; CreateAccountabilityCommunicationMessageInput: CreateAccountabilityCommunicationMessageInput; CreateCommunicationMessageMutation: ResolverTypeWrapper; - CreateDashboardReport: ResolverTypeWrapper; - CreateDashboardReportInput: CreateDashboardReportInput; CreateFeedbackInput: CreateFeedbackInput; CreateFeedbackMessageInput: CreateFeedbackMessageInput; CreateFeedbackMessageMutation: ResolverTypeWrapper; @@ -23963,7 +22557,6 @@ export type ResolversTypes = { LogEntryNodeConnection: ResolverTypeWrapper; LogEntryNodeEdge: ResolverTypeWrapper; MarkPaymentAsFailedMutation: ResolverTypeWrapper; - MarkPaymentRecordAsFailedMutation: ResolverTypeWrapper; MergeRegistrationDataImportMutation: ResolverTypeWrapper; MessageSamplingType: MessageSamplingType; Mutations: ResolverTypeWrapper<{}>; @@ -23980,14 +22573,12 @@ export type ResolversTypes = { PartnerRoleNode: ResolverTypeWrapper; PartnerType: ResolverTypeWrapper; PaymentConflictDataNode: ResolverTypeWrapper; - PaymentDeliveryTypeChoice: PaymentDeliveryTypeChoice; PaymentDetailsApproveMutation: ResolverTypeWrapper; PaymentHouseholdSnapshotNode: ResolverTypeWrapper; PaymentNode: ResolverTypeWrapper; PaymentNodeConnection: ResolverTypeWrapper; PaymentNodeEdge: ResolverTypeWrapper; PaymentPlanBackgroundActionStatus: PaymentPlanBackgroundActionStatus; - PaymentPlanCurrency: PaymentPlanCurrency; PaymentPlanNode: ResolverTypeWrapper; PaymentPlanNodeConnection: ResolverTypeWrapper; PaymentPlanNodeEdge: ResolverTypeWrapper; @@ -23996,12 +22587,6 @@ export type ResolversTypes = { PaymentPlanSupportingDocumentNodeConnection: ResolverTypeWrapper; PaymentPlanSupportingDocumentNodeEdge: ResolverTypeWrapper; PaymentRecordAndPaymentNode: ResolverTypeWrapper; - PaymentRecordDeliveryTypeChoice: PaymentRecordDeliveryTypeChoice; - PaymentRecordEntitlementCardStatus: PaymentRecordEntitlementCardStatus; - PaymentRecordNode: ResolverTypeWrapper; - PaymentRecordNodeConnection: ResolverTypeWrapper; - PaymentRecordNodeEdge: ResolverTypeWrapper; - PaymentRecordStatus: PaymentRecordStatus; PaymentRecordsAndPaymentsEdges: ResolverTypeWrapper; PaymentStatus: PaymentStatus; PaymentVerificationLogEntryNode: ResolverTypeWrapper; @@ -24076,7 +22661,6 @@ export type ResolversTypes = { RestartCreateReport: ResolverTypeWrapper; RestartCreateReportInput: RestartCreateReportInput; RevertMarkPaymentAsFailedMutation: ResolverTypeWrapper; - RevertMarkPaymentRecordAsFailedMutation: ResolverTypeWrapper; RoleChoiceObject: ResolverTypeWrapper; RoleNode: ResolverTypeWrapper; RoleSubsystem: RoleSubsystem; @@ -24109,9 +22693,6 @@ export type ResolversTypes = { SaveKoboProjectImportDataAsync: ResolverTypeWrapper; SectionTotalNode: ResolverTypeWrapper; SensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras; - ServiceProviderNode: ResolverTypeWrapper; - ServiceProviderNodeConnection: ResolverTypeWrapper; - ServiceProviderNodeEdge: ResolverTypeWrapper; SetSteficonRuleOnPaymentPlanPaymentListMutation: ResolverTypeWrapper; SetSteficonRuleOnTargetPopulationMutationInput: SetSteficonRuleOnTargetPopulationMutationInput; SetSteficonRuleOnTargetPopulationMutationPayload: ResolverTypeWrapper; @@ -24280,9 +22861,6 @@ export type ResolversParentTypes = { BusinessAreaNodeEdge: BusinessAreaNodeEdge; CashPlanAndPaymentPlanEdges: CashPlanAndPaymentPlanEdges; CashPlanAndPaymentPlanNode: CashPlanAndPaymentPlanNode; - CashPlanNode: CashPlanNode; - CashPlanNodeConnection: CashPlanNodeConnection; - CashPlanNodeEdge: CashPlanNodeEdge; CategoryExtrasInput: CategoryExtrasInput; ChartDatasetNode: ChartDatasetNode; ChartDetailedDatasetsNode: ChartDetailedDatasetsNode; @@ -24309,8 +22887,6 @@ export type ResolversParentTypes = { CountAndPercentageNode: CountAndPercentageNode; CreateAccountabilityCommunicationMessageInput: CreateAccountabilityCommunicationMessageInput; CreateCommunicationMessageMutation: CreateCommunicationMessageMutation; - CreateDashboardReport: CreateDashboardReport; - CreateDashboardReportInput: CreateDashboardReportInput; CreateFeedbackInput: CreateFeedbackInput; CreateFeedbackMessageInput: CreateFeedbackMessageInput; CreateFeedbackMessageMutation: CreateFeedbackMessageMutation; @@ -24468,7 +23044,6 @@ export type ResolversParentTypes = { LogEntryNodeConnection: LogEntryNodeConnection; LogEntryNodeEdge: LogEntryNodeEdge; MarkPaymentAsFailedMutation: MarkPaymentAsFailedMutation; - MarkPaymentRecordAsFailedMutation: MarkPaymentRecordAsFailedMutation; MergeRegistrationDataImportMutation: MergeRegistrationDataImportMutation; Mutations: {}; NeedsAdjudicationApproveMutation: NeedsAdjudicationApproveMutation; @@ -24496,9 +23071,6 @@ export type ResolversParentTypes = { PaymentPlanSupportingDocumentNodeConnection: PaymentPlanSupportingDocumentNodeConnection; PaymentPlanSupportingDocumentNodeEdge: PaymentPlanSupportingDocumentNodeEdge; PaymentRecordAndPaymentNode: PaymentRecordAndPaymentNode; - PaymentRecordNode: PaymentRecordNode; - PaymentRecordNodeConnection: PaymentRecordNodeConnection; - PaymentRecordNodeEdge: PaymentRecordNodeEdge; PaymentRecordsAndPaymentsEdges: PaymentRecordsAndPaymentsEdges; PaymentVerificationLogEntryNode: PaymentVerificationLogEntryNode; PaymentVerificationLogEntryNodeConnection: PaymentVerificationLogEntryNodeConnection; @@ -24555,7 +23127,6 @@ export type ResolversParentTypes = { RestartCreateReport: RestartCreateReport; RestartCreateReportInput: RestartCreateReportInput; RevertMarkPaymentAsFailedMutation: RevertMarkPaymentAsFailedMutation; - RevertMarkPaymentRecordAsFailedMutation: RevertMarkPaymentRecordAsFailedMutation; RoleChoiceObject: RoleChoiceObject; RoleNode: RoleNode; RuleCommitNode: RuleCommitNode; @@ -24582,9 +23153,6 @@ export type ResolversParentTypes = { SaveKoboProjectImportDataAsync: SaveKoboProjectImportDataAsync; SectionTotalNode: SectionTotalNode; SensitiveGrievanceTicketExtras: SensitiveGrievanceTicketExtras; - ServiceProviderNode: ServiceProviderNode; - ServiceProviderNodeConnection: ServiceProviderNodeConnection; - ServiceProviderNodeEdge: ServiceProviderNodeEdge; SetSteficonRuleOnPaymentPlanPaymentListMutation: SetSteficonRuleOnPaymentPlanPaymentListMutation; SetSteficonRuleOnTargetPopulationMutationInput: SetSteficonRuleOnTargetPopulationMutationInput; SetSteficonRuleOnTargetPopulationMutationPayload: SetSteficonRuleOnTargetPopulationMutationPayload; @@ -24914,7 +23482,6 @@ export type BusinessAreaNodeResolvers; biometricDeduplicationThreshold?: Resolver; businessAreaPartnerThrough?: Resolver, ParentType, ContextType>; - cashplanSet?: Resolver>; children?: Resolver>; code?: Resolver; createdAt?: Resolver; @@ -24949,7 +23516,6 @@ export type BusinessAreaNodeResolvers, ParentType, ContextType>; paymentSet?: Resolver>; paymentplanSet?: Resolver>; - paymentrecordSet?: Resolver>; postponeDeduplication?: Resolver; programSet?: Resolver>; rapidProHost?: Resolver, ParentType, ContextType>; @@ -24962,7 +23528,6 @@ export type BusinessAreaNodeResolvers>; ruleSet?: Resolver>; screenBeneficiary?: Resolver; - serviceproviderSet?: Resolver>; slug?: Resolver; surveySet?: Resolver>; targetpopulationSet?: Resolver>; @@ -25015,71 +23580,6 @@ export type CashPlanAndPaymentPlanNodeResolvers; }; -export type CashPlanNodeResolvers = { - assistanceMeasurement?: Resolver; - assistanceThrough?: Resolver; - availablePaymentRecordsCount?: Resolver, ParentType, ContextType>; - bankReconciliationError?: Resolver, ParentType, ContextType>; - bankReconciliationSuccess?: Resolver, ParentType, ContextType>; - businessArea?: Resolver; - caHashId?: Resolver, ParentType, ContextType>; - caId?: Resolver, ParentType, ContextType>; - canCreatePaymentVerificationPlan?: Resolver, ParentType, ContextType>; - comments?: Resolver, ParentType, ContextType>; - coverageDuration?: Resolver; - coverageUnit?: Resolver; - createdAt?: Resolver; - currency?: Resolver, ParentType, ContextType>; - deliveryType?: Resolver, ParentType, ContextType>; - dispersionDate?: Resolver; - distributionLevel?: Resolver; - downPayment?: Resolver, ParentType, ContextType>; - endDate?: Resolver, ParentType, ContextType>; - exchangeRate?: Resolver, ParentType, ContextType>; - fundsCommitment?: Resolver, ParentType, ContextType>; - id?: Resolver; - name?: Resolver; - paymentItems?: Resolver>; - paymentVerificationSummary?: Resolver, ParentType, ContextType>; - program?: Resolver; - serviceProvider?: Resolver, ParentType, ContextType>; - startDate?: Resolver, ParentType, ContextType>; - status?: Resolver; - statusDate?: Resolver; - totalDeliveredQuantity?: Resolver, ParentType, ContextType>; - totalDeliveredQuantityUsd?: Resolver, ParentType, ContextType>; - totalEntitledQuantity?: Resolver, ParentType, ContextType>; - totalEntitledQuantityRevised?: Resolver, ParentType, ContextType>; - totalEntitledQuantityRevisedUsd?: Resolver, ParentType, ContextType>; - totalEntitledQuantityUsd?: Resolver, ParentType, ContextType>; - totalNumberOfHouseholds?: Resolver, ParentType, ContextType>; - totalPersonsCovered?: Resolver; - totalPersonsCoveredRevised?: Resolver; - totalUndeliveredQuantity?: Resolver, ParentType, ContextType>; - totalUndeliveredQuantityUsd?: Resolver, ParentType, ContextType>; - unicefId?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - validationAlertsCount?: Resolver; - verificationPlans?: Resolver, ParentType, ContextType, Partial>; - version?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CashPlanNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type CashPlanNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type ChartDatasetNodeResolvers = { datasets?: Resolver>>, ParentType, ContextType>; labels?: Resolver>>, ParentType, ContextType>; @@ -25241,11 +23741,6 @@ export type CreateCommunicationMessageMutationResolvers; }; -export type CreateDashboardReportResolvers = { - success?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type CreateFeedbackMessageMutationResolvers = { feedbackMessage?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -25461,7 +23956,6 @@ export type DeliveryMechanismNodeResolvers, ParentType, ContextType>; paymentGatewayId?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; requiredFields?: Resolver, ParentType, ContextType>; transferType?: Resolver; uniqueFields?: Resolver, ParentType, ContextType>; @@ -25727,11 +24221,11 @@ export type FinancialServiceProviderNodeResolvers, ParentType, ContextType>; dataTransferConfiguration?: Resolver, ParentType, ContextType>; deliveryMechanisms?: Resolver>; - deliveryMechanismsChoices?: Resolver>, ParentType, ContextType>; deliveryMechanismsPerPaymentPlan?: Resolver>; distributionLimit?: Resolver, ParentType, ContextType>; fullName?: Resolver, ParentType, ContextType>; id?: Resolver; + internalData?: Resolver; isPaymentGateway?: Resolver, ParentType, ContextType>; name?: Resolver; paymentGatewayId?: Resolver, ParentType, ContextType>; @@ -26040,6 +24534,7 @@ export type HouseholdNodeResolvers, ParentType, ContextType>; individuals?: Resolver, ParentType, ContextType, Partial>; individualsAndRoles?: Resolver, ParentType, ContextType>; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRecalculatedGroupAges?: Resolver; @@ -26069,7 +24564,6 @@ export type HouseholdNodeResolvers; originUnicefId?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; positiveFeedbackTicketDetails?: Resolver>; pregnantCount?: Resolver, ParentType, ContextType>; program?: Resolver, ParentType, ContextType>; @@ -26099,7 +24593,6 @@ export type HouseholdNodeResolvers; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; village?: Resolver; withdrawn?: Resolver; @@ -26272,6 +24765,7 @@ export type IndividualNodeResolvers, ParentType, ContextType>; individualDataUpdateTicketDetails?: Resolver>; individualId?: Resolver; + internalData?: Resolver; isMigrationHandled?: Resolver; isOriginal?: Resolver; isRemoved?: Resolver; @@ -26288,7 +24782,6 @@ export type IndividualNodeResolvers>>, ParentType, ContextType>; paymentDeliveryPhoneNo?: Resolver, ParentType, ContextType>; paymentSet?: Resolver>; - paymentrecordSet?: Resolver>; phoneNo?: Resolver; phoneNoAlternative?: Resolver; phoneNoAlternativeValid?: Resolver, ParentType, ContextType>; @@ -26324,7 +24817,6 @@ export type IndividualNodeResolvers>; unicefId?: Resolver, ParentType, ContextType>; updatedAt?: Resolver; - userFields?: Resolver; version?: Resolver; walletAddress?: Resolver; walletName?: Resolver; @@ -26502,11 +24994,6 @@ export type MarkPaymentAsFailedMutationResolvers; }; -export type MarkPaymentRecordAsFailedMutationResolvers = { - paymentRecord?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type MergeRegistrationDataImportMutationResolvers = { registrationDataImport?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -26533,7 +25020,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; copyTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; createAccountabilityCommunicationMessage?: Resolver, ParentType, ContextType, RequireFields>; - createDashboardReport?: Resolver, ParentType, ContextType, RequireFields>; createFeedback?: Resolver, ParentType, ContextType, RequireFields>; createFeedbackMessage?: Resolver, ParentType, ContextType, RequireFields>; createFollowUpPaymentPlan?: Resolver, ParentType, ContextType, RequireFields>; @@ -26568,7 +25054,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; lockTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; markPaymentAsFailed?: Resolver, ParentType, ContextType, RequireFields>; - markPaymentRecordAsFailed?: Resolver, ParentType, ContextType, RequireFields>; mergeRegistrationDataImport?: Resolver, ParentType, ContextType, RequireFields>; reassignRole?: Resolver, ParentType, ContextType, RequireFields>; refuseRegistrationDataImport?: Resolver, ParentType, ContextType, RequireFields>; @@ -26578,7 +25063,6 @@ export type MutationsResolvers, ParentType, ContextType, RequireFields>; restartCreateReport?: Resolver, ParentType, ContextType, RequireFields>; revertMarkPaymentAsFailed?: Resolver, ParentType, ContextType, RequireFields>; - revertMarkPaymentRecordAsFailed?: Resolver, ParentType, ContextType, RequireFields>; saveKoboImportDataAsync?: Resolver, ParentType, ContextType, RequireFields>; setSteficonRuleOnPaymentPlanPaymentList?: Resolver, ParentType, ContextType, RequireFields>; setSteficonRuleOnTargetPopulation?: Resolver, ParentType, ContextType, RequireFields>; @@ -26602,7 +25086,7 @@ export type NeedsAdjudicationApproveMutationResolvers = { - __resolveType: TypeResolveFn<'ApprovalProcessNode' | 'AreaNode' | 'AreaTypeNode' | 'BankAccountInfoNode' | 'BusinessAreaNode' | 'CashPlanNode' | 'CommunicationMessageNode' | 'CommunicationMessageRecipientMapNode' | 'DataCollectingTypeNode' | 'DeliveryMechanismDataNode' | 'DeliveryMechanismNode' | 'DeliveryMechanismPerPaymentPlanNode' | 'DocumentNode' | 'FeedbackMessageNode' | 'FeedbackNode' | 'FinancialServiceProviderNode' | 'FinancialServiceProviderXlsxTemplateNode' | 'GrievanceDocumentNode' | 'GrievanceTicketNode' | 'HouseholdNode' | 'ImportDataNode' | 'IndividualIdentityNode' | 'IndividualNode' | 'KoboImportDataNode' | 'LogEntryNode' | 'PaymentHouseholdSnapshotNode' | 'PaymentNode' | 'PaymentPlanNode' | 'PaymentPlanSupportingDocumentNode' | 'PaymentRecordNode' | 'PaymentVerificationLogEntryNode' | 'PaymentVerificationNode' | 'PaymentVerificationPlanNode' | 'PaymentVerificationSummaryNode' | 'PeriodicFieldNode' | 'ProgramCycleNode' | 'ProgramNode' | 'RecipientNode' | 'RegistrationDataImportDatahubNode' | 'RegistrationDataImportNode' | 'ReportNode' | 'RuleCommitNode' | 'SanctionListIndividualAliasNameNode' | 'SanctionListIndividualCountriesNode' | 'SanctionListIndividualDateOfBirthNode' | 'SanctionListIndividualDocumentNode' | 'SanctionListIndividualNationalitiesNode' | 'SanctionListIndividualNode' | 'ServiceProviderNode' | 'SteficonRuleNode' | 'SurveyNode' | 'TargetPopulationNode' | 'TicketAddIndividualDetailsNode' | 'TicketComplaintDetailsNode' | 'TicketDeleteHouseholdDetailsNode' | 'TicketDeleteIndividualDetailsNode' | 'TicketHouseholdDataUpdateDetailsNode' | 'TicketIndividualDataUpdateDetailsNode' | 'TicketNeedsAdjudicationDetailsNode' | 'TicketNegativeFeedbackDetailsNode' | 'TicketNoteNode' | 'TicketPaymentVerificationDetailsNode' | 'TicketPositiveFeedbackDetailsNode' | 'TicketReferralDetailsNode' | 'TicketSensitiveDetailsNode' | 'TicketSystemFlaggingDetailsNode' | 'UserBusinessAreaNode' | 'UserNode' | 'VolumeByDeliveryMechanismNode', ParentType, ContextType>; + __resolveType: TypeResolveFn<'ApprovalProcessNode' | 'AreaNode' | 'AreaTypeNode' | 'BankAccountInfoNode' | 'BusinessAreaNode' | 'CommunicationMessageNode' | 'CommunicationMessageRecipientMapNode' | 'DataCollectingTypeNode' | 'DeliveryMechanismDataNode' | 'DeliveryMechanismNode' | 'DeliveryMechanismPerPaymentPlanNode' | 'DocumentNode' | 'FeedbackMessageNode' | 'FeedbackNode' | 'FinancialServiceProviderNode' | 'FinancialServiceProviderXlsxTemplateNode' | 'GrievanceDocumentNode' | 'GrievanceTicketNode' | 'HouseholdNode' | 'ImportDataNode' | 'IndividualIdentityNode' | 'IndividualNode' | 'KoboImportDataNode' | 'LogEntryNode' | 'PaymentHouseholdSnapshotNode' | 'PaymentNode' | 'PaymentPlanNode' | 'PaymentPlanSupportingDocumentNode' | 'PaymentVerificationLogEntryNode' | 'PaymentVerificationNode' | 'PaymentVerificationPlanNode' | 'PaymentVerificationSummaryNode' | 'PeriodicFieldNode' | 'ProgramCycleNode' | 'ProgramNode' | 'RecipientNode' | 'RegistrationDataImportDatahubNode' | 'RegistrationDataImportNode' | 'ReportNode' | 'RuleCommitNode' | 'SanctionListIndividualAliasNameNode' | 'SanctionListIndividualCountriesNode' | 'SanctionListIndividualDateOfBirthNode' | 'SanctionListIndividualDocumentNode' | 'SanctionListIndividualNationalitiesNode' | 'SanctionListIndividualNode' | 'SteficonRuleNode' | 'SurveyNode' | 'TargetPopulationNode' | 'TicketAddIndividualDetailsNode' | 'TicketComplaintDetailsNode' | 'TicketDeleteHouseholdDetailsNode' | 'TicketDeleteIndividualDetailsNode' | 'TicketHouseholdDataUpdateDetailsNode' | 'TicketIndividualDataUpdateDetailsNode' | 'TicketNeedsAdjudicationDetailsNode' | 'TicketNegativeFeedbackDetailsNode' | 'TicketNoteNode' | 'TicketPaymentVerificationDetailsNode' | 'TicketPositiveFeedbackDetailsNode' | 'TicketReferralDetailsNode' | 'TicketSensitiveDetailsNode' | 'TicketSystemFlaggingDetailsNode' | 'UserBusinessAreaNode' | 'UserNode' | 'VolumeByDeliveryMechanismNode', ParentType, ContextType>; id?: Resolver; }; @@ -26735,7 +25219,6 @@ export type PaymentNodeResolvers, ParentType, ContextType>; deliveryDate?: Resolver, ParentType, ContextType>; deliveryType?: Resolver, ParentType, ContextType>; - deliveryTypeChoice?: Resolver, ParentType, ContextType>; distributionModality?: Resolver, ParentType, ContextType>; entitlementDate?: Resolver, ParentType, ContextType>; entitlementQuantity?: Resolver, ParentType, ContextType>; @@ -26749,6 +25232,8 @@ export type PaymentNodeResolvers; householdSnapshot?: Resolver, ParentType, ContextType>; id?: Resolver; + internalData?: Resolver; + isCashAssist?: Resolver; isFollowUp?: Resolver; isRemoved?: Resolver; orderNumber?: Resolver, ParentType, ContextType>; @@ -26757,6 +25242,7 @@ export type PaymentNodeResolvers>>, ParentType, ContextType>; paymentPlanSoftConflicted?: Resolver, ParentType, ContextType>; paymentPlanSoftConflictedData?: Resolver>>, ParentType, ContextType>; + paymentVerification?: Resolver, ParentType, ContextType>; program?: Resolver, ParentType, ContextType>; reasonForUnsuccessfulPayment?: Resolver, ParentType, ContextType>; serviceProvider?: Resolver, ParentType, ContextType>; @@ -26770,6 +25256,8 @@ export type PaymentNodeResolvers; statusDate?: Resolver; targetPopulation?: Resolver, ParentType, ContextType>; + ticketComplaintDetails?: Resolver, ParentType, ContextType>; + ticketSensitiveDetails?: Resolver, ParentType, ContextType>; tokenNumber?: Resolver, ParentType, ContextType>; totalPersonsCovered?: Resolver, ParentType, ContextType>; transactionReferenceId?: Resolver, ParentType, ContextType>; @@ -26808,7 +25296,7 @@ export type PaymentPlanNodeResolvers, ParentType, ContextType>; createdAt?: Resolver; createdBy?: Resolver; - currency?: Resolver; + currency?: Resolver, ParentType, ContextType>; currencyName?: Resolver, ParentType, ContextType>; deliveryMechanisms?: Resolver>>, ParentType, ContextType>; dispersionEndDate?: Resolver, ParentType, ContextType>; @@ -26828,16 +25316,19 @@ export type PaymentPlanNodeResolvers; importedFileDate?: Resolver, ParentType, ContextType>; importedFileName?: Resolver, ParentType, ContextType>; + internalData?: Resolver; + isCashAssist?: Resolver; isFollowUp?: Resolver; isRemoved?: Resolver; maleAdultsCount?: Resolver; maleChildrenCount?: Resolver; name?: Resolver, ParentType, ContextType>; paymentItems?: Resolver>; + paymentVerificationPlans?: Resolver>; paymentVerificationSummary?: Resolver, ParentType, ContextType>; paymentsConflictsCount?: Resolver, ParentType, ContextType>; - program?: Resolver; - programCycle?: Resolver, ParentType, ContextType>; + program?: Resolver, ParentType, ContextType>; + programCycle?: Resolver; reconciliationSummary?: Resolver, ParentType, ContextType>; sourcePaymentPlan?: Resolver, ParentType, ContextType>; splitChoices?: Resolver>>, ParentType, ContextType>; @@ -26920,60 +25411,6 @@ export type PaymentRecordAndPaymentNodeResolvers; }; -export type PaymentRecordNodeResolvers = { - adminUrl?: Resolver, ParentType, ContextType>; - businessArea?: Resolver; - caHashId?: Resolver, ParentType, ContextType>; - caId?: Resolver, ParentType, ContextType>; - createdAt?: Resolver; - currency?: Resolver; - deliveredQuantity?: Resolver, ParentType, ContextType>; - deliveredQuantityUsd?: Resolver, ParentType, ContextType>; - deliveryDate?: Resolver, ParentType, ContextType>; - deliveryType?: Resolver, ParentType, ContextType>; - deliveryTypeChoice?: Resolver, ParentType, ContextType>; - distributionModality?: Resolver; - entitlementCardIssueDate?: Resolver, ParentType, ContextType>; - entitlementCardNumber?: Resolver, ParentType, ContextType>; - entitlementCardStatus?: Resolver, ParentType, ContextType>; - entitlementQuantity?: Resolver, ParentType, ContextType>; - entitlementQuantityUsd?: Resolver, ParentType, ContextType>; - fullName?: Resolver; - headOfHousehold?: Resolver, ParentType, ContextType>; - household?: Resolver; - id?: Resolver; - parent?: Resolver, ParentType, ContextType>; - registrationCaId?: Resolver, ParentType, ContextType>; - serviceProvider?: Resolver; - status?: Resolver; - statusDate?: Resolver; - targetPopulation?: Resolver; - targetPopulationCashAssistId?: Resolver; - totalPersonsCovered?: Resolver; - transactionReferenceId?: Resolver, ParentType, ContextType>; - transactionStatusBlockchainLink?: Resolver, ParentType, ContextType>; - unicefId?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - verification?: Resolver, ParentType, ContextType>; - version?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type PaymentRecordNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type PaymentRecordNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type PaymentRecordsAndPaymentsEdgesResolvers = { cursor?: Resolver, ParentType, ContextType>; node?: Resolver, ParentType, ContextType>; @@ -27016,8 +25453,8 @@ export type PaymentVerificationNodeResolvers; isManuallyEditable?: Resolver, ParentType, ContextType>; payment?: Resolver, ParentType, ContextType>; - paymentContentType?: Resolver; - paymentObjectId?: Resolver; + paymentContentType?: Resolver, ParentType, ContextType>; + paymentObjectId?: Resolver, ParentType, ContextType>; paymentVerificationPlan?: Resolver; receivedAmount?: Resolver, ParentType, ContextType>; sentToRapidPro?: Resolver; @@ -27058,8 +25495,8 @@ export type PaymentVerificationPlanNodeResolvers, ParentType, ContextType>; notReceivedCount?: Resolver, ParentType, ContextType>; paymentPlan?: Resolver, ParentType, ContextType>; - paymentPlanContentType?: Resolver; - paymentPlanObjectId?: Resolver; + paymentPlanContentType?: Resolver, ParentType, ContextType>; + paymentPlanObjectId?: Resolver, ParentType, ContextType>; paymentRecordVerifications?: Resolver>; rapidProFlowId?: Resolver; rapidProFlowStartUuids?: Resolver, ParentType, ContextType>; @@ -27099,8 +25536,9 @@ export type PaymentVerificationSummaryNodeResolvers, ParentType, ContextType>; createdAt?: Resolver; id?: Resolver; - paymentPlanContentType?: Resolver; - paymentPlanObjectId?: Resolver; + paymentPlan?: Resolver, ParentType, ContextType>; + paymentPlanContentType?: Resolver, ParentType, ContextType>; + paymentPlanObjectId?: Resolver, ParentType, ContextType>; status?: Resolver; updatedAt?: Resolver; __isTypeOf?: IsTypeOfResolverFn; @@ -27181,7 +25619,6 @@ export type ProgramNodeResolvers, ParentType, ContextType>; canFinish?: Resolver, ParentType, ContextType>; cashPlus?: Resolver; - cashplanSet?: Resolver>; createdAt?: Resolver; cycles?: Resolver, ParentType, ContextType, Partial>; dataCollectingType?: Resolver, ParentType, ContextType>; @@ -27206,7 +25643,6 @@ export type ProgramNodeResolvers; partners?: Resolver>>, ParentType, ContextType>; paymentSet?: Resolver>; - paymentplanSet?: Resolver>; pduFields?: Resolver>>, ParentType, ContextType>; populationGoal?: Resolver; programmeCode?: Resolver, ParentType, ContextType>; @@ -27257,7 +25693,6 @@ export type QueryResolvers, ParentType, ContextType, Partial>; allAreasTree?: Resolver>>, ParentType, ContextType, RequireFields>; allBusinessAreas?: Resolver, ParentType, ContextType, Partial>; - allCashPlans?: Resolver, ParentType, ContextType, Partial>; allCashPlansAndPaymentPlans?: Resolver, ParentType, ContextType, RequireFields>; allCollectorFieldsAttributes?: Resolver>>, ParentType, ContextType, Partial>; allDeliveryMechanisms?: Resolver>>, ParentType, ContextType>; @@ -27279,7 +25714,6 @@ export type QueryResolvers, ParentType, ContextType, Partial>; allMergedIndividuals?: Resolver, ParentType, ContextType, Partial>; allPaymentPlans?: Resolver, ParentType, ContextType, RequireFields>; - allPaymentRecords?: Resolver, ParentType, ContextType, Partial>; allPaymentRecordsAndPayments?: Resolver, ParentType, ContextType, RequireFields>; allPaymentVerificationLogEntries?: Resolver, ParentType, ContextType, RequireFields>; allPaymentVerificationPlan?: Resolver, ParentType, ContextType, Partial>; @@ -27300,7 +25734,6 @@ export type QueryResolvers, ParentType, ContextType, RequireFields>; canRunDeduplication?: Resolver, ParentType, ContextType>; cashAssistUrlPrefix?: Resolver, ParentType, ContextType>; - cashPlan?: Resolver, ParentType, ContextType, RequireFields>; cashPlanStatusChoices?: Resolver>>, ParentType, ContextType>; cashPlanVerificationSamplingChoices?: Resolver>>, ParentType, ContextType>; cashPlanVerificationStatusChoices?: Resolver>>, ParentType, ContextType>; @@ -27359,7 +25792,6 @@ export type QueryResolvers, ParentType, ContextType, RequireFields>; paymentPlanBackgroundActionStatusChoices?: Resolver>>, ParentType, ContextType>; paymentPlanStatusChoices?: Resolver>>, ParentType, ContextType>; - paymentRecord?: Resolver, ParentType, ContextType, RequireFields>; paymentRecordDeliveryTypeChoices?: Resolver>>, ParentType, ContextType>; paymentRecordEntitlementCardStatusChoices?: Resolver>>, ParentType, ContextType>; paymentRecordStatusChoices?: Resolver>>, ParentType, ContextType>; @@ -27640,11 +26072,6 @@ export type RevertMarkPaymentAsFailedMutationResolvers; }; -export type RevertMarkPaymentRecordAsFailedMutationResolvers = { - paymentRecord?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type RoleChoiceObjectResolvers = { name?: Resolver, ParentType, ContextType>; subsystem?: Resolver, ParentType, ContextType>; @@ -27865,35 +26292,6 @@ export type SectionTotalNodeResolvers; }; -export type ServiceProviderNodeResolvers = { - businessArea?: Resolver; - caId?: Resolver; - cashPlans?: Resolver>; - country?: Resolver; - createdAt?: Resolver; - fullName?: Resolver, ParentType, ContextType>; - id?: Resolver; - paymentrecordSet?: Resolver>; - shortName?: Resolver, ParentType, ContextType>; - updatedAt?: Resolver; - visionId?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type ServiceProviderNodeConnectionResolvers = { - edgeCount?: Resolver, ParentType, ContextType>; - edges?: Resolver>, ParentType, ContextType>; - pageInfo?: Resolver; - totalCount?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - -export type ServiceProviderNodeEdgeResolvers = { - cursor?: Resolver; - node?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type SetSteficonRuleOnPaymentPlanPaymentListMutationResolvers = { paymentPlan?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; @@ -28030,7 +26428,6 @@ export type TargetPopulationNodeResolvers>; name?: Resolver; paymentPlans?: Resolver>; - paymentRecords?: Resolver>; program?: Resolver; programCycle?: Resolver; selections?: Resolver, ParentType, ContextType>; @@ -28190,6 +26587,7 @@ export type TicketComplaintDetailsNodeResolvers, ParentType, ContextType>; id?: Resolver; individual?: Resolver, ParentType, ContextType>; + payment?: Resolver, ParentType, ContextType>; paymentContentType?: Resolver, ParentType, ContextType>; paymentObjectId?: Resolver, ParentType, ContextType>; paymentRecord?: Resolver, ParentType, ContextType>; @@ -28477,6 +26875,7 @@ export type TicketSensitiveDetailsNodeResolvers, ParentType, ContextType>; id?: Resolver; individual?: Resolver, ParentType, ContextType>; + payment?: Resolver, ParentType, ContextType>; paymentContentType?: Resolver, ParentType, ContextType>; paymentObjectId?: Resolver, ParentType, ContextType>; paymentRecord?: Resolver, ParentType, ContextType>; @@ -28589,7 +26988,6 @@ export type UserBusinessAreaNodeResolvers; biometricDeduplicationThreshold?: Resolver; businessAreaPartnerThrough?: Resolver, ParentType, ContextType>; - cashplanSet?: Resolver>; children?: Resolver>; code?: Resolver; createdAt?: Resolver; @@ -28624,7 +27022,6 @@ export type UserBusinessAreaNodeResolvers, ParentType, ContextType>; paymentSet?: Resolver>; paymentplanSet?: Resolver>; - paymentrecordSet?: Resolver>; permissions?: Resolver>>, ParentType, ContextType>; postponeDeduplication?: Resolver; programSet?: Resolver>; @@ -28638,7 +27035,6 @@ export type UserBusinessAreaNodeResolvers>; ruleSet?: Resolver>; screenBeneficiary?: Resolver; - serviceproviderSet?: Resolver>; slug?: Resolver; surveySet?: Resolver>; targetpopulationSet?: Resolver>; @@ -28811,9 +27207,6 @@ export type Resolvers = { BusinessAreaNodeEdge?: BusinessAreaNodeEdgeResolvers; CashPlanAndPaymentPlanEdges?: CashPlanAndPaymentPlanEdgesResolvers; CashPlanAndPaymentPlanNode?: CashPlanAndPaymentPlanNodeResolvers; - CashPlanNode?: CashPlanNodeResolvers; - CashPlanNodeConnection?: CashPlanNodeConnectionResolvers; - CashPlanNodeEdge?: CashPlanNodeEdgeResolvers; ChartDatasetNode?: ChartDatasetNodeResolvers; ChartDetailedDatasetsNode?: ChartDetailedDatasetsNodeResolvers; ChartGrievanceTicketsNode?: ChartGrievanceTicketsNodeResolvers; @@ -28834,7 +27227,6 @@ export type Resolvers = { CoreFieldChoiceObject?: CoreFieldChoiceObjectResolvers; CountAndPercentageNode?: CountAndPercentageNodeResolvers; CreateCommunicationMessageMutation?: CreateCommunicationMessageMutationResolvers; - CreateDashboardReport?: CreateDashboardReportResolvers; CreateFeedbackMessageMutation?: CreateFeedbackMessageMutationResolvers; CreateFeedbackMutation?: CreateFeedbackMutationResolvers; CreateFollowUpPaymentPlanMutation?: CreateFollowUpPaymentPlanMutationResolvers; @@ -28954,7 +27346,6 @@ export type Resolvers = { LogEntryNodeConnection?: LogEntryNodeConnectionResolvers; LogEntryNodeEdge?: LogEntryNodeEdgeResolvers; MarkPaymentAsFailedMutation?: MarkPaymentAsFailedMutationResolvers; - MarkPaymentRecordAsFailedMutation?: MarkPaymentRecordAsFailedMutationResolvers; MergeRegistrationDataImportMutation?: MergeRegistrationDataImportMutationResolvers; Mutations?: MutationsResolvers; NeedsAdjudicationApproveMutation?: NeedsAdjudicationApproveMutationResolvers; @@ -28980,9 +27371,6 @@ export type Resolvers = { PaymentPlanSupportingDocumentNodeConnection?: PaymentPlanSupportingDocumentNodeConnectionResolvers; PaymentPlanSupportingDocumentNodeEdge?: PaymentPlanSupportingDocumentNodeEdgeResolvers; PaymentRecordAndPaymentNode?: PaymentRecordAndPaymentNodeResolvers; - PaymentRecordNode?: PaymentRecordNodeResolvers; - PaymentRecordNodeConnection?: PaymentRecordNodeConnectionResolvers; - PaymentRecordNodeEdge?: PaymentRecordNodeEdgeResolvers; PaymentRecordsAndPaymentsEdges?: PaymentRecordsAndPaymentsEdgesResolvers; PaymentVerificationLogEntryNode?: PaymentVerificationLogEntryNodeResolvers; PaymentVerificationLogEntryNodeConnection?: PaymentVerificationLogEntryNodeConnectionResolvers; @@ -29029,7 +27417,6 @@ export type Resolvers = { ReportNodeEdge?: ReportNodeEdgeResolvers; RestartCreateReport?: RestartCreateReportResolvers; RevertMarkPaymentAsFailedMutation?: RevertMarkPaymentAsFailedMutationResolvers; - RevertMarkPaymentRecordAsFailedMutation?: RevertMarkPaymentRecordAsFailedMutationResolvers; RoleChoiceObject?: RoleChoiceObjectResolvers; RoleNode?: RoleNodeResolvers; RuleCommitNode?: RuleCommitNodeResolvers; @@ -29055,9 +27442,6 @@ export type Resolvers = { SanctionListIndividualNodeEdge?: SanctionListIndividualNodeEdgeResolvers; SaveKoboProjectImportDataAsync?: SaveKoboProjectImportDataAsyncResolvers; SectionTotalNode?: SectionTotalNodeResolvers; - ServiceProviderNode?: ServiceProviderNodeResolvers; - ServiceProviderNodeConnection?: ServiceProviderNodeConnectionResolvers; - ServiceProviderNodeEdge?: ServiceProviderNodeEdgeResolvers; SetSteficonRuleOnPaymentPlanPaymentListMutation?: SetSteficonRuleOnPaymentPlanPaymentListMutationResolvers; SetSteficonRuleOnTargetPopulationMutationPayload?: SetSteficonRuleOnTargetPopulationMutationPayloadResolvers; SimpleApproveMutation?: SimpleApproveMutationResolvers; From f430ac5b9cbc053733b734b4bfbd38a22111afd0 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 14:31:02 +0100 Subject: [PATCH 16/32] ut fix --- .../unit/apps/household/test_filter_individuals_by_program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/apps/household/test_filter_individuals_by_program.py b/tests/unit/apps/household/test_filter_individuals_by_program.py index 54ade2a6f4..8748f46f07 100644 --- a/tests/unit/apps/household/test_filter_individuals_by_program.py +++ b/tests/unit/apps/household/test_filter_individuals_by_program.py @@ -172,7 +172,7 @@ def test_individual_query_all(self, _mock: Any, _: Any, permissions: List[Permis variables={"program": self.id_to_base64(self.program1.id, "ProgramNode")}, ) - def test_individual_query_rdi_id(self) -> None: + def test_individual_query_rdi_id(self, _mock: Any) -> None: self.create_user_role_with_permissions( self.user, [Permissions.POPULATION_VIEW_INDIVIDUALS_LIST], self.business_area, self.program1 ) @@ -203,7 +203,7 @@ def test_individual_query_rdi_id(self) -> None: }, ) - def test_individual_query_filter_by_duplicates_only(self) -> None: + def test_individual_query_filter_by_duplicates_only(self, _mock: Any) -> None: self.create_user_role_with_permissions( self.user, [Permissions.POPULATION_VIEW_INDIVIDUALS_LIST], self.business_area, self.program1 ) From 597a3bb458337eb16b3a2213c3ab099900847467 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 19:57:44 +0100 Subject: [PATCH 17/32] ut --- src/hct_mis_api/apps/household/models.py | 2 +- src/hct_mis_api/apps/payment/models.py | 3 + .../services/generate_report_service.py | 6 +- .../migrate_cash_assist_models.py | 348 +++++++------- .../test_migrate_cash_assist_models.py | 449 ++++++++++++++++++ 5 files changed, 635 insertions(+), 173 deletions(-) create mode 100644 tests/unit/one_time_scripts/test_migrate_cash_assist_models.py diff --git a/src/hct_mis_api/apps/household/models.py b/src/hct_mis_api/apps/household/models.py index 8122dda901..a24490ff08 100644 --- a/src/hct_mis_api/apps/household/models.py +++ b/src/hct_mis_api/apps/household/models.py @@ -651,7 +651,7 @@ def active_individuals(self) -> QuerySet: @cached_property def primary_collector(self) -> Optional["Individual"]: - return self.representatives.get(households_and_roles__role=ROLE_PRIMARY) + return self.representatives.filter(households_and_roles__role=ROLE_PRIMARY).first() @cached_property def alternate_collector(self) -> Optional["Individual"]: diff --git a/src/hct_mis_api/apps/payment/models.py b/src/hct_mis_api/apps/payment/models.py index e200eabd86..a7aa87b74a 100644 --- a/src/hct_mis_api/apps/payment/models.py +++ b/src/hct_mis_api/apps/payment/models.py @@ -2207,6 +2207,9 @@ def get_program(self) -> Optional["Program"]: def build_summary(payment_plan: Optional[Any]) -> None: + if not payment_plan: + return + statuses_count = payment_plan.payment_verification_plans.aggregate( active=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_ACTIVE)), pending=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_PENDING)), diff --git a/src/hct_mis_api/apps/reporting/services/generate_report_service.py b/src/hct_mis_api/apps/reporting/services/generate_report_service.py index f809f70ce6..0505ba7551 100644 --- a/src/hct_mis_api/apps/reporting/services/generate_report_service.py +++ b/src/hct_mis_api/apps/reporting/services/generate_report_service.py @@ -255,10 +255,10 @@ def format_payment_row(cls, payment: PaymentRecord) -> tuple: payment.delivered_quantity_usd or payment.delivered_quantity, cls._format_date(payment.delivery_date), payment.delivery_type, - payment.distribution_modality, + payment.parent.unicef_id, payment.entitlement_quantity, - payment.target_population.id, - payment.target_population.name, + payment.parent.target_population.id, + payment.parent.target_population.name, cash_or_voucher, payment.household.id, ) diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py index 696e931e00..956d12c4a4 100644 --- a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -23,22 +23,21 @@ from hct_mis_api.apps.payment.services.payment_household_snapshot_service import ( create_payment_plan_snapshot_data, ) +from hct_mis_api.apps.targeting.models import TargetPopulation logger = logging.getLogger(__name__) -content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) -content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) -content_type_for_payment = ContentType.objects.get_for_model(Payment) -content_type_for_payment_record = ContentType.objects.get_for_model(PaymentRecord) - - def get_status(status: str) -> str: mapping = {"Transaction Successful": "Distribution Successful"} return mapping.get(status, status) def migrate_cash_plan_to_payment_plan() -> None: + content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) + content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) + content_type_for_payment_record = ContentType.objects.get_for_model(PaymentRecord) + logger.info("**Migrating Cash Plan to Payment Plan**") delivery_type_to_obj = {obj.name: obj for obj in DeliveryMechanism.objects.all()} @@ -80,190 +79,201 @@ def migrate_cash_plan_to_payment_plan() -> None: cash_plans = CashPlan.objects.filter(is_migrated_to_payment_plan=False) logger.info(f"Total Cash Plans to migrate: {cash_plans.count()}") - batch_count = cash_plans.count() // 50 - batch_i = 0 - for batch in cash_plans.iterator(chunk_size=50): - batch_i += 1 - logger.info(f"Processing batch {batch_i}/{batch_count}") - for cp in batch: - with transaction.atomic(): - if not cp.payment_items.exists(): - continue + cp_count = cash_plans.count() + cp_i = 0 + for cp in cash_plans.iterator(chunk_size=50): + if cp_i % 50 == 0: + logger.info(f"Processing cash plan {cp_i}/{cp_count}") + cp_i += 1 + with transaction.atomic(): + if not cp.payment_items.exists(): + continue - # get target populations from payment records - target_populations = cp.payment_items.values_list("target_population", flat=True).distinct() - # for each target population create a payment plan within tp.payment_cycle - for tp in target_populations: - payment_records = cp.payment_items.filter(target_population=tp) - first_record = payment_records.first() - if first_record.delivery_type: - delivery_mechanism = delivery_type_to_obj[first_record.delivery_type.name] - else: - delivery_mechanism = dm_cash - currency = first_record.currency + # get target populations from payment records + target_populations = cp.payment_items.values_list("target_population", flat=True).distinct() + tp_counter = 0 + # for each target population create a payment plan within tp.payment_cycle + for tp_id in target_populations: + tp = TargetPopulation.objects.get(id=tp_id) + payment_records = cp.payment_items.filter(target_population=tp) + first_record = payment_records.first() + if first_record.delivery_type: + delivery_mechanism = delivery_type_to_obj[first_record.delivery_type.name] + else: + delivery_mechanism = dm_cash + currency = first_record.currency - # create payment plan - pp = PaymentPlan.objects.create( - status="FINISHED", - name=tp.name, - business_area_id=tp.business_area.id, - created_by_id=tp.created_by.id, - created_at=cp.created_at, - target_population_id=tp.id, - program_cycle_id=tp.program_cycle.id, - currency=currency, - dispersion_start_date=cp.start_date or tp.program_cycle.start_date, - dispersion_end_date=cp.dispersion_date or tp.program_cycle.end_date, - start_date=cp.start_date or tp.program_cycle.start_date, - end_date=cp.end_date or tp.program_cycle.end_date, - status_date=cp.status_date, - exchange_rate=cp.exchange_rate, - total_entitled_quantity=cp.total_entitled_quantity, - total_entitled_quantity_usd=cp.total_entitled_quantity_usd, - total_entitled_quantity_revised=cp.total_entitled_quantity_revised, - total_entitled_quantity_revised_usd=cp.total_entitled_quantity_revised_usd, - total_delivered_quantity=cp.total_delivered_quantity, - total_delivered_quantity_usd=cp.total_delivered_quantity_usd, - total_undelivered_quantity=cp.total_undelivered_quantity, - total_undelivered_quantity_usd=cp.total_undelivered_quantity_usd, - is_cash_assist=True, - internal_data={ - "name": cp.name, - "ca_hash_id": str(cp.ca_hash_id), - "distribution_level": cp.distribution_level, - "coverage_duration": cp.coverage_duration, - "coverage_unit": cp.coverage_unit, - "comments": cp.comments, - "assistance_measurement": cp.assistance_measurement, - "assistance_through": cp.assistance_through, - "vision_id": cp.vision_id, - "funds_commitment": cp.funds_commitment, - "down_payment": cp.down_payment, - "validation_alerts_count": cp.validation_alerts_count, - "total_persons_covered": cp.total_persons_covered, - "total_persons_covered_revised": cp.total_persons_covered_revised, - }, - ) - pp.unicef_id = cp.ca_id - pp.save(update_fields=["unicef_id"]) - pp.update_population_count_fields() + # create payment plan + pp = PaymentPlan.objects.create( + status="FINISHED", + name=tp.name, + business_area_id=tp.business_area.id, + created_by_id=tp.created_by.id, + target_population_id=tp.id, + program_cycle_id=tp.program_cycle.id, + currency=currency, + dispersion_start_date=cp.start_date or tp.program_cycle.start_date, + dispersion_end_date=cp.dispersion_date or tp.program_cycle.end_date, + start_date=cp.start_date or tp.program_cycle.start_date, + end_date=cp.end_date or tp.program_cycle.end_date, + status_date=cp.status_date, + exchange_rate=cp.exchange_rate, + total_entitled_quantity=cp.total_entitled_quantity, + total_entitled_quantity_usd=cp.total_entitled_quantity_usd, + total_entitled_quantity_revised=cp.total_entitled_quantity_revised, + total_entitled_quantity_revised_usd=cp.total_entitled_quantity_revised_usd, + total_delivered_quantity=cp.total_delivered_quantity, + total_delivered_quantity_usd=cp.total_delivered_quantity_usd, + total_undelivered_quantity=cp.total_undelivered_quantity, + total_undelivered_quantity_usd=cp.total_undelivered_quantity_usd, + is_cash_assist=True, + internal_data={ + "name": cp.name, + "ca_hash_id": str(cp.ca_hash_id), + "distribution_level": cp.distribution_level, + "coverage_duration": cp.coverage_duration, + "coverage_unit": cp.coverage_unit, + "comments": cp.comments, + "assistance_measurement": cp.assistance_measurement, + "assistance_through": cp.assistance_through, + "vision_id": cp.vision_id, + "funds_commitment": cp.funds_commitment, + "down_payment": cp.down_payment, + "validation_alerts_count": cp.validation_alerts_count, + "total_persons_covered": cp.total_persons_covered, + "total_persons_covered_revised": cp.total_persons_covered_revised, + }, + ) + pp.created_at = cp.created_at + pp.unicef_id = cp.ca_id + pp.save(update_fields=["unicef_id", "created_at"]) + pp.update_population_count_fields() - financial_service_provider = fsp_vision_vendor_number_to_obj.get( - first_record.service_provider.vision_id + financial_service_provider = fsp_vision_vendor_number_to_obj.get(cp.service_provider.vision_id) + if not financial_service_provider: + logger.error( + f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" + f"Cash Plan: {cp}" + f"Record: {first_record}" + f"Service Provider: {first_record.service_provider}" ) - if not financial_service_provider: - logger.error( - f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" - f"Cash Plan: {cp}" - f"Record: {first_record}" - f"Service Provider: {first_record.service_provider}" - ) - continue + continue - DeliveryMechanismPerPaymentPlan.objects.update_or_create( - payment_plan_id=pp.id, - delivery_mechanism_id=delivery_mechanism.id, - sent_date=cp.status_date, - delivery_mechanism_order=1, - created_by_id=tp.created_by.id, - created_at=tp.created_at, - financial_service_provider_id=financial_service_provider.id, - ) + dmppp = DeliveryMechanismPerPaymentPlan.objects.create( + payment_plan_id=pp.id, + delivery_mechanism_id=delivery_mechanism.id, + sent_date=cp.status_date, + delivery_mechanism_order=1, + created_by_id=tp.created_by.id, + financial_service_provider_id=financial_service_provider.id, + ) + dmppp.created_at = tp.created_at + dmppp.save(update_fields=["created_at"]) - payment_verification_summary = PaymentVerificationSummary.objects.filter( - payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk - ).first() - if payment_verification_summary: + payment_verification_summary = PaymentVerificationSummary.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_summary: + if tp_counter > 0: + # create a copy of the summary for each target population + payment_verification_summary.pk = None payment_verification_summary.payment_plan_content_type_id = content_type_for_payment_plan.id payment_verification_summary.payment_plan_object_id = pp.id payment_verification_summary.payment_plan = pp payment_verification_summary.save() + else: + payment_verification_summary.payment_plan = pp + payment_verification_summary.save() - payment_verification_plan = PaymentVerificationPlan.objects.filter( - payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk - ).first() - if payment_verification_plan: + payment_verification_plan = PaymentVerificationPlan.objects.filter( + payment_plan_content_type_id=content_type_for_cash_plan.pk, payment_plan_object_id=cp.pk + ).first() + if payment_verification_plan: + if tp_counter > 0: + # create a copy of the summary for each target population + _unicef_id = payment_verification_plan.unicef_id + payment_verification_plan.pk = None payment_verification_plan.payment_plan_content_type_id = content_type_for_payment_plan.id payment_verification_plan.payment_plan_object_id = pp.id payment_verification_plan.payment_plan = pp payment_verification_plan.save() + payment_verification_plan.unicef_id = _unicef_id + payment_verification_plan.save(update_fields=["unicef_id"]) - with transaction.atomic(): - for record in cp.payment_items.filter(target_population=tp).prefetch_related( - "service_provider" - ): - financial_service_provider = fsp_vision_vendor_number_to_obj.get( - record.service_provider.vision_id - ) - payment = Payment.objects.create( - parent_id=pp.id, - business_area_id=pp.business_area.id, - status=get_status(record.status), - status_date=record.status_date, - household_id=record.household_id, - head_of_household_id=record.head_of_household_id, - collector_id=record.head_of_household_id, - delivery_type_id=record.delivery_type_id, - currency=record.currency, - entitlement_quantity=record.entitlement_quantity, - entitlement_quantity_usd=record.entitlement_quantity_usd, - delivered_quantity=record.delivered_quantity, - delivered_quantity_usd=record.delivered_quantity_usd, - delivery_date=record.delivery_date, - transaction_reference_id=record.transaction_reference_id, - transaction_status_blockchain_link=record.transaction_status_blockchain_link, - financial_service_provider=financial_service_provider, - program_id=tp.program_cycle.program_id, - is_cash_assist=True, - internal_data={ - "ca_hash_id": str(record.ca_hash_id), - "full_name": record.full_name, - "total_persons_covered": record.total_persons_covered, - "distribution_modality": record.distribution_modality, - "target_population_cash_assist_id": record.target_population_cash_assist_id, - "target_population": str(record.target_population_id), - "entitlement_card_number": record.entitlement_card_number, - "entitlement_card_status": record.entitlement_card_status, - "entitlement_card_issue_date": str(record.entitlement_card_issue_date), - "vision_id": record.vision_id, - "registration_ca_id": record.registration_ca_id, - "service_provider": str(record.service_provider_id), - }, - ) - payment.unicef_id = record.ca_id - payment.save(update_fields=["unicef_id"]) + else: + payment_verification_plan.payment_plan = pp + payment_verification_plan.save() + + with transaction.atomic(): + for record in cp.payment_items.filter(target_population=tp).prefetch_related("service_provider"): + financial_service_provider = fsp_vision_vendor_number_to_obj.get( + record.service_provider.vision_id + ) + payment = Payment.objects.create( + parent_id=pp.id, + business_area_id=pp.business_area.id, + status=get_status(record.status), + status_date=record.status_date, + household_id=record.household_id, + head_of_household_id=record.head_of_household_id or record.household.head_of_household_id, + collector_id=record.head_of_household_id or record.household.head_of_household_id, + delivery_type_id=record.delivery_type_id, + currency=record.currency, + entitlement_quantity=record.entitlement_quantity, + entitlement_quantity_usd=record.entitlement_quantity_usd, + delivered_quantity=record.delivered_quantity, + delivered_quantity_usd=record.delivered_quantity_usd, + delivery_date=record.delivery_date, + transaction_reference_id=record.transaction_reference_id, + transaction_status_blockchain_link=record.transaction_status_blockchain_link, + financial_service_provider=financial_service_provider, + program_id=tp.program_cycle.program_id, + is_cash_assist=True, + internal_data={ + "ca_hash_id": str(record.ca_hash_id), + "full_name": record.full_name, + "total_persons_covered": record.total_persons_covered, + "distribution_modality": record.distribution_modality, + "target_population_cash_assist_id": record.target_population_cash_assist_id, + "target_population": str(record.target_population_id), + "entitlement_card_number": record.entitlement_card_number, + "entitlement_card_status": record.entitlement_card_status, + "entitlement_card_issue_date": str(record.entitlement_card_issue_date), + "vision_id": record.vision_id, + "registration_ca_id": record.registration_ca_id, + "service_provider": str(record.service_provider_id), + }, + ) + payment.unicef_id = record.ca_id + payment.save(update_fields=["unicef_id"]) - payment_record_verification = PaymentVerification.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if payment_record_verification: - payment_record_verification.payment_content_type_id = content_type_for_payment.id - payment_record_verification.payment_object_id = payment.id - payment_record_verification.payment = payment - payment_record_verification.save() + payment_record_verification = PaymentVerification.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if payment_record_verification: + payment_record_verification.payment_verification_plan = payment_verification_plan + payment_record_verification.payment = payment + payment_record_verification.save() - ticket_complaint_details = TicketComplaintDetails.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if ticket_complaint_details: - ticket_complaint_details.payment_content_type_id = content_type_for_payment.id - ticket_complaint_details.payment_object_id = payment.id - ticket_complaint_details.payment = payment - ticket_complaint_details.save() + ticket_complaint_details = TicketComplaintDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_complaint_details: + ticket_complaint_details.payment = payment + ticket_complaint_details.save() - ticket_sensitive_details = TicketSensitiveDetails.objects.filter( - payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk - ).first() - if ticket_sensitive_details: - ticket_sensitive_details.payment_content_type_id = content_type_for_payment.id - ticket_sensitive_details.payment_object_id = payment.id - ticket_sensitive_details.payment = payment - ticket_sensitive_details.save() + ticket_sensitive_details = TicketSensitiveDetails.objects.filter( + payment_content_type_id=content_type_for_payment_record.pk, payment_object_id=record.pk + ).first() + if ticket_sensitive_details: + ticket_sensitive_details.payment = payment + ticket_sensitive_details.save() - create_payment_plan_snapshot_data(pp) + create_payment_plan_snapshot_data(pp) + tp_counter += 1 - cp.is_migrated_to_payment_plan = True - cp.save(update_fields=["is_migrated_to_payment_plan"]) + cp.is_migrated_to_payment_plan = True + cp.save(update_fields=["is_migrated_to_payment_plan"]) def migrate_cash_assist_models() -> None: diff --git a/tests/unit/one_time_scripts/test_migrate_cash_assist_models.py b/tests/unit/one_time_scripts/test_migrate_cash_assist_models.py new file mode 100644 index 0000000000..4107905045 --- /dev/null +++ b/tests/unit/one_time_scripts/test_migrate_cash_assist_models.py @@ -0,0 +1,449 @@ +import datetime + +from django.contrib.contenttypes.models import ContentType +from django.test import TestCase + +import factory +from factory.django import DjangoModelFactory +from pytz import utc + +from hct_mis_api.apps.core.fixtures import create_afghanistan +from hct_mis_api.apps.core.models import BusinessArea +from hct_mis_api.apps.core.utils import CaIdIterator +from hct_mis_api.apps.grievance.fixtures import GrievanceTicketFactory +from hct_mis_api.apps.grievance.models import ( + GrievanceTicket, + TicketComplaintDetails, + TicketSensitiveDetails, +) +from hct_mis_api.apps.household.fixtures import HouseholdFactory, create_household +from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices +from hct_mis_api.apps.payment.fixtures import ( + DeliveryMechanismFactory, + PaymentVerificationFactory, + PaymentVerificationPlanFactory, + PaymentVerificationSummaryFactory, +) +from hct_mis_api.apps.payment.models import ( + CashPlan, + DeliveryMechanismPerPaymentPlan, + FinancialServiceProvider, + Payment, + PaymentPlan, + PaymentRecord, + PaymentVerification, + PaymentVerificationPlan, + PaymentVerificationSummary, + ServiceProvider, +) +from hct_mis_api.apps.program.fixtures import ProgramFactory +from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory +from hct_mis_api.one_time_scripts.migrate_cash_assist_models import ( + get_status, + migrate_cash_plan_to_payment_plan, +) + + +class CashPlanFactory(DjangoModelFactory): + class Meta: + model = CashPlan + + ca_id = factory.Sequence(lambda n: f"PP-0000-00-1122334{n}") + business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) + program = factory.SubFactory(ProgramFactory) + status_date = factory.Faker( + "date_time_this_decade", + before_now=False, + after_now=True, + tzinfo=utc, + ) + status = factory.fuzzy.FuzzyChoice( + CashPlan.STATUS_CHOICE, + getter=lambda c: c[0], + ) + name = factory.Faker( + "sentence", + nb_words=6, + variable_nb_words=True, + ext_word_list=None, + ) + distribution_level = "Registration Group" + dispersion_date = factory.Faker( + "date_time_this_decade", + before_now=False, + after_now=True, + tzinfo=utc, + ) + coverage_duration = factory.fuzzy.FuzzyInteger(1, 4) + coverage_unit = factory.Faker( + "random_element", + elements=["Day(s)", "Week(s)", "Month(s)", "Year(s)"], + ) + comments = factory.Faker( + "sentence", + nb_words=6, + variable_nb_words=True, + ext_word_list=None, + ) + delivery_type = factory.fuzzy.FuzzyChoice( + DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, + getter=lambda c: c[0], + ) + assistance_measurement = factory.Faker("currency_name") + assistance_through = factory.Faker("random_element", elements=["ING", "Bank of America", "mBank"]) + vision_id = factory.Faker("uuid4") + funds_commitment = factory.fuzzy.FuzzyInteger(1000, 99999999) + exchange_rate = factory.fuzzy.FuzzyDecimal(0.1, 9.9) + down_payment = factory.fuzzy.FuzzyInteger(1000, 99999999) + validation_alerts_count = factory.fuzzy.FuzzyInteger(1, 3) + total_persons_covered = factory.fuzzy.FuzzyInteger(1, 4) + total_persons_covered_revised = factory.fuzzy.FuzzyInteger(1, 4) + + total_entitled_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_entitled_quantity_revised = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_delivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_undelivered_quantity = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + + total_entitled_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_entitled_quantity_revised_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_delivered_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + total_undelivered_quantity_usd = factory.fuzzy.FuzzyDecimal(20000.0, 90000000.0) + + +class ServiceProviderFactory(DjangoModelFactory): + class Meta: + model = ServiceProvider + + business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) + ca_id = factory.Iterator(CaIdIterator("SRV")) + full_name = factory.Faker("company") + short_name = factory.LazyAttribute(lambda o: o.full_name[0:3]) + country = factory.Faker("country_code") + vision_id = factory.fuzzy.FuzzyInteger(1342342, 9999999932) + + +class PaymentRecordFactory(DjangoModelFactory): + class Meta: + model = PaymentRecord + + business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first()) + status = factory.fuzzy.FuzzyChoice( + PaymentRecord.STATUS_CHOICE, + getter=lambda c: c[0], + ) + full_name = factory.Faker("name") + status_date = factory.Faker( + "date_time_this_decade", + before_now=False, + after_now=True, + tzinfo=utc, + ) + ca_id = factory.Iterator(CaIdIterator("PR")) + ca_hash_id = factory.Faker("uuid4") + parent = factory.SubFactory(CashPlanFactory) + household = factory.SubFactory(HouseholdFactory) + total_persons_covered = factory.fuzzy.FuzzyInteger(1, 7) + distribution_modality = factory.Faker( + "sentence", + nb_words=6, + variable_nb_words=True, + ext_word_list=None, + ) + target_population = factory.SubFactory(TargetPopulationFactory) + entitlement_card_number = factory.Faker("ssn") + entitlement_card_status = factory.fuzzy.FuzzyChoice( + PaymentRecord.ENTITLEMENT_CARD_STATUS_CHOICE, + getter=lambda c: c[0], + ) + entitlement_card_issue_date = factory.Faker( + "date_time_this_decade", + before_now=True, + after_now=False, + tzinfo=utc, + ) + currency = factory.Faker("currency_code") + entitlement_quantity = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + entitlement_quantity_usd = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + delivered_quantity = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + delivered_quantity_usd = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + delivery_date = factory.Faker( + "date_time_this_decade", + before_now=True, + after_now=False, + tzinfo=utc, + ) + service_provider = factory.SubFactory(ServiceProviderFactory) + registration_ca_id = factory.Faker("uuid4") + + +class TestMigrateCashPlanToPaymentPlan(TestCase): + @classmethod + def setUpTestData(cls) -> None: + cls.business_area = create_afghanistan() + + cls.content_type_for_payment_plan = ContentType.objects.get_for_model(PaymentPlan) + cls.content_type_for_cash_plan = ContentType.objects.get_for_model(CashPlan) + cls.content_type_for_payment = ContentType.objects.get_for_model(Payment) + + cls.cash_delivery_mechanism = DeliveryMechanismFactory(name="Cash") + cls.digital_delivery_mechanism = DeliveryMechanismFactory(name="Digital") + + cls.service_provider1 = ServiceProviderFactory() + cls.service_provider2 = ServiceProviderFactory() + cls.service_provider3 = ServiceProviderFactory() + + cls.tp1 = TargetPopulationFactory() + cls.tp2 = TargetPopulationFactory() + + cls.cash_plan = CashPlanFactory( + delivery_type=cls.cash_delivery_mechanism.name, + service_provider=cls.service_provider1, + is_migrated_to_payment_plan=False, + start_date=datetime.date(2021, 1, 1), + dispersion_date=datetime.date(2021, 1, 2), + status_date=datetime.date(2021, 1, 3), + ) + + cls.cash_plan2 = CashPlanFactory( + delivery_type=cls.cash_delivery_mechanism.name, + service_provider=cls.service_provider2, + is_migrated_to_payment_plan=False, + ) # CP without payments, not migrating + + cls.cash_plan3 = CashPlanFactory( + delivery_type=cls.digital_delivery_mechanism.name, + service_provider=cls.service_provider1, + is_migrated_to_payment_plan=False, + ) # CP without payments, not migrating, same service provider as CP1 so fsp delivery mechanisms should be updated + + hh1, _ = create_household(household_args={"size": 2}) + cls.pr1 = PaymentRecordFactory( + parent=cls.cash_plan, + delivery_type=cls.cash_delivery_mechanism, + target_population=cls.tp1, + head_of_household=hh1.head_of_household, + service_provider=cls.service_provider1, + ) + hh2, _ = create_household(household_args={"size": 2}) + cls.pr2 = PaymentRecordFactory( + parent=cls.cash_plan, + delivery_type=cls.digital_delivery_mechanism, + target_population=cls.tp2, + head_of_household=hh2.head_of_household, + service_provider=cls.service_provider1, + ) + cls.pvs = PaymentVerificationSummaryFactory( + payment_plan_obj=cls.cash_plan, + ) + cls.pvp = PaymentVerificationPlanFactory( + payment_plan_obj=cls.cash_plan, + payment_plan=None, + ) + cls.pv1 = PaymentVerificationFactory( + payment_verification_plan=cls.pvp, + payment_obj=cls.pr1, + status=PaymentVerification.STATUS_PENDING, + payment=None, + ) + cls.pv2 = PaymentVerificationFactory( + payment_verification_plan=cls.pvp, + payment_obj=cls.pr2, + status=PaymentVerification.STATUS_PENDING, + payment=None, + ) + + cls.grievance_ticket1 = GrievanceTicketFactory(status=GrievanceTicket.STATUS_IN_PROGRESS) + cls.ticket_complaint_details = TicketComplaintDetails.objects.create( + ticket=cls.grievance_ticket1, + payment_obj=cls.pr1, + payment_object_id=cls.pr1.id, + payment_content_type=cls.content_type_for_payment, + ) + cls.grievance_ticket2 = GrievanceTicketFactory(status=GrievanceTicket.STATUS_IN_PROGRESS) + cls.ticket_sensitive_details = TicketSensitiveDetails.objects.create( + ticket=cls.grievance_ticket2, + payment_obj=cls.pr2, + payment_object_id=cls.pr2.id, + payment_content_type=cls.content_type_for_payment, + ) + + def test_migrate(self) -> None: + assert FinancialServiceProvider.objects.count() == 0 + assert PaymentPlan.objects.count() == 0 + assert DeliveryMechanismPerPaymentPlan.objects.count() == 0 + assert Payment.objects.count() == 0 + assert PaymentVerificationSummary.objects.count() == 1 + assert PaymentVerificationPlan.objects.count() == 1 + assert PaymentVerification.objects.count() == 2 + + migrate_cash_plan_to_payment_plan() + + self.service_provider1.refresh_from_db() + self.service_provider2.refresh_from_db() + self.service_provider3.refresh_from_db() + self.cash_plan.refresh_from_db() + self.pr1.refresh_from_db() + self.pr2.refresh_from_db() + self.pvs.refresh_from_db() + self.pvp.refresh_from_db() + self.pv1.refresh_from_db() + self.pv2.refresh_from_db() + self.grievance_ticket1.refresh_from_db() + self.grievance_ticket2.refresh_from_db() + self.ticket_complaint_details.refresh_from_db() + self.ticket_sensitive_details.refresh_from_db() + + # Assert FinancialServiceProvider is created + + assert self.service_provider1.is_migrated_to_payment_plan is True + assert self.service_provider2.is_migrated_to_payment_plan is True + assert self.service_provider3.is_migrated_to_payment_plan is False # no cash plan assigned so not migrated + + assert FinancialServiceProvider.objects.count() == 2 + + fsp = FinancialServiceProvider.objects.get(vision_vendor_number=self.service_provider1.vision_id) + assert fsp.name == self.service_provider1.full_name + assert fsp.vision_vendor_number == self.service_provider1.vision_id + assert fsp.communication_channel == "API" + assert fsp.internal_data == { + "is_cash_assist": True, + "business_area": self.service_provider1.business_area.slug, + "country": self.service_provider1.country, + "ca_id": self.service_provider1.ca_id, + "short_name": self.service_provider1.short_name, + } + assert self.service_provider1.is_migrated_to_payment_plan is True + assert fsp.delivery_mechanisms.count() == 2 + + assert self.cash_plan.is_migrated_to_payment_plan is True + assert self.cash_plan2.is_migrated_to_payment_plan is False # no payments assigned so not migrated + + # Assert PaymentPlans created + pps = PaymentPlan.objects.filter(unicef_id=self.cash_plan.ca_id) + assert pps.count() == 2 # One for each target population + pp1 = pps.get(target_population=self.pr1.target_population) + assert pp1.unicef_id == self.cash_plan.ca_id + assert pp1.status == "FINISHED" + assert pp1.name == self.pr1.target_population.name + assert pp1.is_cash_assist is True + assert pp1.business_area_id == self.cash_plan.business_area.id + assert pp1.created_by_id == self.pr1.target_population.created_by.id + assert pp1.created_at == self.cash_plan.created_at + assert pp1.target_population_id == self.pr1.target_population.id + assert pp1.program_cycle_id == self.pr1.target_population.program_cycle.id + assert pp1.currency == self.pr1.currency + assert pp1.dispersion_start_date == datetime.date(2021, 1, 1) + assert pp1.dispersion_end_date == datetime.date(2021, 1, 2) + assert pp1.status_date == datetime.datetime(2021, 1, 3, tzinfo=utc) + assert pp1.exchange_rate == self.cash_plan.exchange_rate + assert pp1.total_entitled_quantity == self.cash_plan.total_entitled_quantity + assert pp1.total_entitled_quantity_usd == self.cash_plan.total_entitled_quantity_usd + assert pp1.total_entitled_quantity_revised == self.cash_plan.total_entitled_quantity_revised + assert pp1.total_entitled_quantity_revised_usd == self.cash_plan.total_entitled_quantity_revised_usd + assert pp1.total_delivered_quantity == self.cash_plan.total_delivered_quantity + assert pp1.total_delivered_quantity_usd == self.cash_plan.total_delivered_quantity_usd + assert pp1.total_undelivered_quantity == self.cash_plan.total_undelivered_quantity + assert pp1.total_undelivered_quantity_usd == self.cash_plan.total_undelivered_quantity_usd + assert pp1.internal_data == { + "name": self.cash_plan.name, + "ca_hash_id": str(self.cash_plan.ca_hash_id), + "distribution_level": self.cash_plan.distribution_level, + "coverage_duration": self.cash_plan.coverage_duration, + "coverage_unit": self.cash_plan.coverage_unit, + "comments": self.cash_plan.comments, + "assistance_measurement": self.cash_plan.assistance_measurement, + "assistance_through": self.cash_plan.assistance_through, + "vision_id": self.cash_plan.vision_id, + "funds_commitment": self.cash_plan.funds_commitment, + "down_payment": self.cash_plan.down_payment, + "validation_alerts_count": self.cash_plan.validation_alerts_count, + "total_persons_covered": self.cash_plan.total_persons_covered, + "total_persons_covered_revised": self.cash_plan.total_persons_covered_revised, + } + + pp2 = pps.get(target_population=self.pr2.target_population) + + # Assert DeliveryMechanismPerPaymentPlans created + assert DeliveryMechanismPerPaymentPlan.objects.count() == 2 + dmp1 = DeliveryMechanismPerPaymentPlan.objects.get(payment_plan=pp1) + assert dmp1.delivery_mechanism == self.cash_delivery_mechanism + assert dmp1.sent_date == self.cash_plan.status_date + assert dmp1.delivery_mechanism_order == 1 + assert dmp1.created_by == self.pr1.target_population.created_by + assert dmp1.created_at == self.pr1.target_population.created_at + assert dmp1.financial_service_provider == fsp + + dmp2 = DeliveryMechanismPerPaymentPlan.objects.get(payment_plan=pp2) + assert dmp2.delivery_mechanism == self.digital_delivery_mechanism + + # Assert PaymentRecords created + assert Payment.objects.count() == 2 + + ps = Payment.objects.filter(parent_id=pp1.id) + assert ps.count() == 1 + p1 = ps.first() + assert p1.business_area_id == self.pr1.business_area.id + assert p1.status == get_status(self.pr1.status) + assert p1.status_date == self.pr1.status_date + assert p1.household_id == self.pr1.household.id + assert p1.head_of_household_id == self.pr1.head_of_household.id + assert p1.collector_id == self.pr1.head_of_household.id + assert p1.delivery_type_id == self.pr1.delivery_type.id + assert p1.currency == self.pr1.currency + assert p1.entitlement_quantity == self.pr1.entitlement_quantity + assert p1.entitlement_quantity_usd == self.pr1.entitlement_quantity_usd + assert p1.delivered_quantity == self.pr1.delivered_quantity + assert p1.delivered_quantity_usd == self.pr1.delivered_quantity_usd + assert p1.delivery_date == self.pr1.delivery_date + assert p1.transaction_reference_id == self.pr1.transaction_reference_id + assert p1.transaction_status_blockchain_link == self.pr1.transaction_status_blockchain_link + assert p1.financial_service_provider == fsp + assert p1.program_id == self.pr1.target_population.program_cycle.program_id + assert p1.is_cash_assist is True + assert p1.internal_data == { + "ca_hash_id": str(self.pr1.ca_hash_id), + "full_name": self.pr1.full_name, + "total_persons_covered": self.pr1.total_persons_covered, + "distribution_modality": self.pr1.distribution_modality, + "target_population_cash_assist_id": self.pr1.target_population_cash_assist_id, + "target_population": str(self.pr1.target_population.id), + "entitlement_card_number": self.pr1.entitlement_card_number, + "entitlement_card_status": self.pr1.entitlement_card_status, + "entitlement_card_issue_date": str(self.pr1.entitlement_card_issue_date), + "vision_id": self.pr1.vision_id, + "registration_ca_id": self.pr1.registration_ca_id, + "service_provider": str(self.pr1.service_provider_id), + } + + ps = Payment.objects.filter(parent_id=pp2.id) + assert ps.count() == 1 + p2 = ps.first() + assert p2.delivery_type_id == self.digital_delivery_mechanism.id + + # Assert PaymentVerificationSummary is created + assert PaymentVerificationSummary.objects.count() == 2 + assert PaymentVerificationSummary.objects.filter(payment_plan=pp1).count() == 1 + assert PaymentVerificationSummary.objects.filter(payment_plan=pp2).count() == 1 + + # Assert PaymentVerificationPlan is created + assert PaymentVerificationPlan.objects.count() == 2 + pvp1 = PaymentVerificationPlan.objects.get(payment_plan=pp1) + pvp2 = PaymentVerificationPlan.objects.get(payment_plan=pp2) + assert pvp2.unicef_id == pvp1.unicef_id + + # Assert PaymentVerification is created + assert PaymentVerification.objects.count() == 2 + pv1 = PaymentVerification.objects.get(payment_verification_plan=pvp1) + assert pv1.payment == p1 + + pv2 = PaymentVerification.objects.get(payment_verification_plan=pvp2) + assert pv2.payment == p2 + + # Assert GrievanceTickets updated + assert GrievanceTicket.objects.count() == 2 + assert TicketComplaintDetails.objects.count() == 1 + assert TicketSensitiveDetails.objects.count() == 1 + self.ticket_complaint_details.refresh_from_db() + self.ticket_sensitive_details.refresh_from_db() + assert self.ticket_complaint_details.payment == p1 + assert self.ticket_sensitive_details.payment == p2 From 143e08593904a7bb5baf35b7cb5f0fd88b9a9c21 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 20:38:47 +0100 Subject: [PATCH 18/32] e2e --- tests/selenium/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/selenium/conftest.py b/tests/selenium/conftest.py index 9569e46dff..e7da8c809e 100644 --- a/tests/selenium/conftest.py +++ b/tests/selenium/conftest.py @@ -569,7 +569,7 @@ def create_super_user(business_area: BusinessArea) -> User: email="test@example.com", partner=partner, ) - UserRole.objects.create( + UserRole.objects.get_or_create( user=user, role=Role.objects.get(name="Role"), business_area=business_area, From c7fb1e8bd0a2e97ab60781889a74842ca6a3c6cf Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 22:26:44 +0100 Subject: [PATCH 19/32] ut --- tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py b/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py index f0e370a7f9..5bd9f8c379 100644 --- a/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py +++ b/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py @@ -31,7 +31,7 @@ def setUpTestData(cls) -> None: cls.user.is_active = True cls.user.save() - cls.payment_plan = PaymentPlanFactory(program=cls.program) + cls.payment_plan = PaymentPlanFactory(program_cycle=cls.program.cycles.first()) def setUp(self) -> None: self.url = reverse("admin:payment_paymentplan_change", args=[self.payment_plan.id]) From 51739f570bcf905a84ae279f0d1c15d87bcb32e9 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Thu, 28 Nov 2024 23:38:48 +0100 Subject: [PATCH 20/32] ut --- tests/unit/apps/payment/test_celery_tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/apps/payment/test_celery_tasks.py b/tests/unit/apps/payment/test_celery_tasks.py index e0ad6ec73a..887d429a8a 100644 --- a/tests/unit/apps/payment/test_celery_tasks.py +++ b/tests/unit/apps/payment/test_celery_tasks.py @@ -52,7 +52,10 @@ def test_prepare_payment_plan_task_wrong_pp_status(self, mock_logger: Mock) -> N @patch("hct_mis_api.apps.payment.celery_tasks.logger") def test_prepare_payment_plan_task_already_running(self, mock_logger: Mock) -> None: - payment_plan = PaymentPlanFactory(status=PaymentPlan.Status.PREPARING, program=self.program) + payment_plan = PaymentPlanFactory( + status=PaymentPlan.Status.PREPARING, + program_cycle=self.program.cycles.first(), + ) payment_plan.refresh_from_db() pp_id_str = str(payment_plan.pk) cache_key = generate_cache_key( From 4b87e357bda78c530cbc00082d714183ccea0de7 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 00:04:03 +0100 Subject: [PATCH 21/32] ut --- .../unit/apps/utils/test_payment_plan_celery_tasks_mixin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py b/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py index 5bd9f8c379..dc174b18ab 100644 --- a/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py +++ b/tests/unit/apps/utils/test_payment_plan_celery_tasks_mixin.py @@ -79,7 +79,7 @@ def test_restart_prepare_payment_plan_task_success(self) -> None: self.client.login(username=self.user.username, password=self.password) payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.PREPARING, - program=self.program, + program_cycle=self.program.cycles.first(), ) payment_plan.refresh_from_db() response = self.client.post( @@ -98,7 +98,7 @@ def test_restart_prepare_payment_plan_task_incorrect_status(self) -> None: self.client.login(username=self.user.username, password=self.password) payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.OPEN, - program=self.program, + program_cycle=self.program.cycles.first(), ) payment_plan.refresh_from_db() response = self.client.post( @@ -117,7 +117,7 @@ def test_restart_prepare_payment_plan_task_already_running(self) -> None: self.client.login(username=self.user.username, password=self.password) payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.PREPARING, - program=self.program, + program_cycle=self.program.cycles.first(), ) payment_plan.refresh_from_db() # set the cache to simulate an already running task From cc5393a5a3b35ebb5ef442fdece371e1749bf30f Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 01:42:42 +0100 Subject: [PATCH 22/32] ut --- tests/unit/apps/payment/test_celery_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/apps/payment/test_celery_tasks.py b/tests/unit/apps/payment/test_celery_tasks.py index 887d429a8a..aa20b6bb0e 100644 --- a/tests/unit/apps/payment/test_celery_tasks.py +++ b/tests/unit/apps/payment/test_celery_tasks.py @@ -41,7 +41,7 @@ def setUp(self) -> None: def test_prepare_payment_plan_task_wrong_pp_status(self, mock_logger: Mock) -> None: payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.OPEN, - program=self.program, + program_cycle=self.program.cycles.first(), ) payment_plan.refresh_from_db() pp_id_str = str(payment_plan.pk) From 6a6317ebc2fe1a172e964d856846219e6e88f96a Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 12:18:07 +0100 Subject: [PATCH 23/32] add missing migrations --- .../apps/household/migrations/0003_migration.py | 10 ++++++++++ .../apps/payment/migrations/0003_migration.py | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/hct_mis_api/apps/household/migrations/0003_migration.py b/src/hct_mis_api/apps/household/migrations/0003_migration.py index cb9a767490..f90f672b78 100644 --- a/src/hct_mis_api/apps/household/migrations/0003_migration.py +++ b/src/hct_mis_api/apps/household/migrations/0003_migration.py @@ -20,4 +20,14 @@ class Migration(migrations.Migration): old_name="user_fields", new_name="internal_data", ), + migrations.AlterField( + model_name='household', + name='internal_data', + field=models.JSONField(default=dict), + ), + migrations.AlterField( + model_name='individual', + name='internal_data', + field=models.JSONField(default=dict), + ), ] diff --git a/src/hct_mis_api/apps/payment/migrations/0003_migration.py b/src/hct_mis_api/apps/payment/migrations/0003_migration.py index 6989a81707..57681d39fc 100644 --- a/src/hct_mis_api/apps/payment/migrations/0003_migration.py +++ b/src/hct_mis_api/apps/payment/migrations/0003_migration.py @@ -121,4 +121,13 @@ class Migration(migrations.Migration): name='payment_plan_object_id', field=models.UUIDField(null=True), ), + migrations.RemoveConstraint( + model_name='payment', + name='payment_plan_and_household', + ), + migrations.AddConstraint( + model_name='payment', + constraint=models.UniqueConstraint(condition=models.Q(('is_removed', False), ('is_cash_assist', False)), + fields=('parent', 'household'), name='payment_plan_and_household'), + ), ] From 461cd21b3c69fe35a29f7fd1840fc754dc8d6ddd Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 12:18:38 +0100 Subject: [PATCH 24/32] refactor payment models --- .../apps/payment/models/__init__.py | 63 ++ .../apps/payment/models/acceptance.py | 98 ++ .../apps/payment/models/cash_assist.py | 482 +++++++++ .../payment/{models.py => models/payment.py} | 919 +----------------- .../apps/payment/models/verification.py | 346 +++++++ 5 files changed, 1013 insertions(+), 895 deletions(-) create mode 100644 src/hct_mis_api/apps/payment/models/__init__.py create mode 100644 src/hct_mis_api/apps/payment/models/acceptance.py create mode 100644 src/hct_mis_api/apps/payment/models/cash_assist.py rename src/hct_mis_api/apps/payment/{models.py => models/payment.py} (68%) create mode 100644 src/hct_mis_api/apps/payment/models/verification.py diff --git a/src/hct_mis_api/apps/payment/models/__init__.py b/src/hct_mis_api/apps/payment/models/__init__.py new file mode 100644 index 0000000000..a26573da4a --- /dev/null +++ b/src/hct_mis_api/apps/payment/models/__init__.py @@ -0,0 +1,63 @@ +from hct_mis_api.apps.payment.models.acceptance import ( + AcceptanceProcessThreshold, + Approval, + ApprovalProcess, +) +from hct_mis_api.apps.payment.models.cash_assist import ( + CashPlan, + GenericPayment, + GenericPaymentPlan, + PaymentRecord, + ServiceProvider, +) +from hct_mis_api.apps.payment.models.payment import ( + DeliveryMechanism, + DeliveryMechanismData, + DeliveryMechanismPerPaymentPlan, + FinancialServiceProvider, + FinancialServiceProviderXlsxTemplate, + FlexFieldArrayField, + FspXlsxTemplatePerDeliveryMechanism, + Payment, + PaymentHouseholdSnapshot, + PaymentPlan, + PaymentPlanSplit, + PaymentPlanSplitPayments, + PaymentPlanSupportingDocument, + PendingDeliveryMechanismData, +) +from hct_mis_api.apps.payment.models.verification import ( + PaymentVerification, + PaymentVerificationPlan, + PaymentVerificationSummary, + build_summary, +) + +__all__ = [ + "AcceptanceProcessThreshold", + "Approval", + "ApprovalProcess", + "CashPlan", + "GenericPayment", + "GenericPaymentPlan", + "PaymentRecord", + "ServiceProvider", + "DeliveryMechanism", + "DeliveryMechanismData", + "DeliveryMechanismPerPaymentPlan", + "FinancialServiceProvider", + "FinancialServiceProviderXlsxTemplate", + "FspXlsxTemplatePerDeliveryMechanism", + "Payment", + "PaymentHouseholdSnapshot", + "PaymentPlan", + "PaymentPlanSplit", + "PaymentPlanSplitPayments", + "PaymentPlanSupportingDocument", + "PendingDeliveryMechanismData", + "PaymentVerification", + "PaymentVerificationPlan", + "PaymentVerificationSummary", + "FlexFieldArrayField", + "build_summary", +] diff --git a/src/hct_mis_api/apps/payment/models/acceptance.py b/src/hct_mis_api/apps/payment/models/acceptance.py new file mode 100644 index 0000000000..bd52a29164 --- /dev/null +++ b/src/hct_mis_api/apps/payment/models/acceptance.py @@ -0,0 +1,98 @@ +import logging + +from django.conf import settings +from django.contrib.postgres.fields import IntegerRangeField +from django.contrib.postgres.validators import RangeMinValueValidator +from django.db import models +from django.utils.translation import gettext_lazy as _ + +from psycopg2._range import NumericRange + +from hct_mis_api.apps.utils.models import TimeStampedUUIDModel + +logger = logging.getLogger(__name__) + + +class ApprovalProcess(TimeStampedUUIDModel): + sent_for_approval_by = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True + ) + sent_for_approval_date = models.DateTimeField(null=True) + sent_for_authorization_by = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True + ) + sent_for_authorization_date = models.DateTimeField(null=True) + sent_for_finance_release_by = models.ForeignKey( + settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True + ) + sent_for_finance_release_date = models.DateTimeField(null=True) + payment_plan = models.ForeignKey("payment.PaymentPlan", on_delete=models.CASCADE, related_name="approval_process") + + approval_number_required = models.PositiveIntegerField(default=1) + authorization_number_required = models.PositiveIntegerField(default=1) + finance_release_number_required = models.PositiveIntegerField(default=1) + + class Meta: + ordering = ("-created_at",) + verbose_name_plural = "Approval Processes" + + +class Approval(TimeStampedUUIDModel): + APPROVAL = "APPROVAL" + AUTHORIZATION = "AUTHORIZATION" + FINANCE_RELEASE = "FINANCE_RELEASE" + REJECT = "REJECT" + TYPE_CHOICES = ( + (APPROVAL, "Approval"), + (AUTHORIZATION, "Authorization"), + (FINANCE_RELEASE, "Finance Release"), + (REJECT, "Reject"), + ) + + type = models.CharField(max_length=50, choices=TYPE_CHOICES, default=APPROVAL, verbose_name=_("Approval type")) + comment = models.CharField(max_length=500, null=True, blank=True) + created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True) + approval_process = models.ForeignKey(ApprovalProcess, on_delete=models.CASCADE, related_name="approvals") + + class Meta: + ordering = ("-created_at",) + + def __str__(self) -> str: + return self.type or "" + + @property + def info(self) -> str: + types_map = { + self.APPROVAL: "Approved", + self.AUTHORIZATION: "Authorized", + self.FINANCE_RELEASE: "Released", + self.REJECT: "Rejected", + } + + return f"{types_map.get(self.type)} by {self.created_by}" if self.created_by else types_map.get(self.type, "") + + +class AcceptanceProcessThreshold(TimeStampedUUIDModel): + business_area = models.ForeignKey( + "core.BusinessArea", on_delete=models.PROTECT, related_name="acceptance_process_thresholds" + ) + payments_range_usd = IntegerRangeField( + default=NumericRange(0, None), + validators=[ + RangeMinValueValidator(0), + ], + ) + approval_number_required = models.PositiveIntegerField(default=1) + authorization_number_required = models.PositiveIntegerField(default=1) + finance_release_number_required = models.PositiveIntegerField(default=1) + + class Meta: + ordering = ("payments_range_usd",) + + def __str__(self) -> str: + return ( + f"{self.payments_range_usd} USD, " + f"Approvals: {self.approval_number_required} " + f"Authorization: {self.authorization_number_required} " + f"Finance Releases: {self.finance_release_number_required}" + ) diff --git a/src/hct_mis_api/apps/payment/models/cash_assist.py b/src/hct_mis_api/apps/payment/models/cash_assist.py new file mode 100644 index 0000000000..0f2a092af9 --- /dev/null +++ b/src/hct_mis_api/apps/payment/models/cash_assist.py @@ -0,0 +1,482 @@ +import logging +from datetime import datetime +from decimal import Decimal +from functools import cached_property +from typing import TYPE_CHECKING, Any, Callable, Optional + +from django.contrib.contenttypes.fields import GenericRelation +from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator +from django.db import models +from django.db.models import Q, QuerySet +from django.utils import timezone +from django.utils.translation import gettext_lazy as _ + +from model_utils import Choices + +from hct_mis_api.apps.core.currencies import USDC +from hct_mis_api.apps.core.exchange_rates import ExchangeRates +from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices +from hct_mis_api.apps.utils.models import ( + AdminUrlMixin, + ConcurrencyModel, + TimeStampedUUIDModel, +) + +if TYPE_CHECKING: + from hct_mis_api.apps.core.exchange_rates.api import ExchangeRateClient + + +logger = logging.getLogger(__name__) + + +class GenericPaymentPlan(TimeStampedUUIDModel): + usd_fields = [ + "total_entitled_quantity_usd", + "total_entitled_quantity_revised_usd", + "total_delivered_quantity_usd", + "total_undelivered_quantity_usd", + ] + + business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) + status_date = models.DateTimeField() + start_date = models.DateTimeField( + db_index=True, + blank=True, + null=True, + ) + end_date = models.DateTimeField( + db_index=True, + blank=True, + null=True, + ) + program = models.ForeignKey("program.Program", on_delete=models.CASCADE) + exchange_rate = models.DecimalField(decimal_places=8, blank=True, null=True, max_digits=14) + + total_entitled_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + ) + total_entitled_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_entitled_quantity_revised = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_entitled_quantity_revised_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_delivered_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_delivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + total_undelivered_quantity = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0"))], + db_index=True, + null=True, + blank=True, + ) + total_undelivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True + ) + + class Meta: + abstract = True + + @property + def get_unicef_id(self) -> str: + return self.ca_id if isinstance(self, CashPlan) else self.unicef_id + + def get_exchange_rate(self, exchange_rates_client: Optional["ExchangeRateClient"] = None) -> float: + if self.currency == USDC: + # exchange rate for Digital currency + return 1.0 + + if exchange_rates_client is None: + exchange_rates_client = ExchangeRates() + + return exchange_rates_client.get_exchange_rate_for_currency_code(self.currency, self.currency_exchange_date) + + @property + def get_payment_verification_summary(self) -> Any: + """PaymentPlan has only one payment_verification_summary""" + from hct_mis_api.apps.payment.models import PaymentVerificationSummary + + c_type = ContentType.objects.get_for_model(self.__class__) + try: + verification_summary = PaymentVerificationSummary.objects.get( + payment_plan_content_type_id=c_type.pk, payment_plan_object_id=self.pk + ) + except PaymentVerificationSummary.DoesNotExist: + return None + return verification_summary + + @property + def get_payment_verification_plans(self) -> Any: + from hct_mis_api.apps.payment.models import PaymentVerificationPlan + + c_type = ContentType.objects.get_for_model(self.__class__) + payment_verification_plans = PaymentVerificationPlan.objects.filter( + payment_plan_content_type_id=c_type.pk, payment_plan_object_id=self.pk + ) + return payment_verification_plans + + def available_payment_records( + self, + payment_verification_plan: Any = None, + extra_validation: Optional[Callable] = None, + ) -> QuerySet: + params = Q(status__in=GenericPayment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0) + + if payment_verification_plan: + params &= Q( + Q(payment_verification__isnull=True) + | Q(payment_verification__payment_verification_plan=payment_verification_plan) + ) + else: + params &= Q(payment_verification__isnull=True) + + payment_records = self.payment_items.select_related("head_of_household").filter(params).distinct() + + if extra_validation: + payment_records = list(map(lambda pr: pr.pk, filter(extra_validation, payment_records))) + + qs = PaymentRecord.objects.filter(pk__in=payment_records) + + return qs + + @property + def can_create_payment_verification_plan(self) -> int: + return self.available_payment_records().count() > 0 + + +class GenericPayment(TimeStampedUUIDModel): + usd_fields = ["delivered_quantity_usd", "entitlement_quantity_usd"] + + STATUS_SUCCESS = "Transaction Successful" + STATUS_ERROR = "Transaction Erroneous" + STATUS_DISTRIBUTION_SUCCESS = "Distribution Successful" + STATUS_NOT_DISTRIBUTED = "Not Distributed" + STATUS_FORCE_FAILED = "Force failed" + STATUS_DISTRIBUTION_PARTIAL = "Partially Distributed" + STATUS_PENDING = "Pending" + # Payment Gateway statuses + STATUS_SENT_TO_PG = "Sent to Payment Gateway" + STATUS_SENT_TO_FSP = "Sent to FSP" + STATUS_MANUALLY_CANCELLED = "Manually Cancelled" + + STATUS_CHOICE = ( + (STATUS_DISTRIBUTION_SUCCESS, _("Distribution Successful")), # Delivered Fully + (STATUS_NOT_DISTRIBUTED, _("Not Distributed")), # Not Delivered + (STATUS_SUCCESS, _("Transaction Successful")), # Delivered Fully + (STATUS_ERROR, _("Transaction Erroneous")), # Unsuccessful + (STATUS_FORCE_FAILED, _("Force failed")), # Force Failed + (STATUS_DISTRIBUTION_PARTIAL, _("Partially Distributed")), # Delivered Partially + (STATUS_PENDING, _("Pending")), # Pending + (STATUS_SENT_TO_PG, _("Sent to Payment Gateway")), + (STATUS_SENT_TO_FSP, _("Sent to FSP")), + (STATUS_MANUALLY_CANCELLED, _("Manually Cancelled")), + ) + + ALLOW_CREATE_VERIFICATION = (STATUS_SUCCESS, STATUS_DISTRIBUTION_SUCCESS, STATUS_DISTRIBUTION_PARTIAL) + PENDING_STATUSES = (STATUS_PENDING, STATUS_SENT_TO_PG, STATUS_SENT_TO_FSP) + + ENTITLEMENT_CARD_STATUS_ACTIVE = "ACTIVE" + ENTITLEMENT_CARD_STATUS_INACTIVE = "INACTIVE" + ENTITLEMENT_CARD_STATUS_CHOICE = Choices( + (ENTITLEMENT_CARD_STATUS_ACTIVE, _("Active")), + (ENTITLEMENT_CARD_STATUS_INACTIVE, _("Inactive")), + ) + + business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) + status = models.CharField( + max_length=255, + choices=STATUS_CHOICE, + default=STATUS_PENDING, + ) + status_date = models.DateTimeField() + household = models.ForeignKey("household.Household", on_delete=models.CASCADE) + head_of_household = models.ForeignKey("household.Individual", on_delete=models.CASCADE, null=True) + delivery_type = models.ForeignKey("payment.DeliveryMechanism", on_delete=models.SET_NULL, null=True) + currency = models.CharField( + max_length=4, + ) + entitlement_quantity = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + entitlement_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivered_quantity = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivered_quantity_usd = models.DecimalField( + decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True + ) + delivery_date = models.DateTimeField(null=True, blank=True) + transaction_reference_id = models.CharField(max_length=255, null=True, blank=True) # transaction_id + transaction_status_blockchain_link = models.CharField(max_length=255, null=True, blank=True) + + class Meta: + abstract = True + + @property + def verification(self) -> Any: + from hct_mis_api.apps.payment.models import PaymentVerification + + c_type = ContentType.objects.get_for_model(self.__class__) + try: + verification = PaymentVerification.objects.get(payment_content_type_id=c_type.pk, payment_object_id=self.pk) + except PaymentVerification.DoesNotExist: + return None + return verification + + def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: + raise NotImplementedError() + + def mark_as_failed(self) -> None: + if self.status is self.STATUS_FORCE_FAILED: + raise ValidationError("Status shouldn't be failed") + self.status = self.STATUS_FORCE_FAILED + self.status_date = timezone.now() + self.delivered_quantity = 0 + self.delivered_quantity_usd = 0 + self.delivery_date = None + + def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: datetime) -> None: + if self.status != self.STATUS_FORCE_FAILED: + raise ValidationError("Only payment marked as force failed can be reverted") + if self.entitlement_quantity is None: + raise ValidationError("Entitlement quantity need to be set in order to revert") + + self.status = self.get_revert_mark_as_failed_status(delivered_quantity) + self.status_date = timezone.now() + self.delivered_quantity = delivered_quantity + self.delivery_date = delivery_date + + @property + def get_unicef_id(self) -> str: + return self.ca_id if isinstance(self, PaymentRecord) else self.unicef_id + + @property + def payment_status(self) -> str: + status = "-" + if self.status == GenericPayment.STATUS_PENDING: + status = "Pending" + + elif self.status in (GenericPayment.STATUS_DISTRIBUTION_SUCCESS, GenericPayment.STATUS_SUCCESS): + status = "Delivered Fully" + + elif self.status == GenericPayment.STATUS_DISTRIBUTION_PARTIAL: + status = "Delivered Partially" + + elif self.status == GenericPayment.STATUS_NOT_DISTRIBUTED: + status = "Not Delivered" + + elif self.status == GenericPayment.STATUS_ERROR: + status = "Unsuccessful" + + elif self.status == GenericPayment.STATUS_FORCE_FAILED: + status = "Force Failed" + + return status + + +class CashPlan(ConcurrencyModel, AdminUrlMixin, GenericPaymentPlan): + DISTRIBUTION_COMPLETED = "Distribution Completed" + DISTRIBUTION_COMPLETED_WITH_ERRORS = "Distribution Completed with Errors" + TRANSACTION_COMPLETED = "Transaction Completed" + TRANSACTION_COMPLETED_WITH_ERRORS = "Transaction Completed with Errors" + + STATUS_CHOICE = ( + (DISTRIBUTION_COMPLETED, _("Distribution Completed")), + ( + DISTRIBUTION_COMPLETED_WITH_ERRORS, + _("Distribution Completed with Errors"), + ), + (TRANSACTION_COMPLETED, _("Transaction Completed")), + ( + TRANSACTION_COMPLETED_WITH_ERRORS, + _("Transaction Completed with Errors"), + ), + ) + name = models.CharField(max_length=255, db_index=True) + ca_id = models.CharField(max_length=255, null=True, db_index=True) + ca_hash_id = models.UUIDField(unique=True, null=True) + status = models.CharField(max_length=255, choices=STATUS_CHOICE, db_index=True) + distribution_level = models.CharField(max_length=255) + dispersion_date = models.DateTimeField() + coverage_duration = models.PositiveIntegerField() + coverage_unit = models.CharField(max_length=255) + comments = models.CharField(max_length=255, null=True) + delivery_type = models.CharField( + choices=DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, + max_length=32, + null=True, + db_index=True, + ) + assistance_measurement = models.CharField(max_length=255, db_index=True) + assistance_through = models.CharField(max_length=255, db_index=True) + service_provider = models.ForeignKey( + "payment.ServiceProvider", + null=True, + related_name="cash_plans", + on_delete=models.CASCADE, + ) + vision_id = models.CharField(max_length=255, null=True) + funds_commitment = models.CharField(max_length=255, null=True) + down_payment = models.CharField(max_length=255, null=True) + validation_alerts_count = models.IntegerField() + total_persons_covered = models.IntegerField(db_index=True) + total_persons_covered_revised = models.IntegerField(db_index=True) + payment_verification_summary = GenericRelation( + "payment.PaymentVerificationSummary", + content_type_field="payment_plan_content_type", + object_id_field="payment_plan_object_id", + related_query_name="cash_plan", + ) + payment_verification_plan = GenericRelation( + "payment.PaymentVerificationPlan", + content_type_field="payment_plan_content_type", + object_id_field="payment_plan_object_id", + related_query_name="cash_plan", + ) + is_migrated_to_payment_plan = models.BooleanField(default=False) + + def __str__(self) -> str: + return self.name or "" + + @property + def payment_records_count(self) -> int: + return self.payment_items.count() + + @property + def bank_reconciliation_success(self) -> int: + return self.payment_items.filter(status__in=PaymentRecord.ALLOW_CREATE_VERIFICATION).count() + + @property + def bank_reconciliation_error(self) -> int: + return self.payment_items.filter(status=PaymentRecord.STATUS_ERROR).count() + + @cached_property + def total_number_of_households(self) -> int: + # https://unicef.visualstudio.com/ICTD-HCT-MIS/_workitems/edit/84040 + return self.payment_items.count() + + @property + def currency(self) -> Optional[str]: + payment_record = self.payment_items.first() + return payment_record.currency if payment_record else None + + @property + def currency_exchange_date(self) -> datetime: + return self.dispersion_date + + def unicef_id(self) -> str: + return self.ca_id + + @property + def verification_status(self) -> Optional[str]: + summary = self.payment_verification_summary.first() + return getattr(summary, "status", None) + + class Meta: + verbose_name = "Cash Plan" + ordering = ["created_at"] + + +class PaymentRecord(ConcurrencyModel, AdminUrlMixin, GenericPayment): + ENTITLEMENT_CARD_STATUS_ACTIVE = "ACTIVE" + ENTITLEMENT_CARD_STATUS_INACTIVE = "INACTIVE" + ENTITLEMENT_CARD_STATUS_CHOICE = Choices( + (ENTITLEMENT_CARD_STATUS_ACTIVE, _("Active")), + (ENTITLEMENT_CARD_STATUS_INACTIVE, _("Inactive")), + ) + + ca_id = models.CharField(max_length=255, null=True, db_index=True) + ca_hash_id = models.UUIDField(unique=True, null=True) + parent = models.ForeignKey( + "payment.CashPlan", + on_delete=models.CASCADE, + related_name="payment_items", + null=True, + ) + + full_name = models.CharField(max_length=255) + total_persons_covered = models.IntegerField() + distribution_modality = models.CharField( + max_length=255, + ) + target_population = models.ForeignKey( + "targeting.TargetPopulation", + on_delete=models.CASCADE, + related_name="payment_records", + ) + target_population_cash_assist_id = models.CharField(max_length=255) + entitlement_card_number = models.CharField(max_length=255, null=True) + entitlement_card_status = models.CharField( + choices=ENTITLEMENT_CARD_STATUS_CHOICE, default="ACTIVE", max_length=20, null=True + ) + entitlement_card_issue_date = models.DateField(null=True) + vision_id = models.CharField(max_length=255, null=True) + registration_ca_id = models.CharField(max_length=255, null=True) + service_provider = models.ForeignKey( + "payment.ServiceProvider", + on_delete=models.CASCADE, + ) + payment_verification = GenericRelation( + "payment.PaymentVerification", + content_type_field="payment_content_type", + object_id_field="payment_object_id", + related_query_name="payment_record", + ) + ticket_complaint_details = GenericRelation( + "grievance.TicketComplaintDetails", + content_type_field="payment_content_type", + object_id_field="payment_object_id", + related_query_name="payment_record", + ) + ticket_sensitive_details = GenericRelation( + "grievance.TicketSensitiveDetails", + content_type_field="payment_content_type", + object_id_field="payment_object_id", + related_query_name="payment_record", + ) + + @property + def unicef_id(self) -> str: + return self.ca_id + + def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: + return self.STATUS_SUCCESS + + +class ServiceProvider(TimeStampedUUIDModel): + business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) + ca_id = models.CharField(max_length=255, unique=True) + full_name = models.CharField(max_length=255, null=True) + short_name = models.CharField(max_length=100, null=True) + country = models.CharField(max_length=3) + vision_id = models.CharField(max_length=255, null=True) + is_migrated_to_payment_plan = models.BooleanField(default=False) + + def __str__(self) -> str: + return self.full_name or "" diff --git a/src/hct_mis_api/apps/payment/models.py b/src/hct_mis_api/apps/payment/models/payment.py similarity index 68% rename from src/hct_mis_api/apps/payment/models.py rename to src/hct_mis_api/apps/payment/models/payment.py index a7aa87b74a..491e7a89da 100644 --- a/src/hct_mis_api/apps/payment/models.py +++ b/src/hct_mis_api/apps/payment/models/payment.py @@ -11,12 +11,8 @@ from django import forms from django.conf import settings -from django.contrib.admin.options import get_content_type_for_model from django.contrib.admin.widgets import FilteredSelectMultiple -from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation -from django.contrib.contenttypes.models import ContentType -from django.contrib.postgres.fields import ArrayField, IntegerRangeField -from django.contrib.postgres.validators import RangeMinValueValidator +from django.contrib.postgres.fields import ArrayField from django.core.exceptions import ValidationError from django.core.validators import ( MaxLengthValidator, @@ -25,24 +21,13 @@ MinValueValidator, ) from django.db import models -from django.db.models import ( - Count, - JSONField, - Q, - QuerySet, - Sum, - UniqueConstraint, - UUIDField, -) +from django.db.models import Count, JSONField, Q, QuerySet, Sum, UniqueConstraint from django.db.models.functions import Coalesce -from django.db.models.signals import post_delete, post_save -from django.dispatch import receiver from django.utils import timezone from django.utils.translation import gettext_lazy as _ from dateutil.relativedelta import relativedelta from django_fsm import FSMField, transition -from graphql import GraphQLError from model_utils import Choices from model_utils.models import SoftDeletableModel from multiselectfield import MultiSelectField @@ -64,10 +49,9 @@ Scope, ) from hct_mis_api.apps.core.mixins import LimitBusinessAreaModelMixin -from hct_mis_api.apps.core.models import BusinessArea, FileTemp, FlexibleAttribute +from hct_mis_api.apps.core.models import FileTemp, FlexibleAttribute from hct_mis_api.apps.geo.models import Area, Country from hct_mis_api.apps.household.models import FEMALE, MALE, Individual -from hct_mis_api.apps.payment.delivery_mechanisms import DeliveryMechanismChoices from hct_mis_api.apps.payment.fields import DynamicChoiceArrayField from hct_mis_api.apps.payment.managers import PaymentManager from hct_mis_api.apps.payment.validators import payment_token_and_order_number_validator @@ -88,6 +72,10 @@ from hct_mis_api.apps.account.models import User from hct_mis_api.apps.core.exchange_rates.api import ExchangeRateClient from hct_mis_api.apps.grievance.models import GrievanceTicket + from hct_mis_api.apps.payment.models import ( + AcceptanceProcessThreshold, + PaymentVerificationPlan, + ) from hct_mis_api.apps.program.models import Program logger = logging.getLogger(__name__) @@ -99,284 +87,6 @@ class ModifiedData: modified_by: Optional["User"] = None -class ChoiceArrayFieldDM(ArrayField): - def formfield(self, form_class: Optional[Any] = ..., choices_form_class: Optional[Any] = ..., **kwargs: Any) -> Any: - defaults = { - "form_class": forms.TypedMultipleChoiceField, - "choices": self.base_field.choices, - "coerce": self.base_field.to_python, - "widget": forms.SelectMultiple, - } - defaults.update(kwargs) - - return super().formfield(**defaults) - - -class GenericPaymentPlan(TimeStampedUUIDModel): - usd_fields = [ - "total_entitled_quantity_usd", - "total_entitled_quantity_revised_usd", - "total_delivered_quantity_usd", - "total_undelivered_quantity_usd", - ] - - business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) - status_date = models.DateTimeField() - start_date = models.DateTimeField( - db_index=True, - blank=True, - null=True, - ) - end_date = models.DateTimeField( - db_index=True, - blank=True, - null=True, - ) - program = models.ForeignKey("program.Program", on_delete=models.CASCADE) - exchange_rate = models.DecimalField(decimal_places=8, blank=True, null=True, max_digits=14) - - total_entitled_quantity = models.DecimalField( - decimal_places=2, - max_digits=12, - validators=[MinValueValidator(Decimal("0"))], - db_index=True, - null=True, - ) - total_entitled_quantity_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True - ) - total_entitled_quantity_revised = models.DecimalField( - decimal_places=2, - max_digits=12, - validators=[MinValueValidator(Decimal("0"))], - db_index=True, - null=True, - blank=True, - ) - total_entitled_quantity_revised_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True - ) - total_delivered_quantity = models.DecimalField( - decimal_places=2, - max_digits=12, - validators=[MinValueValidator(Decimal("0"))], - db_index=True, - null=True, - blank=True, - ) - total_delivered_quantity_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True - ) - total_undelivered_quantity = models.DecimalField( - decimal_places=2, - max_digits=12, - validators=[MinValueValidator(Decimal("0"))], - db_index=True, - null=True, - blank=True, - ) - total_undelivered_quantity_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0"))], null=True, blank=True - ) - - class Meta: - abstract = True - - @property - def get_unicef_id(self) -> str: - return self.ca_id if isinstance(self, CashPlan) else self.unicef_id - - def get_exchange_rate(self, exchange_rates_client: Optional["ExchangeRateClient"] = None) -> float: - if self.currency == USDC: - # exchange rate for Digital currency - return 1.0 - - if exchange_rates_client is None: - exchange_rates_client = ExchangeRates() - - return exchange_rates_client.get_exchange_rate_for_currency_code(self.currency, self.currency_exchange_date) - - @property - def get_payment_verification_summary(self) -> Optional["PaymentVerificationSummary"]: - """PaymentPlan has only one payment_verification_summary""" - c_type = ContentType.objects.get_for_model(self.__class__) - try: - verification_summary = PaymentVerificationSummary.objects.get( - payment_plan_content_type_id=c_type.pk, payment_plan_object_id=self.pk - ) - except PaymentVerificationSummary.DoesNotExist: - return None - return verification_summary - - @property - def get_payment_verification_plans(self) -> QuerySet["PaymentVerificationPlan"]: - c_type = ContentType.objects.get_for_model(self.__class__) - payment_verification_plans = PaymentVerificationPlan.objects.filter( - payment_plan_content_type_id=c_type.pk, payment_plan_object_id=self.pk - ) - return payment_verification_plans - - def available_payment_records( - self, - payment_verification_plan: Optional["PaymentVerificationPlan"] = None, - extra_validation: Optional[Callable] = None, - ) -> QuerySet: - params = Q(status__in=GenericPayment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0) - - if payment_verification_plan: - params &= Q( - Q(payment_verification__isnull=True) - | Q(payment_verification__payment_verification_plan=payment_verification_plan) - ) - else: - params &= Q(payment_verification__isnull=True) - - payment_records = self.payment_items.select_related("head_of_household").filter(params).distinct() - - if extra_validation: - payment_records = list(map(lambda pr: pr.pk, filter(extra_validation, payment_records))) - - qs = (PaymentRecord if self.__class__.__name__ == "CashPlan" else Payment).objects.filter( - pk__in=payment_records - ) - - return qs - - @property - def can_create_payment_verification_plan(self) -> int: - return self.available_payment_records().count() > 0 - - -class GenericPayment(TimeStampedUUIDModel): - usd_fields = ["delivered_quantity_usd", "entitlement_quantity_usd"] - - STATUS_SUCCESS = "Transaction Successful" - STATUS_ERROR = "Transaction Erroneous" - STATUS_DISTRIBUTION_SUCCESS = "Distribution Successful" - STATUS_NOT_DISTRIBUTED = "Not Distributed" - STATUS_FORCE_FAILED = "Force failed" - STATUS_DISTRIBUTION_PARTIAL = "Partially Distributed" - STATUS_PENDING = "Pending" - # Payment Gateway statuses - STATUS_SENT_TO_PG = "Sent to Payment Gateway" - STATUS_SENT_TO_FSP = "Sent to FSP" - STATUS_MANUALLY_CANCELLED = "Manually Cancelled" - - STATUS_CHOICE = ( - (STATUS_DISTRIBUTION_SUCCESS, _("Distribution Successful")), # Delivered Fully - (STATUS_NOT_DISTRIBUTED, _("Not Distributed")), # Not Delivered - (STATUS_SUCCESS, _("Transaction Successful")), # Delivered Fully - (STATUS_ERROR, _("Transaction Erroneous")), # Unsuccessful - (STATUS_FORCE_FAILED, _("Force failed")), # Force Failed - (STATUS_DISTRIBUTION_PARTIAL, _("Partially Distributed")), # Delivered Partially - (STATUS_PENDING, _("Pending")), # Pending - (STATUS_SENT_TO_PG, _("Sent to Payment Gateway")), - (STATUS_SENT_TO_FSP, _("Sent to FSP")), - (STATUS_MANUALLY_CANCELLED, _("Manually Cancelled")), - ) - - ALLOW_CREATE_VERIFICATION = (STATUS_SUCCESS, STATUS_DISTRIBUTION_SUCCESS, STATUS_DISTRIBUTION_PARTIAL) - PENDING_STATUSES = (STATUS_PENDING, STATUS_SENT_TO_PG, STATUS_SENT_TO_FSP) - - ENTITLEMENT_CARD_STATUS_ACTIVE = "ACTIVE" - ENTITLEMENT_CARD_STATUS_INACTIVE = "INACTIVE" - ENTITLEMENT_CARD_STATUS_CHOICE = Choices( - (ENTITLEMENT_CARD_STATUS_ACTIVE, _("Active")), - (ENTITLEMENT_CARD_STATUS_INACTIVE, _("Inactive")), - ) - - business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) - status = models.CharField( - max_length=255, - choices=STATUS_CHOICE, - default=STATUS_PENDING, - ) - status_date = models.DateTimeField() - household = models.ForeignKey("household.Household", on_delete=models.CASCADE) - head_of_household = models.ForeignKey("household.Individual", on_delete=models.CASCADE, null=True) - delivery_type = models.ForeignKey("payment.DeliveryMechanism", on_delete=models.SET_NULL, null=True) - currency = models.CharField( - max_length=4, - ) - entitlement_quantity = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True - ) - entitlement_quantity_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True - ) - delivered_quantity = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True - ) - delivered_quantity_usd = models.DecimalField( - decimal_places=2, max_digits=12, validators=[MinValueValidator(Decimal("0.00"))], null=True, blank=True - ) - delivery_date = models.DateTimeField(null=True, blank=True) - transaction_reference_id = models.CharField(max_length=255, null=True, blank=True) # transaction_id - transaction_status_blockchain_link = models.CharField(max_length=255, null=True, blank=True) - - class Meta: - abstract = True - - @property - def verification(self) -> Optional["PaymentVerification"]: - c_type = ContentType.objects.get_for_model(self.__class__) - try: - verification = PaymentVerification.objects.get(payment_content_type_id=c_type.pk, payment_object_id=self.pk) - except PaymentVerification.DoesNotExist: - return None - return verification - - def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: - raise NotImplementedError() - - def mark_as_failed(self) -> None: - if self.status is self.STATUS_FORCE_FAILED: - raise ValidationError("Status shouldn't be failed") - self.status = self.STATUS_FORCE_FAILED - self.status_date = timezone.now() - self.delivered_quantity = 0 - self.delivered_quantity_usd = 0 - self.delivery_date = None - - def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: datetime) -> None: - if self.status != self.STATUS_FORCE_FAILED: - raise ValidationError("Only payment marked as force failed can be reverted") - if self.entitlement_quantity is None: - raise ValidationError("Entitlement quantity need to be set in order to revert") - - self.status = self.get_revert_mark_as_failed_status(delivered_quantity) - self.status_date = timezone.now() - self.delivered_quantity = delivered_quantity - self.delivery_date = delivery_date - - @property - def get_unicef_id(self) -> str: - return self.ca_id if isinstance(self, PaymentRecord) else self.unicef_id - - @property - def payment_status(self) -> str: - status = "-" - if self.status == GenericPayment.STATUS_PENDING: - status = "Pending" - - elif self.status in (GenericPayment.STATUS_DISTRIBUTION_SUCCESS, GenericPayment.STATUS_SUCCESS): - status = "Delivered Fully" - - elif self.status == GenericPayment.STATUS_DISTRIBUTION_PARTIAL: - status = "Delivered Partially" - - elif self.status == GenericPayment.STATUS_NOT_DISTRIBUTED: - status = "Not Delivered" - - elif self.status == GenericPayment.STATUS_ERROR: - status = "Unsuccessful" - - elif self.status == GenericPayment.STATUS_FORCE_FAILED: - status = "Force Failed" - - return status - - class PaymentPlanSplitPayments(TimeStampedUUIDModel): payment_plan_split = models.ForeignKey( "payment.PaymentPlanSplit", on_delete=models.CASCADE, related_name="payment_plan_split" @@ -864,6 +574,8 @@ def status_mark_as_reviewed(self) -> None: target=Status.FINISHED, ) def status_finished(self) -> None: + from hct_mis_api.apps.payment.models import PaymentVerificationSummary + self.status_date = timezone.now() if not hasattr(self, "payment_verification_summary"): @@ -1001,7 +713,7 @@ def is_reconciled(self) -> bool: return False return ( - self.eligible_payments.exclude(status__in=GenericPayment.PENDING_STATUSES).count() + self.eligible_payments.exclude(status__in=Payment.PENDING_STATUSES).count() == self.eligible_payments.count() ) @@ -1101,6 +813,8 @@ def program(self) -> "Program": return self.program_cycle.program def _get_last_approval_process_data(self) -> ModifiedData: + from hct_mis_api.apps.payment.models import Approval + approval_process = hasattr(self, "approval_process") and self.approval_process.first() if approval_process: if self.status == PaymentPlan.Status.IN_APPROVAL: @@ -1170,7 +884,7 @@ def available_payment_records( payment_verification_plan: Optional["PaymentVerificationPlan"] = None, extra_validation: Optional[Callable] = None, ) -> QuerySet: - params = Q(status__in=GenericPayment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0) + params = Q(status__in=Payment.ALLOW_CREATE_VERIFICATION, delivered_quantity__gt=0) if payment_verification_plan: params &= Q( @@ -1476,11 +1190,13 @@ class FspXlsxTemplatePerDeliveryMechanism(TimeStampedUUIDModel): verbose_name=_("Created by"), ) financial_service_provider = models.ForeignKey( - "FinancialServiceProvider", on_delete=models.CASCADE, related_name="fsp_xlsx_template_per_delivery_mechanisms" + "payment.FinancialServiceProvider", + on_delete=models.CASCADE, + related_name="fsp_xlsx_template_per_delivery_mechanisms", ) delivery_mechanism = models.ForeignKey("DeliveryMechanism", on_delete=models.SET_NULL, null=True) xlsx_template = models.ForeignKey( - "FinancialServiceProviderXlsxTemplate", + "payment.FinancialServiceProviderXlsxTemplate", on_delete=models.CASCADE, related_name="fsp_xlsx_template_per_delivery_mechanisms", ) @@ -1641,175 +1357,6 @@ def status_send(self, sent_by: "User") -> None: self.sent_by = sent_by -class CashPlan(ConcurrencyModel, AdminUrlMixin, GenericPaymentPlan): - DISTRIBUTION_COMPLETED = "Distribution Completed" - DISTRIBUTION_COMPLETED_WITH_ERRORS = "Distribution Completed with Errors" - TRANSACTION_COMPLETED = "Transaction Completed" - TRANSACTION_COMPLETED_WITH_ERRORS = "Transaction Completed with Errors" - - STATUS_CHOICE = ( - (DISTRIBUTION_COMPLETED, _("Distribution Completed")), - ( - DISTRIBUTION_COMPLETED_WITH_ERRORS, - _("Distribution Completed with Errors"), - ), - (TRANSACTION_COMPLETED, _("Transaction Completed")), - ( - TRANSACTION_COMPLETED_WITH_ERRORS, - _("Transaction Completed with Errors"), - ), - ) - name = models.CharField(max_length=255, db_index=True) - ca_id = models.CharField(max_length=255, null=True, db_index=True) - ca_hash_id = models.UUIDField(unique=True, null=True) - status = models.CharField(max_length=255, choices=STATUS_CHOICE, db_index=True) - distribution_level = models.CharField(max_length=255) - dispersion_date = models.DateTimeField() - coverage_duration = models.PositiveIntegerField() - coverage_unit = models.CharField(max_length=255) - comments = models.CharField(max_length=255, null=True) - delivery_type = models.CharField( - choices=DeliveryMechanismChoices.DELIVERY_TYPE_CHOICES, - max_length=32, - null=True, - db_index=True, - ) - assistance_measurement = models.CharField(max_length=255, db_index=True) - assistance_through = models.CharField(max_length=255, db_index=True) - service_provider = models.ForeignKey( - "payment.ServiceProvider", - null=True, - related_name="cash_plans", - on_delete=models.CASCADE, - ) - vision_id = models.CharField(max_length=255, null=True) - funds_commitment = models.CharField(max_length=255, null=True) - down_payment = models.CharField(max_length=255, null=True) - validation_alerts_count = models.IntegerField() - total_persons_covered = models.IntegerField(db_index=True) - total_persons_covered_revised = models.IntegerField(db_index=True) - payment_verification_summary = GenericRelation( - "payment.PaymentVerificationSummary", - content_type_field="payment_plan_content_type", - object_id_field="payment_plan_object_id", - related_query_name="cash_plan", - ) - payment_verification_plan = GenericRelation( - "payment.PaymentVerificationPlan", - content_type_field="payment_plan_content_type", - object_id_field="payment_plan_object_id", - related_query_name="cash_plan", - ) - is_migrated_to_payment_plan = models.BooleanField(default=False) - - def __str__(self) -> str: - return self.name or "" - - @property - def payment_records_count(self) -> int: - return self.payment_items.count() - - @property - def bank_reconciliation_success(self) -> int: - return self.payment_items.filter(status__in=PaymentRecord.ALLOW_CREATE_VERIFICATION).count() - - @property - def bank_reconciliation_error(self) -> int: - return self.payment_items.filter(status=PaymentRecord.STATUS_ERROR).count() - - @cached_property - def total_number_of_households(self) -> int: - # https://unicef.visualstudio.com/ICTD-HCT-MIS/_workitems/edit/84040 - return self.payment_items.count() - - @property - def currency(self) -> Optional[str]: - payment_record = self.payment_items.first() - return payment_record.currency if payment_record else None - - @property - def currency_exchange_date(self) -> datetime: - return self.dispersion_date - - def unicef_id(self) -> str: - return self.ca_id - - @property - def verification_status(self) -> Optional[str]: - summary = self.payment_verification_summary.first() - return getattr(summary, "status", None) - - class Meta: - verbose_name = "Cash Plan" - ordering = ["created_at"] - - -class PaymentRecord(ConcurrencyModel, AdminUrlMixin, GenericPayment): - ENTITLEMENT_CARD_STATUS_ACTIVE = "ACTIVE" - ENTITLEMENT_CARD_STATUS_INACTIVE = "INACTIVE" - ENTITLEMENT_CARD_STATUS_CHOICE = Choices( - (ENTITLEMENT_CARD_STATUS_ACTIVE, _("Active")), - (ENTITLEMENT_CARD_STATUS_INACTIVE, _("Inactive")), - ) - - ca_id = models.CharField(max_length=255, null=True, db_index=True) - ca_hash_id = models.UUIDField(unique=True, null=True) - parent = models.ForeignKey( - "payment.CashPlan", - on_delete=models.CASCADE, - related_name="payment_items", - null=True, - ) - - full_name = models.CharField(max_length=255) - total_persons_covered = models.IntegerField() - distribution_modality = models.CharField( - max_length=255, - ) - target_population = models.ForeignKey( - "targeting.TargetPopulation", - on_delete=models.CASCADE, - related_name="payment_records", - ) - target_population_cash_assist_id = models.CharField(max_length=255) - entitlement_card_number = models.CharField(max_length=255, null=True) - entitlement_card_status = models.CharField( - choices=ENTITLEMENT_CARD_STATUS_CHOICE, default="ACTIVE", max_length=20, null=True - ) - entitlement_card_issue_date = models.DateField(null=True) - vision_id = models.CharField(max_length=255, null=True) - registration_ca_id = models.CharField(max_length=255, null=True) - service_provider = models.ForeignKey( - "payment.ServiceProvider", - on_delete=models.CASCADE, - ) - payment_verification = GenericRelation( - "payment.PaymentVerification", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment_record", - ) - ticket_complaint_details = GenericRelation( - "grievance.TicketComplaintDetails", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment_record", - ) - ticket_sensitive_details = GenericRelation( - "grievance.TicketSensitiveDetails", - content_type_field="payment_content_type", - object_id_field="payment_object_id", - related_query_name="payment_record", - ) - - @property - def unicef_id(self) -> str: - return self.ca_id - - def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: - return self.STATUS_SUCCESS - - class Payment( TimeStampedUUIDModel, InternalDataFieldModel, @@ -1818,8 +1365,6 @@ class Payment( AdminUrlMixin, SignatureMixin, ): - # GenericPayment fields - usd_fields = ["delivered_quantity_usd", "entitlement_quantity_usd"] STATUS_SUCCESS = "Transaction Successful" @@ -1909,22 +1454,22 @@ def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: date @property def payment_status(self) -> str: status = "-" - if self.status == GenericPayment.STATUS_PENDING: + if self.status == Payment.STATUS_PENDING: status = "Pending" - elif self.status in (GenericPayment.STATUS_DISTRIBUTION_SUCCESS, GenericPayment.STATUS_SUCCESS): + elif self.status in (Payment.STATUS_DISTRIBUTION_SUCCESS, Payment.STATUS_SUCCESS): status = "Delivered Fully" - elif self.status == GenericPayment.STATUS_DISTRIBUTION_PARTIAL: + elif self.status == Payment.STATUS_DISTRIBUTION_PARTIAL: status = "Delivered Partially" - elif self.status == GenericPayment.STATUS_NOT_DISTRIBUTED: + elif self.status == Payment.STATUS_NOT_DISTRIBUTED: status = "Not Delivered" - elif self.status == GenericPayment.STATUS_ERROR: + elif self.status == Payment.STATUS_ERROR: status = "Unsuccessful" - elif self.status == GenericPayment.STATUS_FORCE_FAILED: + elif self.status == Payment.STATUS_FORCE_FAILED: status = "Force Failed" return status @@ -2048,422 +1593,6 @@ class Meta: ) -class ServiceProvider(TimeStampedUUIDModel): - business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE) - ca_id = models.CharField(max_length=255, unique=True) - full_name = models.CharField(max_length=255, null=True) - short_name = models.CharField(max_length=100, null=True) - country = models.CharField(max_length=3) - vision_id = models.CharField(max_length=255, null=True) - is_migrated_to_payment_plan = models.BooleanField(default=False) - - def __str__(self) -> str: - return self.full_name or "" - - -class PaymentVerificationPlan(TimeStampedUUIDModel, ConcurrencyModel, UnicefIdentifiedModel, AdminUrlMixin): - ACTIVITY_LOG_MAPPING = create_mapping_dict( - [ - "status", - "payment_plan", - "sampling", - "verification_channel", - "sample_size", - "responded_count", - "received_count", - "not_received_count", - "received_with_problems_count", - "confidence_interval", - "margin_of_error", - "rapid_pro_flow_id", - "rapid_pro_flow_start_uuids", - "age_filter", - "excluded_admin_areas_filter", - "sex_filter", - "activation_date", - "completion_date", - ] - ) - STATUS_PENDING = "PENDING" - STATUS_ACTIVE = "ACTIVE" - STATUS_FINISHED = "FINISHED" - STATUS_INVALID = "INVALID" - STATUS_RAPID_PRO_ERROR = "RAPID_PRO_ERROR" - SAMPLING_FULL_LIST = "FULL_LIST" - SAMPLING_RANDOM = "RANDOM" - VERIFICATION_CHANNEL_RAPIDPRO = "RAPIDPRO" - VERIFICATION_CHANNEL_XLSX = "XLSX" - VERIFICATION_CHANNEL_MANUAL = "MANUAL" - STATUS_CHOICES = ( - (STATUS_ACTIVE, "Active"), - (STATUS_FINISHED, "Finished"), - (STATUS_PENDING, "Pending"), - (STATUS_INVALID, "Invalid"), - (STATUS_RAPID_PRO_ERROR, "RapidPro Error"), - ) - SAMPLING_CHOICES = ( - (SAMPLING_FULL_LIST, "Full list"), - (SAMPLING_RANDOM, "Random sampling"), - ) - VERIFICATION_CHANNEL_CHOICES = ( - (VERIFICATION_CHANNEL_MANUAL, "MANUAL"), - (VERIFICATION_CHANNEL_RAPIDPRO, "RAPIDPRO"), - (VERIFICATION_CHANNEL_XLSX, "XLSX"), - ) - status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, db_index=True) - - # TODO TP DROP - payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) - payment_plan_object_id = UUIDField(null=True) - payment_plan_obj: "Union[PaymentPlan, CashPlan]" = GenericForeignKey( - "payment_plan_content_type", "payment_plan_object_id" - ) # type: ignore - - payment_plan = models.ForeignKey( - "payment.PaymentPlan", on_delete=models.CASCADE, related_name="payment_verification_plans", null=True - ) - - sampling = models.CharField(max_length=50, choices=SAMPLING_CHOICES) - verification_channel = models.CharField(max_length=50, choices=VERIFICATION_CHANNEL_CHOICES) - sample_size = models.PositiveIntegerField(null=True, blank=True) - responded_count = models.PositiveIntegerField(null=True, blank=True) - received_count = models.PositiveIntegerField(null=True, blank=True) - not_received_count = models.PositiveIntegerField(null=True, blank=True) - received_with_problems_count = models.PositiveIntegerField(null=True, blank=True) - confidence_interval = models.FloatField(null=True, blank=True) - margin_of_error = models.FloatField(null=True, blank=True) - rapid_pro_flow_id = models.CharField(max_length=255, blank=True) - rapid_pro_flow_start_uuids = ArrayField(models.CharField(max_length=255, blank=True), default=list) - age_filter = JSONField(null=True, blank=True) - excluded_admin_areas_filter = JSONField(null=True, blank=True) - sex_filter = models.CharField(null=True, max_length=10, blank=True) - activation_date = models.DateTimeField(null=True) - completion_date = models.DateTimeField(null=True) - xlsx_file_exporting = models.BooleanField(default=False) - xlsx_file_imported = models.BooleanField(default=False) - error = models.CharField(max_length=500, null=True, blank=True) - - class Meta: - ordering = ("created_at",) - # TODO TP DROP - indexes = [ - models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), - ] - - @property - def business_area(self) -> BusinessArea: - return self.payment_plan.business_area - - @property - def get_xlsx_verification_file(self) -> FileTemp: - try: - return FileTemp.objects.get(object_id=self.pk, content_type=get_content_type_for_model(self)) - except FileTemp.DoesNotExist: - raise GraphQLError("Xlsx Verification File does not exist.") - except FileTemp.MultipleObjectsReturned as e: - logger.exception(e) - raise GraphQLError("Query returned multiple Xlsx Verification Files when only one was expected.") - - @property - def has_xlsx_payment_verification_plan_file(self) -> bool: - return all( - [ - self.verification_channel == self.VERIFICATION_CHANNEL_XLSX, - FileTemp.objects.filter(object_id=self.pk, content_type=get_content_type_for_model(self)).count() == 1, - ] - ) - - @property - def xlsx_payment_verification_plan_file_link(self) -> Optional[str]: - return self.get_xlsx_verification_file.file.url if self.has_xlsx_payment_verification_plan_file else None - - @property - def xlsx_payment_verification_plan_file_was_downloaded(self) -> bool: - return self.get_xlsx_verification_file.was_downloaded if self.has_xlsx_payment_verification_plan_file else False - - def set_active(self) -> None: - self.status = PaymentVerificationPlan.STATUS_ACTIVE - self.activation_date = timezone.now() - self.error = None - - def set_pending(self) -> None: - self.status = PaymentVerificationPlan.STATUS_PENDING - self.responded_count = None - self.received_count = None - self.not_received_count = None - self.received_with_problems_count = None - self.activation_date = None - self.rapid_pro_flow_start_uuids = [] - - def can_activate(self) -> bool: - return self.status not in ( - PaymentVerificationPlan.STATUS_PENDING, - PaymentVerificationPlan.STATUS_RAPID_PRO_ERROR, - ) - - @property - def get_program(self) -> Optional["Program"]: - return self.payment_plan.program_cycle.program - - -def build_summary(payment_plan: Optional[Any]) -> None: - if not payment_plan: - return - - statuses_count = payment_plan.payment_verification_plans.aggregate( - active=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_ACTIVE)), - pending=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_PENDING)), - finished=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_FINISHED)), - ) - summary = payment_plan.payment_verification_summary - if statuses_count["active"] >= 1: - summary.mark_as_active() - elif statuses_count["finished"] >= 1 and statuses_count["active"] == 0 and statuses_count["pending"] == 0: - summary.mark_as_finished() - else: - summary.status = PaymentVerificationSummary.STATUS_PENDING - summary.completion_date = None - summary.activation_date = None - summary.mark_as_pending() - summary.save() - - -@receiver( - post_save, - sender=PaymentVerificationPlan, - dispatch_uid="update_verification_status_in_cash_plan", -) -def update_verification_status_in_cash_plan(sender: Any, instance: PaymentVerificationPlan, **kwargs: Any) -> None: - build_summary(instance.payment_plan) - - -@receiver( - post_delete, - sender=PaymentVerificationPlan, - dispatch_uid="update_verification_status_in_cash_plan_on_delete", -) -def update_verification_status_in_cash_plan_on_delete( - sender: Any, instance: PaymentVerificationPlan, **kwargs: Any -) -> None: - build_summary(instance.payment_plan) - - -class PaymentVerification(TimeStampedUUIDModel, ConcurrencyModel, AdminUrlMixin): - ACTIVITY_LOG_MAPPING = create_mapping_dict( - [ - "payment_verification_plan", - "status", - "status_date", - "received_amount", - ] - ) - STATUS_PENDING = "PENDING" - STATUS_RECEIVED = "RECEIVED" - STATUS_NOT_RECEIVED = "NOT_RECEIVED" - STATUS_RECEIVED_WITH_ISSUES = "RECEIVED_WITH_ISSUES" - STATUS_CHOICES = ( - (STATUS_NOT_RECEIVED, "NOT RECEIVED"), - (STATUS_PENDING, "PENDING"), - (STATUS_RECEIVED, "RECEIVED"), - (STATUS_RECEIVED_WITH_ISSUES, "RECEIVED WITH ISSUES"), - ) - payment_verification_plan = models.ForeignKey( - "payment.PaymentVerificationPlan", - on_delete=models.CASCADE, - related_name="payment_record_verifications", - ) - - # TODO TP DROP - payment_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) - payment_object_id = UUIDField(null=True) - payment_obj = GenericForeignKey("payment_content_type", "payment_object_id") - - payment = models.OneToOneField( - "payment.Payment", - on_delete=models.CASCADE, - related_name="payment_verification", - null=True, - ) - - status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING) - status_date = models.DateTimeField(null=True) - received_amount = models.DecimalField( - decimal_places=2, - max_digits=12, - validators=[MinValueValidator(Decimal("0.01"))], - null=True, - ) - sent_to_rapid_pro = models.BooleanField(default=False) - - class Meta: - indexes = [ - models.Index(fields=["payment_content_type", "payment_object_id"]), - ] - constraints = [ - UniqueConstraint( - fields=["payment_content_type", "payment_object_id"], - name="payment_content_type_and_payment_id", - ) - ] - - @property - def is_manually_editable(self) -> bool: - if self.payment_verification_plan.verification_channel != PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL: - return False - minutes_elapsed = (timezone.now() - self.status_date).total_seconds() / 60 - return not (self.status != PaymentVerification.STATUS_PENDING and minutes_elapsed > 10) - - @property - def business_area(self) -> BusinessArea: - return self.payment_verification_plan.payment_plan.business_area - - def set_pending(self) -> None: - self.status_date = timezone.now() - self.status = PaymentVerification.STATUS_PENDING - self.received_amount = None - - -class PaymentVerificationSummary(TimeStampedUUIDModel): - STATUS_PENDING = "PENDING" - STATUS_ACTIVE = "ACTIVE" - STATUS_FINISHED = "FINISHED" - STATUS_CHOICES = ( - (STATUS_ACTIVE, "Active"), - (STATUS_FINISHED, "Finished"), - (STATUS_PENDING, "Pending"), - ) - status = models.CharField( - max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, verbose_name="Verification status", db_index=True - ) - activation_date = models.DateTimeField(null=True) - completion_date = models.DateTimeField(null=True) - - payment_plan = models.OneToOneField( - "payment.PaymentPlan", - on_delete=models.CASCADE, - related_name="payment_verification_summary", - null=True, - ) - - # TODO TP drop - payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) - payment_plan_object_id = UUIDField(null=True) - payment_plan_obj = GenericForeignKey("payment_plan_content_type", "payment_plan_object_id") - - class Meta: - # TODO TP DROP - indexes = [ - models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), - ] - constraints = [ - UniqueConstraint( - fields=["payment_plan_content_type", "payment_plan_object_id"], - name="payment_plan_content_type_and_payment_plan_id", - ) - ] - - def mark_as_active(self) -> None: - self.status = self.STATUS_ACTIVE - self.completion_date = None - if self.activation_date is None: - self.activation_date = timezone.now() - - def mark_as_finished(self) -> None: - self.status = self.STATUS_FINISHED - if self.completion_date is None: - self.completion_date = timezone.now() - - def mark_as_pending(self) -> None: - self.status = self.STATUS_PENDING - self.completion_date = None - self.activation_date = None - - -class ApprovalProcess(TimeStampedUUIDModel): - sent_for_approval_by = models.ForeignKey( - settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True - ) - sent_for_approval_date = models.DateTimeField(null=True) - sent_for_authorization_by = models.ForeignKey( - settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True - ) - sent_for_authorization_date = models.DateTimeField(null=True) - sent_for_finance_release_by = models.ForeignKey( - settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, related_name="+", null=True - ) - sent_for_finance_release_date = models.DateTimeField(null=True) - payment_plan = models.ForeignKey(PaymentPlan, on_delete=models.CASCADE, related_name="approval_process") - - approval_number_required = models.PositiveIntegerField(default=1) - authorization_number_required = models.PositiveIntegerField(default=1) - finance_release_number_required = models.PositiveIntegerField(default=1) - - class Meta: - ordering = ("-created_at",) - verbose_name_plural = "Approval Processes" - - -class Approval(TimeStampedUUIDModel): - APPROVAL = "APPROVAL" - AUTHORIZATION = "AUTHORIZATION" - FINANCE_RELEASE = "FINANCE_RELEASE" - REJECT = "REJECT" - TYPE_CHOICES = ( - (APPROVAL, "Approval"), - (AUTHORIZATION, "Authorization"), - (FINANCE_RELEASE, "Finance Release"), - (REJECT, "Reject"), - ) - - type = models.CharField(max_length=50, choices=TYPE_CHOICES, default=APPROVAL, verbose_name=_("Approval type")) - comment = models.CharField(max_length=500, null=True, blank=True) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True) - approval_process = models.ForeignKey(ApprovalProcess, on_delete=models.CASCADE, related_name="approvals") - - class Meta: - ordering = ("-created_at",) - - def __str__(self) -> str: - return self.type or "" - - @property - def info(self) -> str: - types_map = { - self.APPROVAL: "Approved", - self.AUTHORIZATION: "Authorized", - self.FINANCE_RELEASE: "Released", - self.REJECT: "Rejected", - } - - return f"{types_map.get(self.type)} by {self.created_by}" if self.created_by else types_map.get(self.type, "") - - -class AcceptanceProcessThreshold(TimeStampedUUIDModel): - business_area = models.ForeignKey( - "core.BusinessArea", on_delete=models.PROTECT, related_name="acceptance_process_thresholds" - ) - payments_range_usd = IntegerRangeField( - default=NumericRange(0, None), - validators=[ - RangeMinValueValidator(0), - ], - ) - approval_number_required = models.PositiveIntegerField(default=1) - authorization_number_required = models.PositiveIntegerField(default=1) - finance_release_number_required = models.PositiveIntegerField(default=1) - - class Meta: - ordering = ("payments_range_usd",) - - def __str__(self) -> str: - return ( - f"{self.payments_range_usd} USD, " - f"Approvals: {self.approval_number_required} " - f"Authorization: {self.authorization_number_required} " - f"Finance Releases: {self.finance_release_number_required}" - ) - - class PaymentHouseholdSnapshot(TimeStampedUUIDModel): snapshot_data = JSONField(default=dict) household_id = models.UUIDField() @@ -2477,7 +1606,7 @@ class DeliveryMechanismData(MergeStatusModel, TimeStampedUUIDModel, SignatureMix individual = models.ForeignKey( "household.Individual", on_delete=models.CASCADE, related_name="delivery_mechanisms_data" ) - delivery_mechanism = models.ForeignKey("DeliveryMechanism", on_delete=models.PROTECT) + delivery_mechanism = models.ForeignKey("payment.DeliveryMechanism", on_delete=models.PROTECT) data = JSONField(default=dict, blank=True) is_valid: bool = models.BooleanField(default=False) # type: ignore diff --git a/src/hct_mis_api/apps/payment/models/verification.py b/src/hct_mis_api/apps/payment/models/verification.py new file mode 100644 index 0000000000..0a231298bd --- /dev/null +++ b/src/hct_mis_api/apps/payment/models/verification.py @@ -0,0 +1,346 @@ +import logging +from decimal import Decimal +from typing import TYPE_CHECKING, Any, Optional + +from django.contrib.admin.options import get_content_type_for_model +from django.contrib.contenttypes.fields import GenericForeignKey +from django.contrib.contenttypes.models import ContentType +from django.contrib.postgres.fields import ArrayField +from django.core.validators import MinValueValidator +from django.db import models +from django.db.models import Count, JSONField, Q, UniqueConstraint, UUIDField +from django.db.models.signals import post_delete, post_save +from django.dispatch import receiver +from django.utils import timezone + +from graphql import GraphQLError + +from hct_mis_api.apps.activity_log.utils import create_mapping_dict +from hct_mis_api.apps.core.models import BusinessArea, FileTemp +from hct_mis_api.apps.utils.models import ( + AdminUrlMixin, + ConcurrencyModel, + TimeStampedUUIDModel, + UnicefIdentifiedModel, +) + +if TYPE_CHECKING: + from hct_mis_api.apps.program.models import Program + +logger = logging.getLogger(__name__) + + +class PaymentVerificationPlan(TimeStampedUUIDModel, ConcurrencyModel, UnicefIdentifiedModel, AdminUrlMixin): + ACTIVITY_LOG_MAPPING = create_mapping_dict( + [ + "status", + "payment_plan", + "sampling", + "verification_channel", + "sample_size", + "responded_count", + "received_count", + "not_received_count", + "received_with_problems_count", + "confidence_interval", + "margin_of_error", + "rapid_pro_flow_id", + "rapid_pro_flow_start_uuids", + "age_filter", + "excluded_admin_areas_filter", + "sex_filter", + "activation_date", + "completion_date", + ] + ) + STATUS_PENDING = "PENDING" + STATUS_ACTIVE = "ACTIVE" + STATUS_FINISHED = "FINISHED" + STATUS_INVALID = "INVALID" + STATUS_RAPID_PRO_ERROR = "RAPID_PRO_ERROR" + SAMPLING_FULL_LIST = "FULL_LIST" + SAMPLING_RANDOM = "RANDOM" + VERIFICATION_CHANNEL_RAPIDPRO = "RAPIDPRO" + VERIFICATION_CHANNEL_XLSX = "XLSX" + VERIFICATION_CHANNEL_MANUAL = "MANUAL" + STATUS_CHOICES = ( + (STATUS_ACTIVE, "Active"), + (STATUS_FINISHED, "Finished"), + (STATUS_PENDING, "Pending"), + (STATUS_INVALID, "Invalid"), + (STATUS_RAPID_PRO_ERROR, "RapidPro Error"), + ) + SAMPLING_CHOICES = ( + (SAMPLING_FULL_LIST, "Full list"), + (SAMPLING_RANDOM, "Random sampling"), + ) + VERIFICATION_CHANNEL_CHOICES = ( + (VERIFICATION_CHANNEL_MANUAL, "MANUAL"), + (VERIFICATION_CHANNEL_RAPIDPRO, "RAPIDPRO"), + (VERIFICATION_CHANNEL_XLSX, "XLSX"), + ) + status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, db_index=True) + + # TODO TP DROP + payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_plan_object_id = UUIDField(null=True) + payment_plan_obj = GenericForeignKey("payment_plan_content_type", "payment_plan_object_id") + + payment_plan = models.ForeignKey( + "payment.PaymentPlan", on_delete=models.CASCADE, related_name="payment_verification_plans", null=True + ) + + sampling = models.CharField(max_length=50, choices=SAMPLING_CHOICES) + verification_channel = models.CharField(max_length=50, choices=VERIFICATION_CHANNEL_CHOICES) + sample_size = models.PositiveIntegerField(null=True, blank=True) + responded_count = models.PositiveIntegerField(null=True, blank=True) + received_count = models.PositiveIntegerField(null=True, blank=True) + not_received_count = models.PositiveIntegerField(null=True, blank=True) + received_with_problems_count = models.PositiveIntegerField(null=True, blank=True) + confidence_interval = models.FloatField(null=True, blank=True) + margin_of_error = models.FloatField(null=True, blank=True) + rapid_pro_flow_id = models.CharField(max_length=255, blank=True) + rapid_pro_flow_start_uuids = ArrayField(models.CharField(max_length=255, blank=True), default=list) + age_filter = JSONField(null=True, blank=True) + excluded_admin_areas_filter = JSONField(null=True, blank=True) + sex_filter = models.CharField(null=True, max_length=10, blank=True) + activation_date = models.DateTimeField(null=True) + completion_date = models.DateTimeField(null=True) + xlsx_file_exporting = models.BooleanField(default=False) + xlsx_file_imported = models.BooleanField(default=False) + error = models.CharField(max_length=500, null=True, blank=True) + + class Meta: + ordering = ("created_at",) + # TODO TP DROP + indexes = [ + models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), + ] + + @property + def business_area(self) -> BusinessArea: + return self.payment_plan.business_area + + @property + def get_xlsx_verification_file(self) -> FileTemp: + try: + return FileTemp.objects.get(object_id=self.pk, content_type=get_content_type_for_model(self)) + except FileTemp.DoesNotExist: + raise GraphQLError("Xlsx Verification File does not exist.") + except FileTemp.MultipleObjectsReturned as e: + logger.exception(e) + raise GraphQLError("Query returned multiple Xlsx Verification Files when only one was expected.") + + @property + def has_xlsx_payment_verification_plan_file(self) -> bool: + return all( + [ + self.verification_channel == self.VERIFICATION_CHANNEL_XLSX, + FileTemp.objects.filter(object_id=self.pk, content_type=get_content_type_for_model(self)).count() == 1, + ] + ) + + @property + def xlsx_payment_verification_plan_file_link(self) -> Optional[str]: + return self.get_xlsx_verification_file.file.url if self.has_xlsx_payment_verification_plan_file else None + + @property + def xlsx_payment_verification_plan_file_was_downloaded(self) -> bool: + return self.get_xlsx_verification_file.was_downloaded if self.has_xlsx_payment_verification_plan_file else False + + def set_active(self) -> None: + self.status = PaymentVerificationPlan.STATUS_ACTIVE + self.activation_date = timezone.now() + self.error = None + + def set_pending(self) -> None: + self.status = PaymentVerificationPlan.STATUS_PENDING + self.responded_count = None + self.received_count = None + self.not_received_count = None + self.received_with_problems_count = None + self.activation_date = None + self.rapid_pro_flow_start_uuids = [] + + def can_activate(self) -> bool: + return self.status not in ( + PaymentVerificationPlan.STATUS_PENDING, + PaymentVerificationPlan.STATUS_RAPID_PRO_ERROR, + ) + + @property + def get_program(self) -> Optional["Program"]: + return self.payment_plan.program_cycle.program + + +def build_summary(payment_plan: Optional[Any]) -> None: + if not payment_plan: + return + + statuses_count = payment_plan.payment_verification_plans.aggregate( + active=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_ACTIVE)), + pending=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_PENDING)), + finished=Count("pk", filter=Q(status=PaymentVerificationSummary.STATUS_FINISHED)), + ) + summary = payment_plan.payment_verification_summary + if statuses_count["active"] >= 1: + summary.mark_as_active() + elif statuses_count["finished"] >= 1 and statuses_count["active"] == 0 and statuses_count["pending"] == 0: + summary.mark_as_finished() + else: + summary.status = PaymentVerificationSummary.STATUS_PENDING + summary.completion_date = None + summary.activation_date = None + summary.mark_as_pending() + summary.save() + + +@receiver( + post_save, + sender=PaymentVerificationPlan, + dispatch_uid="update_verification_status_in_cash_plan", +) +def update_verification_status_in_cash_plan(sender: Any, instance: PaymentVerificationPlan, **kwargs: Any) -> None: + build_summary(instance.payment_plan) + + +@receiver( + post_delete, + sender=PaymentVerificationPlan, + dispatch_uid="update_verification_status_in_cash_plan_on_delete", +) +def update_verification_status_in_cash_plan_on_delete( + sender: Any, instance: PaymentVerificationPlan, **kwargs: Any +) -> None: + build_summary(instance.payment_plan) + + +class PaymentVerification(TimeStampedUUIDModel, ConcurrencyModel, AdminUrlMixin): + ACTIVITY_LOG_MAPPING = create_mapping_dict( + [ + "payment_verification_plan", + "status", + "status_date", + "received_amount", + ] + ) + STATUS_PENDING = "PENDING" + STATUS_RECEIVED = "RECEIVED" + STATUS_NOT_RECEIVED = "NOT_RECEIVED" + STATUS_RECEIVED_WITH_ISSUES = "RECEIVED_WITH_ISSUES" + STATUS_CHOICES = ( + (STATUS_NOT_RECEIVED, "NOT RECEIVED"), + (STATUS_PENDING, "PENDING"), + (STATUS_RECEIVED, "RECEIVED"), + (STATUS_RECEIVED_WITH_ISSUES, "RECEIVED WITH ISSUES"), + ) + payment_verification_plan = models.ForeignKey( + "payment.PaymentVerificationPlan", + on_delete=models.CASCADE, + related_name="payment_record_verifications", + ) + + # TODO TP DROP + payment_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_object_id = UUIDField(null=True) + payment_obj = GenericForeignKey("payment_content_type", "payment_object_id") + + payment = models.OneToOneField( + "payment.Payment", + on_delete=models.CASCADE, + related_name="payment_verification", + null=True, + ) + + status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING) + status_date = models.DateTimeField(null=True) + received_amount = models.DecimalField( + decimal_places=2, + max_digits=12, + validators=[MinValueValidator(Decimal("0.01"))], + null=True, + ) + sent_to_rapid_pro = models.BooleanField(default=False) + + class Meta: + indexes = [ + models.Index(fields=["payment_content_type", "payment_object_id"]), + ] + constraints = [ + UniqueConstraint( + fields=["payment_content_type", "payment_object_id"], + name="payment_content_type_and_payment_id", + ) + ] + + @property + def is_manually_editable(self) -> bool: + if self.payment_verification_plan.verification_channel != PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL: + return False + minutes_elapsed = (timezone.now() - self.status_date).total_seconds() / 60 + return not (self.status != PaymentVerification.STATUS_PENDING and minutes_elapsed > 10) + + @property + def business_area(self) -> BusinessArea: + return self.payment_verification_plan.payment_plan.business_area + + def set_pending(self) -> None: + self.status_date = timezone.now() + self.status = PaymentVerification.STATUS_PENDING + self.received_amount = None + + +class PaymentVerificationSummary(TimeStampedUUIDModel): + STATUS_PENDING = "PENDING" + STATUS_ACTIVE = "ACTIVE" + STATUS_FINISHED = "FINISHED" + STATUS_CHOICES = ( + (STATUS_ACTIVE, "Active"), + (STATUS_FINISHED, "Finished"), + (STATUS_PENDING, "Pending"), + ) + status = models.CharField( + max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, verbose_name="Verification status", db_index=True + ) + activation_date = models.DateTimeField(null=True) + completion_date = models.DateTimeField(null=True) + + payment_plan = models.OneToOneField( + "payment.PaymentPlan", + on_delete=models.CASCADE, + related_name="payment_verification_summary", + null=True, + ) + + # TODO TP drop + payment_plan_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True) + payment_plan_object_id = UUIDField(null=True) + payment_plan_obj = GenericForeignKey("payment_plan_content_type", "payment_plan_object_id") + + class Meta: + # TODO TP DROP + indexes = [ + models.Index(fields=["payment_plan_content_type", "payment_plan_object_id"]), + ] + constraints = [ + UniqueConstraint( + fields=["payment_plan_content_type", "payment_plan_object_id"], + name="payment_plan_content_type_and_payment_plan_id", + ) + ] + + def mark_as_active(self) -> None: + self.status = self.STATUS_ACTIVE + self.completion_date = None + if self.activation_date is None: + self.activation_date = timezone.now() + + def mark_as_finished(self) -> None: + self.status = self.STATUS_FINISHED + if self.completion_date is None: + self.completion_date = timezone.now() + + def mark_as_pending(self) -> None: + self.status = self.STATUS_PENDING + self.completion_date = None + self.activation_date = None From c5b3d0623a5eb7509f964e1e1c44754484a81431 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 12:22:28 +0100 Subject: [PATCH 25/32] ignore cash_assist.py coverage --- src/hct_mis_api/apps/payment/models/cash_assist.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hct_mis_api/apps/payment/models/cash_assist.py b/src/hct_mis_api/apps/payment/models/cash_assist.py index 0f2a092af9..3bf27ad06d 100644 --- a/src/hct_mis_api/apps/payment/models/cash_assist.py +++ b/src/hct_mis_api/apps/payment/models/cash_assist.py @@ -1,3 +1,4 @@ +# pragma: no cover import logging from datetime import datetime from decimal import Decimal From b66f6a7866c589b62cfb3b36dcc062dd89bb4f26 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 12:49:15 +0100 Subject: [PATCH 26/32] ignore cash_assist.py coverage --- src/hct_mis_api/apps/payment/models/cash_assist.py | 1 - tests/.coveragerc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hct_mis_api/apps/payment/models/cash_assist.py b/src/hct_mis_api/apps/payment/models/cash_assist.py index 3bf27ad06d..0f2a092af9 100644 --- a/src/hct_mis_api/apps/payment/models/cash_assist.py +++ b/src/hct_mis_api/apps/payment/models/cash_assist.py @@ -1,4 +1,3 @@ -# pragma: no cover import logging from datetime import datetime from decimal import Decimal diff --git a/tests/.coveragerc b/tests/.coveragerc index 8e5e354932..8ddd23ee07 100644 --- a/tests/.coveragerc +++ b/tests/.coveragerc @@ -18,6 +18,7 @@ omit = hct_mis_api/conftest.py hct_mis_api/config/settings.py hct_mis_api/apps/core/management/commands/* + hct_mis_api/apps/payment/models/cash_assist.py [report] # Regexes for lines to exclude from consideration From 2002ef493feddf4b66876ecd5c6619616667c97c Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 13:19:11 +0100 Subject: [PATCH 27/32] ignore cash_assist.py coverage (last try) --- codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov.yml b/codecov.yml index bf1bacd789..8c06ecb827 100644 --- a/codecov.yml +++ b/codecov.yml @@ -25,6 +25,7 @@ coverage: - "hct_mis_api/conftest.py" - "hct_mis_api/config/settings.py" - "hct_mis_api/apps/core/management/commands/*" + - "hct_mis_api/apps/payment/models/cash_assist.py" - "pragma: no cover" - "pragma: no-cover" - "def __repr__" From 60ad048c8efd04802d04ec7c1cfad8222989f609 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 14:32:50 +0100 Subject: [PATCH 28/32] script exception fix --- src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py index 956d12c4a4..15b9312ffb 100644 --- a/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py +++ b/src/hct_mis_api/one_time_scripts/migrate_cash_assist_models.py @@ -151,13 +151,12 @@ def migrate_cash_plan_to_payment_plan() -> None: financial_service_provider = fsp_vision_vendor_number_to_obj.get(cp.service_provider.vision_id) if not financial_service_provider: - logger.error( + raise ValueError( f"FinancialServiceProvider not found for vision_id: {first_record.service_provider.vision_id}" f"Cash Plan: {cp}" f"Record: {first_record}" f"Service Provider: {first_record.service_provider}" ) - continue dmppp = DeliveryMechanismPerPaymentPlan.objects.create( payment_plan_id=pp.id, From 95c715ef33f7a892e149bd9751a2050a36511333 Mon Sep 17 00:00:00 2001 From: Jan Romaniak Date: Fri, 29 Nov 2024 16:35:08 +0100 Subject: [PATCH 29/32] codecove ignore fix --- codecov.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/codecov.yml b/codecov.yml index 8c06ecb827..0bd3cff35e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -18,14 +18,14 @@ coverage: - "*/admin/*.py" - "*/admin.py" - "**/fixtures.py" - - "hct_mis_api/one_time_scripts/*" - - "hct_mis_api/libs/*" - - "hct_mis_api/settings/*" - - "hct_mis_api/settings.py" - - "hct_mis_api/conftest.py" - - "hct_mis_api/config/settings.py" - - "hct_mis_api/apps/core/management/commands/*" - - "hct_mis_api/apps/payment/models/cash_assist.py" + - "src/hct_mis_api/one_time_scripts/*" + - "src/hct_mis_api/libs/*" + - "src/hct_mis_api/settings/*" + - "src/hct_mis_api/settings.py" + - "src/hct_mis_api/conftest.py" + - "src/hct_mis_api/config/settings.py" + - "src/hct_mis_api/apps/core/management/commands/*" + - "src/hct_mis_api/apps/payment/models/cash_assist.py" - "pragma: no cover" - "pragma: no-cover" - "def __repr__" From 4b0ba2536fb449e75713bc82b2220e262518df12 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 17:39:40 +0100 Subject: [PATCH 30/32] coverage --- src/hct_mis_api/apps/household/models.py | 10 ---------- .../apps/payment/models/payment.py | 20 ++++++++++--------- .../apps/payment/models/verification.py | 6 +++--- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/hct_mis_api/apps/household/models.py b/src/hct_mis_api/apps/household/models.py index a24490ff08..087457c24d 100644 --- a/src/hct_mis_api/apps/household/models.py +++ b/src/hct_mis_api/apps/household/models.py @@ -605,16 +605,6 @@ def unwithdraw(self) -> None: self.withdrawn_date = None self.save() - def set_sys_field(self, key: str, value: Any) -> None: - if "sys" not in self.internal_data: - self.internal_data["sys"] = {} - self.internal_data["sys"][key] = value - - def get_sys_field(self, key: str) -> Any: - if "sys" in self.internal_data: - return self.internal_data["sys"][key] - return None - def set_admin_areas(self, new_admin_area: Optional[Area] = None, save: bool = True) -> None: """Propagates admin1,2,3,4 based on admin_area parents""" admins = ["admin1", "admin2", "admin3", "admin4"] diff --git a/src/hct_mis_api/apps/payment/models/payment.py b/src/hct_mis_api/apps/payment/models/payment.py index 491e7a89da..5b20f842c6 100644 --- a/src/hct_mis_api/apps/payment/models/payment.py +++ b/src/hct_mis_api/apps/payment/models/payment.py @@ -69,14 +69,16 @@ ) if TYPE_CHECKING: - from hct_mis_api.apps.account.models import User - from hct_mis_api.apps.core.exchange_rates.api import ExchangeRateClient - from hct_mis_api.apps.grievance.models import GrievanceTicket - from hct_mis_api.apps.payment.models import ( + from hct_mis_api.apps.account.models import User # pragma: no cover + from hct_mis_api.apps.core.exchange_rates.api import ( + ExchangeRateClient, # pragma: no cover + ) + from hct_mis_api.apps.grievance.models import GrievanceTicket # pragma: no cover + from hct_mis_api.apps.payment.models import ( # pragma: no cover AcceptanceProcessThreshold, PaymentVerificationPlan, ) - from hct_mis_api.apps.program.models import Program + from hct_mis_api.apps.program.models import Program # pragma: no cover logger = logging.getLogger(__name__) @@ -1431,7 +1433,7 @@ class Payment( transaction_reference_id = models.CharField(max_length=255, null=True, blank=True) # transaction_id transaction_status_blockchain_link = models.CharField(max_length=255, null=True, blank=True) - def mark_as_failed(self) -> None: + def mark_as_failed(self) -> None: # pragma: no cover if self.status is self.STATUS_FORCE_FAILED: raise ValidationError("Status shouldn't be failed") self.status = self.STATUS_FORCE_FAILED @@ -1440,7 +1442,7 @@ def mark_as_failed(self) -> None: self.delivered_quantity_usd = 0 self.delivery_date = None - def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: datetime) -> None: + def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: datetime) -> None: # pragma: no cover if self.status != self.STATUS_FORCE_FAILED: raise ValidationError("Only payment marked as force failed can be reverted") if self.entitlement_quantity is None: @@ -1452,7 +1454,7 @@ def revert_mark_as_failed(self, delivered_quantity: Decimal, delivery_date: date self.delivery_date = delivery_date @property - def payment_status(self) -> str: + def payment_status(self) -> str: # pragma: no cover status = "-" if self.status == Payment.STATUS_PENDING: status = "Pending" @@ -1527,7 +1529,7 @@ def payment_status(self) -> str: def full_name(self) -> str: return self.collector.full_name - def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: + def get_revert_mark_as_failed_status(self, delivered_quantity: Decimal) -> str: # pragma: no cover if delivered_quantity == 0: return Payment.STATUS_NOT_DISTRIBUTED diff --git a/src/hct_mis_api/apps/payment/models/verification.py b/src/hct_mis_api/apps/payment/models/verification.py index 0a231298bd..38dadc67d3 100644 --- a/src/hct_mis_api/apps/payment/models/verification.py +++ b/src/hct_mis_api/apps/payment/models/verification.py @@ -25,7 +25,7 @@ ) if TYPE_CHECKING: - from hct_mis_api.apps.program.models import Program + from hct_mis_api.apps.program.models import Program # pragma: no cover logger = logging.getLogger(__name__) @@ -125,9 +125,9 @@ def business_area(self) -> BusinessArea: def get_xlsx_verification_file(self) -> FileTemp: try: return FileTemp.objects.get(object_id=self.pk, content_type=get_content_type_for_model(self)) - except FileTemp.DoesNotExist: + except FileTemp.DoesNotExist: # pragma: no cover raise GraphQLError("Xlsx Verification File does not exist.") - except FileTemp.MultipleObjectsReturned as e: + except FileTemp.MultipleObjectsReturned as e: # pragma: no cover logger.exception(e) raise GraphQLError("Query returned multiple Xlsx Verification Files when only one was expected.") From c79d059abacaf2d308965096473e0be4a6b4b65b Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 18:35:53 +0100 Subject: [PATCH 31/32] coverage --- src/hct_mis_api/apps/grievance/filters.py | 2 +- src/hct_mis_api/apps/payment/admin.py | 4 ++-- src/hct_mis_api/apps/payment/api/views.py | 2 +- src/hct_mis_api/apps/payment/models/acceptance.py | 2 +- src/hct_mis_api/apps/payment/mutations.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hct_mis_api/apps/grievance/filters.py b/src/hct_mis_api/apps/grievance/filters.py index c766dd6113..aef3c96a25 100644 --- a/src/hct_mis_api/apps/grievance/filters.py +++ b/src/hct_mis_api/apps/grievance/filters.py @@ -334,7 +334,7 @@ class Meta: order_by = OrderingFilter(fields=("id",)) - def prepare_ticket_filters(self, lookup: str, obj: GrievanceTicket) -> Q: + def prepare_ticket_filters(self, lookup: str, obj: GrievanceTicket) -> Q: # pragma: no cover types_and_lookups = GrievanceTicket.SEARCH_TICKET_TYPES_LOOKUPS q_obj = Q() for ticket_type, lookup_objs in types_and_lookups.items(): diff --git a/src/hct_mis_api/apps/payment/admin.py b/src/hct_mis_api/apps/payment/admin.py index 0bf599b48e..efd4bfc814 100644 --- a/src/hct_mis_api/apps/payment/admin.py +++ b/src/hct_mis_api/apps/payment/admin.py @@ -156,11 +156,11 @@ class PaymentVerificationAdmin(HOPEModelAdminBase): date_hierarchy = "updated_at" raw_id_fields = ("payment_verification_plan", "payment_content_type") - def payment_plan_name(self, obj: PaymentVerification) -> str: + def payment_plan_name(self, obj: PaymentVerification) -> str: # pragma: no cover payment_plan = obj.payment_verification_plan.payment_plan return getattr(payment_plan, "name", "~no name~") - def household(self, obj: PaymentVerification) -> str: + def household(self, obj: PaymentVerification) -> str: # pragma: no cover payment = obj.payment return payment.household.unicef_id if payment else "" diff --git a/src/hct_mis_api/apps/payment/api/views.py b/src/hct_mis_api/apps/payment/api/views.py index 0980188aea..71e753447f 100644 --- a/src/hct_mis_api/apps/payment/api/views.py +++ b/src/hct_mis_api/apps/payment/api/views.py @@ -70,7 +70,7 @@ class PaymentPlanViewSet(BusinessAreaProgramMixin, PaymentPlanMixin, mixins.List PMViewListPermission, ] - def get_queryset(self) -> QuerySet: + def get_queryset(self) -> QuerySet: # pragma: no cover business_area = self.get_business_area() program = self.get_program() return PaymentPlan.objects.filter(business_area=business_area, program_cycle__program=program) diff --git a/src/hct_mis_api/apps/payment/models/acceptance.py b/src/hct_mis_api/apps/payment/models/acceptance.py index bd52a29164..e91ababc7c 100644 --- a/src/hct_mis_api/apps/payment/models/acceptance.py +++ b/src/hct_mis_api/apps/payment/models/acceptance.py @@ -58,7 +58,7 @@ class Meta: ordering = ("-created_at",) def __str__(self) -> str: - return self.type or "" + return self.type or "" # pragma: no cover @property def info(self) -> str: diff --git a/src/hct_mis_api/apps/payment/mutations.py b/src/hct_mis_api/apps/payment/mutations.py index a286b63b9a..c6ceab2dcc 100644 --- a/src/hct_mis_api/apps/payment/mutations.py +++ b/src/hct_mis_api/apps/payment/mutations.py @@ -380,7 +380,7 @@ def mutate( f"You can only update status of payment verification for {PaymentVerificationPlan.STATUS_ACTIVE} cash plan verification" ) delivered_amount = payment_verification.payment.delivered_quantity - if status == PaymentVerification.STATUS_PENDING and received_amount is not None: + if status == PaymentVerification.STATUS_PENDING and received_amount is not None: # pragma: no cover logger.error( f"Wrong status {PaymentVerification.STATUS_PENDING} when received_amount ({received_amount}) is not empty", ) From 3c16fa248bb095c30839cce4395d50d04f8c10a0 Mon Sep 17 00:00:00 2001 From: marekbiczysko Date: Fri, 29 Nov 2024 19:33:21 +0100 Subject: [PATCH 32/32] coverage --- src/hct_mis_api/apps/payment/services/sampling.py | 4 ++-- .../payment/services/verification_plan_crud_services.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hct_mis_api/apps/payment/services/sampling.py b/src/hct_mis_api/apps/payment/services/sampling.py index bb3dbf68a8..ff864601ea 100644 --- a/src/hct_mis_api/apps/payment/services/sampling.py +++ b/src/hct_mis_api/apps/payment/services/sampling.py @@ -11,7 +11,7 @@ from hct_mis_api.apps.payment.utils import get_number_of_samples if TYPE_CHECKING: - from hct_mis_api.apps.payment.models import Payment, PaymentPlan + from hct_mis_api.apps.payment.models import Payment, PaymentPlan # pragma: no cover class Sampling: @@ -81,7 +81,7 @@ def calc_sample_size(self, sample_count: int) -> int: return get_number_of_samples(sample_count, self.confidence_interval, self.margin_of_error) @abc.abstractmethod - def sampling(self, payment_records: QuerySet["Payment"]) -> None: + def sampling(self, payment_records: QuerySet["Payment"]) -> None: # pragma: no cover pass diff --git a/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py b/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py index c55019ef2a..27ce5a6e5b 100644 --- a/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py +++ b/src/hct_mis_api/apps/payment/services/verification_plan_crud_services.py @@ -18,7 +18,7 @@ ) if TYPE_CHECKING: - from hct_mis_api.apps.payment.models import PaymentPlan + from hct_mis_api.apps.payment.models import PaymentPlan # pragma: no cover def get_payment_records(payment_plan: "PaymentPlan", verification_channel: Optional[Any]) -> QuerySet: @@ -55,8 +55,8 @@ def update(cls, payment_verification_plan: PaymentVerificationPlan, input_data: verifier.verify("sampling") verifier.verify("verification_channel") - if payment_verification_plan.status != PaymentVerificationPlan.STATUS_PENDING: - raise GraphQLError("You can only edit PENDING Cash/Payment Plan Verification") + if payment_verification_plan.status != PaymentVerificationPlan.STATUS_PENDING: # pragma: no cover + raise GraphQLError("You can only edit PENDING Payment Plan Verification") payment_records = get_payment_records( payment_verification_plan.payment_plan, payment_verification_plan.verification_channel