diff --git a/Gemfile.lock b/Gemfile.lock index 4286afb0db..df2b4ea007 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -346,7 +346,7 @@ GEM psych (5.1.2) stringio public_suffix (5.0.5) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (2.2.9) diff --git a/app/lib/controlled_work_mappings/civ_means_7_new.yml b/app/lib/controlled_work_mappings/civ_means_7_new.yml new file mode 100644 index 0000000000..c1157ef13d --- /dev/null +++ b/app/lib/controlled_work_mappings/civ_means_7_new.yml @@ -0,0 +1,459 @@ +# This file defines the mappings used to prepopulate a CIVMEANS7 PDF form with the answers given by a user to CCQ's questions +# combined with the output from CFE. + +# The mappings conform to the format described in ControlledWorkDocumentValueMappingService + +- section: general + fields: + # "The client is a child under the age of 18:" + - name: Client is under 18 + type: boolean_radio + source: under_eighteen? + yes_value: "Yes" + no_value: "No" + + - name: Application for controlled legal representation + type: boolean_radio + source: controlled_legal_representation + yes_value: "Yes" + no_value: "No" + + # "The child’s means are to be aggregated with a maintaining adult." + - name: Means to be aggregated with maintaining adult + type: boolean_radio + source: aggregated_means + yes_value: "Yes" + no_value: "No" + + # "Does this child receive any money on a regular basis? Do not include any part-time earnings" + - name: Child receives money + type: boolean_radio + source: regular_income + yes_value: "Yes" + no_value: "No" + + # "Does this child have any savings, items of value or investments totalling £2,500 or more" + - name: Child has savings/items of value/investments totalling £2,500 or more + type: boolean_radio + source: under_eighteen_assets + yes_value: "Yes" + no_value: "No" + + # "The client has a partner whose means are to be aggregated" + - name: Partner + type: boolean_radio + source: partner + yes_value: "Yes" + no_value: "No" + + # "The client's assets (held in sole name or jointly held) have been claimed by the opponent" + - name: Assets claimed by opponent + type: boolean_radio + source: smod_assets? + yes_value: "Yes" + no_value: "No" + +- section: smod_capital + fields: + # Main home / current market value (SMOD) + - name: FillText105 + type: text + source: smod_main_home_value + + # Other property / current market value (SMOD) + - name: FillText107 + type: text + source: smod_additional_properties_value + + # Main home / outstanding mortgage (SMOD) + - name: FillText106 + type: text + source: smod_main_home_outstanding_mortgage + + # Other property / outstanding mortgage (SMOD) + - name: FillText108 + type: text + source: smod_additional_properties_outstanding_mortgage + + # Main home / client's share of property for assessment (SMOD) + - name: FillText21 + type: text + source: smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (SMOD) + - name: FillText23 + type: text + source: smod_additional_properties_percentage_owned + + # Main home / total net equity (SMOD) + - name: FillText102 + type: text + source: smod_main_home_net_value + + # Other property / total net equity (SMOD) + - name: FillText103 + type: text + source: smod_additional_properties_net_value + + # Main home / client's share of total net equity (SMOD) + - name: FillText80 + type: text + source: smod_main_home_net_equity + + # Other property / client's share of total net equity (SMOD) + - name: FillText97 + type: text + source: smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (SMOD) + - name: FillText99 + type: text + source: smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (SMOD) + - name: FillText100 + type: text + source: smod_additional_properties_assessed_equity + + # Savings (SMOD) + - name: FillText24 + type: text + source: smod_savings + + # Investments (SMOD) + - name: FillText25 + type: text + source: smod_investments + + # Valuables (SMOD) + - name: FillText55 + type: text + source: smod_valuables + + # Total capital part A (SMOD) + - name: FillText101 + type: text + source: smod_total_capital + +- section: capital + fields: + # Main home / current market value (non-SMOD) + - name: FillText56 + type: text + source: non_smod_main_home_value + + # Other property / current market value (non-SMOD) + - name: FillText58 + type: text + source: non_smod_additional_properties_value + + # Main home / outstanding mortgage (non-SMOD) + - name: FillText57 + type: text + source: non_smod_main_home_outstanding_mortgage + + # Other property / outstanding mortgage (non-SMOD) + - name: FillText59 + type: text + source: non_smod_additional_properties_mortgage + + # Main home / client's share of property for assessment (non-SMOD) + - name: FillText60 + type: text + source: non_smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (non-SMOD) + - name: FillText62 + type: text + source: non_smod_additional_properties_percentage_owned + + # Main home / total net equity (non-SMOD) + - name: FillText26 + type: text + source: non_smod_main_home_net_value + + # Other property / total net equity (non-SMOD) + - name: FillText261 + type: text + source: non_smod_additional_properties_net_value + + # Main home / client's share of total net equity (non-SMOD) + - name: FillText36 + type: text + source: non_smod_main_home_net_equity + + # Other property / client's share of total net equity (non-SMOD) + - name: FillText40 + type: text + source: non_smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (non-SMOD) + - name: FillText41 + type: text + source: non_smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (non-SMOD) + - name: FillText47 + type: text + source: non_smod_additional_properties_assessed_equity + + # Savings (non-SMOD) + - name: FillText110 + type: text + source: non_smod_client_savings + + # Valuables (non-SMOD) + - name: FillText112 + type: text + source: non_smod_client_valuables + + # Investments (non-SMOD) + - name: FillText111 + type: text + source: non_smod_client_investments + + # Total capital part B (non-SMOD) + - name: FillText118 + type: text + source: combined_non_disputed_capital + + # Total of all capital assets (Part A and Part B) + - name: FillText119 + type: text + source: combined_assessed_capital + +- section: partner_capital + fields: + + # Partner savings (non-SMOD) + - name: FillText114 + type: text + source: partner_savings + + # Partner investments (non-SMOD) + - name: FillText115 + type: text + source: partner_investments + + # Partner valuables (non-SMOD) + - name: FillText116 + type: text + source: partner_valuables + +- section: income_even_if_passported + fields: + # The client is directly or indirectly in receipt of [passporting benefit] + - name: Passported + type: boolean_radio + source: passporting + yes_value: "Yes" + no_value: "No" + +- section: income + fields: + # Gross monthly earnings / Client + - name: FillText82 + type: text + source: client_gross_income + + # Benefits & Tax Credits / Client + - name: benefits_client + type: text + source: client_benefits + + # Maintenance from former partner / Client + - name: maintenance_client + type: text + source: client_maintenance + + # Pensions / Client + - name: pensions_client + type: text + source: client_pensions + + # Student Finance / Client + - name: studentfinance_client + type: text + source: client_student_finance + + # Family or Friends / Client + - name: friendsandfamily_client + type: text + source: client_friends_and_family + + # Property or Lodger / Client + - name: property_client + type: text + source: client_property_lodger_income + + # Other Income / Client + - name: otherincome_client + type: text + source: client_other_income + + # Benefits & Tax Credits / Partner + - name: benefits_partner + type: text + source: partner_benefits + + # Maintenance from former partner / Partner + - name: maintenance_partner + type: text + source: partner_maintenance + + # Pensions / Partner + - name: pensions_partner + type: text + source: partner_pensions + + # Student Finance / Partner + - name: studentfinance_partner + type: text + source: partner_student_finance + + # Family or Friends / Partner + - name: friendsandfamily_partner + type: text + source: partner_friends_and_family + + # Property or Lodger / Partner + - name: property_partner + type: text + source: partner_property_lodger_income + + # Other Income / Partner + - name: otherincome_partner + type: text + source: partner_other_income + + # Total gross income / Client + - name: FillText86 + type: text + source: client_total_income + + # Total gross income Client and Partner + - name: FillText98 + type: text + source: total_combined_income + + # Mortgage instalment / Client + - name: FillText5 + type: text + source: client_mortgage + + # Rent / Client + - name: FillText7 + type: text + source: client_rent + + # Dependents' allowances / Partner + - name: FillText11 + type: text + source: partner_allowance + + # Dependents' allowances / Aged 15 or under + - name: FillText12 + type: text + source: dependants_allowance_under_16 + + # Dependents' allowances / Aged 16 or over + - name: FillText13 + type: text + source: dependants_allowance_over_16 + + # Tax and national insurance / Client + - name: FillText14 + type: text + source: client_tax_and_national_insurance + + # Standard allowance for employment expense / Client + - name: FillText16 + type: text + source: client_employment_deduction + + # Maintenance allowance / Client + - name: FillText18 + type: text + source: client_maintenance_allowance + + # Childcare costs + - name: FillText27 + type: text + source: combined_childcare_costs + + # Payment of income contribution order / Client + - name: FillText28 + type: text + source: client_legal_aid_contribution + + # Total allowances / Client + - name: FillText30 + type: text + source: client_total_allowances + + # Total monthly disposable income / Client + - name: FillText32 + type: text + source: client_disposable_income + + # Total monthly disposable income Client and partner + - name: FillText34 + type: text + source: combined_disposable_income + +- section: partner_income + fields: + # Gross monthly earnings / Partner + - name: FillText83 + type: text + source: partner_gross_income + + # Other income / Partner + - name: FillText85 + type: text + source: partner_non_employment_income + + # Total gross income / Partner + - name: FillText94 + type: text + source: partner_total_income + + # Mortgage instalment / Partner + - name: FillText6 + type: text + source: partner_mortgage + + # Rent / Partner + - name: FillText10 + type: text + source: partner_rent + + # Tax and national insurance / Partner + - name: FillText15 + type: text + source: partner_tax_and_national_insurance + + # Standard allowance for employment expense / Partner + - name: FillText17 + type: text + source: partner_employment_deduction + + # Maintenance allowance / Partner + - name: FillText22 + type: text + source: partner_maintenance_allowance + + # Payment of income contribution order / Partner + - name: FillText29 + type: text + source: partner_legal_aid_contribution + + # Total allowances / Partner + - name: FillText31 + type: text + source: partner_total_allowances + + # Total monthly disposable income / Partner + - name: FillText33 + type: text + source: partner_disposable_income diff --git a/app/lib/controlled_work_mappings/civ_means_7_welsh_new.yml b/app/lib/controlled_work_mappings/civ_means_7_welsh_new.yml new file mode 100644 index 0000000000..0f6bf844a9 --- /dev/null +++ b/app/lib/controlled_work_mappings/civ_means_7_welsh_new.yml @@ -0,0 +1,448 @@ +# This file defines the mappings used to prepopulate a Welsh CIVMEANS7 PDF form with the answers given by a user to CCQ's questions +# combined with the output from CFE. + +# The mappings conform to the format described in ControlledWorkDocumentValueMappingService + +- section: general + fields: + # "The client has a partner whose means are to be aggregated" + - name: Partner + type: boolean_radio + source: partner + yes_value: "Ie" + no_value: "Na" + + # "The client's assets (held in sole name or jointly held) have been claimed by the opponent" + - name: Client's assets claimed by opponent + type: boolean_radio + source: smod_assets? + yes_value: "Ydy" + no_value: "Nac ydy" + + - name: Child under 18 + type: boolean_radio + source: under_eighteen? + yes_value: Ydy + no_value: Nac ydy + + - name: Means aggregated + type: boolean_radio + source: aggregated_means + yes_value: Ydy + no_value: Nac ydy + + - name: Child receives regular money + type: boolean_radio + source: regular_income + yes_value: Ydy + no_value: Nac ydy + + - name: Child has savings, items of value or investments totalling £2,500 or more + type: boolean_radio + source: under_eighteen_assets + yes_value: Oes + no_value: Nac oes + +- section: smod_capital + fields: + # Main home / current market value (SMOD) + - name: FillText128 + type: text + source: smod_main_home_value + + # Other property / current market value (SMOD) + - name: FillText130 + type: text + source: smod_additional_properties_value + + # Main home / outstanding mortgage (SMOD) + - name: FillText129 + type: text + source: smod_main_home_outstanding_mortgage + + # Other property / outstanding mortgage (SMOD) + - name: FillText131 + type: text + source: smod_additional_properties_outstanding_mortgage + + # Main home / client's share of property for assessment (SMOD) + - name: FillText16 + type: text + source: smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (SMOD) + - name: FillText23 + type: text + source: smod_additional_properties_percentage_owned + + # Main home / total net equity (SMOD) + - name: FillText134 + type: text + source: smod_main_home_net_value + + # Other property / total net equity (SMOD) + - name: FillText135 + type: text + source: smod_additional_properties_net_value + + # Main home / client's share of total net equity (SMOD) + - name: FillText80 + type: text + source: smod_main_home_net_equity + + # Other property / client's share of total net equity (SMOD) + - name: FillText132 + type: text + source: smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (SMOD) + - name: FillText99 + type: text + source: smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (SMOD) + - name: FillText100 + type: text + source: smod_additional_properties_assessed_equity + + # Savings (SMOD) + - name: FillText24 + type: text + source: smod_savings + + # Investments (SMOD) + - name: FillText25 + type: text + source: smod_investments + + # Valuables (SMOD) + - name: FillText55 + type: text + source: smod_valuables + + # Total capital part A (SMOD) + - name: FillText133 + type: text + source: smod_total_capital + +- section: capital + fields: + # Main home / current market value (non-SMOD) + - name: FillText21 + type: text + source: non_smod_main_home_value + + # Other property / current market value (non-SMOD) + - name: FillText26 + type: text + source: non_smod_additional_properties_value + + # Main home / outstanding mortgage (non-SMOD) + - name: FillText22 + type: text + source: non_smod_main_home_outstanding_mortgage + + # Other property / outstanding mortgage (non-SMOD) + - name: FillText27 + type: text + source: non_smod_additional_properties_mortgage + + # Main home / client's share of property for assessment (non-SMOD) + - name: FillText28 + type: text + source: non_smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (non-SMOD) + - name: FillText29 + type: text + source: non_smod_additional_properties_percentage_owned + + # Main home / total net equity (non-SMOD) + - name: FillText32 + type: text + source: non_smod_main_home_net_value + + # Other property / total net equity (non-SMOD) + - name: FillText33 + type: text + source: non_smod_additional_properties_net_value + + # Main home / client's share of total net equity (non-SMOD) + - name: FillText30 + type: text + source: non_smod_main_home_net_equity + + # Other property / client's share of total net equity (non-SMOD) + - name: FillText31 + type: text + source: non_smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (non-SMOD) + - name: FillText34 + type: text + source: non_smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (non-SMOD) + - name: FillText35 + type: text + source: non_smod_additional_properties_assessed_equity + + # Savings (non-SMOD) + - name: FillText148 + type: text + source: non_smod_client_savings + + # Valuables (non-SMOD) + - name: FillText112 + type: text + source: non_smod_client_valuables + + # Investments (non-SMOD) + - name: FillText111 + type: text + source: non_smod_client_investments + + # Total capital part B (non-SMOD) + - name: FillText118 + type: text + source: combined_non_disputed_capital + + # Total of all capital assets (Part A and Part B) + - name: FillText149 + type: text + source: combined_assessed_capital + +- section: partner_capital + fields: + # Partner savings (non-SMOD) + - name: FillText114 + type: text + source: partner_savings + + # Partner investments (non-SMOD) + - name: FillText115 + type: text + source: partner_investments + + # Partner valuables (non-SMOD) + - name: FillText116 + type: text + source: partner_valuables + +- section: income_even_if_passported + fields: + # The client is directly or indirectly in receipt of [passporting benefit] + - name: Passported + type: boolean_radio + source: passporting + yes_value: "Ydy" + no_value: "Nac ydy" + +- section: income + fields: + # Gross monthly earnings / Client + - name: FillText42 + type: text + source: client_gross_income + + # Benefits & Tax Credits / Client + - name: benefits_client + type: text + source: client_benefits + + # Maintenance from former partner / Client + - name: maintenance_client + type: text + source: client_maintenance + + # Pensions / Client + - name: pensions_client + type: text + source: client_pensions + + # Student Finance / Client + - name: studentfinance_client + type: text + source: client_student_finance + + # Family or Friends / Client + - name: friendsandfamily_client + type: text + source: client_friends_and_family + + # Property or Lodger / Client + - name: property_client + type: text + source: client_property_lodger_income + + # Other Income / Client + - name: otherincome_client + type: text + source: client_other_income + + # Benefits & Tax Credits / Partner + - name: benefits_partner + type: text + source: partner_benefits + + # Maintenance from former partner / Partner + - name: maintenance_partner + type: text + source: partner_maintenance + + # Pensions / Partner + - name: pensions_partner + type: text + source: partner_pensions + + # Student Finance / Partner + - name: studentfinance_partner + type: text + source: partner_student_finance + + # Family or Friends / Partner + - name: friendsandfamily_partner + type: text + source: partner_friends_and_family + + # Property or Lodger / Partner + - name: property_partner + type: text + source: partner_property_lodger_income + + # Other Income / Partner + - name: otherincome_partner + type: text + source: partner_other_income + + # Total gross income / Client + - name: FillText46 + type: text + source: client_total_income + + # Total gross income Client and Partner + - name: FillText52 + type: text + source: total_combined_income + + # Mortgage instalment / Client + - name: FillText53 + type: text + source: client_mortgage + + # Rent / Client + - name: FillText56 + type: text + source: client_rent + + # Dependents' allowances / Partner + - name: FillText58 + type: text + source: partner_allowance + + # Dependents' allowances / Aged 15 or under + - name: FillText59 + type: text + source: dependants_allowance_under_16 + + # Dependents' allowances / Aged 16 or over + - name: FillText60 + type: text + source: dependants_allowance_over_16 + + # Tax and national insurance / Client + - name: FillText71 + type: text + source: client_tax_and_national_insurance + + # Standard allowance for employment expense / Client + - name: FillText61 + type: text + source: client_employment_deduction + + # Maintenance allowance / Client + - name: FillText63 + type: text + source: client_maintenance_allowance + + # Childcare costs + - name: FillText65 + type: text + source: combined_childcare_costs + + # Payment of income contribution order / Client + - name: FillText74 + type: text + source: client_legal_aid_contribution + + # Total allowances / Client + - name: FillText66 + type: text + source: client_total_allowances + + # Total monthly disposable income / Client + - name: FillText69 + type: text + source: client_disposable_income + + # Total monthly disposable income Client and partner + - name: FillText73 + type: text + source: combined_disposable_income + +- section: partner_income + fields: + # Gross monthly earnings / Partner + - name: FillText43 + type: text + source: partner_gross_income + + # Other income / Partner + - name: FillText45 + type: text + source: partner_non_employment_income + + # Total gross income / Partner + - name: FillText51 + type: text + source: partner_total_income + + # Mortgage instalment / Partner + - name: FillText54 + type: text + source: partner_mortgage + + # Rent / Partner + - name: FillText57 + type: text + source: partner_rent + + # Tax and national insurance / Partner + - name: FillText72 + type: text + source: partner_tax_and_national_insurance + + # Standard allowance for employment expense / Partner + - name: FillText62 + type: text + source: partner_employment_deduction + + # Maintenance allowance / Partner + - name: FillText64 + type: text + source: partner_maintenance_allowance + + # Payment of income contribution order / Partner + - name: FillText75 + type: text + source: partner_legal_aid_contribution + + # Total allowances / Partner + - name: FillText68 + type: text + source: partner_total_allowances + + # Total monthly disposable income / Partner + - name: FillText70 + type: text + source: partner_disposable_income diff --git a/app/lib/controlled_work_mappings/cw1_new.yml b/app/lib/controlled_work_mappings/cw1_new.yml new file mode 100644 index 0000000000..b9196a66c3 --- /dev/null +++ b/app/lib/controlled_work_mappings/cw1_new.yml @@ -0,0 +1,466 @@ +# This file defines the mappings used to prepopulate a CW1 PDF form with the answers given by a user to CCQ's questions +# combined with the output from CFE. + +# The mappings conform to the format described in ControlledWorkDocumentValueMappingService +- section: general + fields: + # "Means test required" + - name: Means test required + type: always_checked_checkbox + checked_value: "Yes_2" + + # "The client is a child under the age of 18:" + - name: Child under 18 + type: boolean_radio + source: under_eighteen? + yes_value: "Yes_2" + no_value: "No" + + # "The child’s means are to be aggregated with a maintaining adult." + - name: Means to be aggregated with maintainng adult + type: boolean_radio + source: aggregated_means + yes_value: "Yes" + no_value: "No" + + # "Does this child receive any money on a regular basis? Do not include any part-time earnings" + - name: Child receives money + type: boolean_radio + source: regular_income + yes_value: "Yes" + no_value: "No" + + # "Does this child have any savings, items of value or investments totalling £2,500 or more" + - name: Child has savings/capital + type: boolean_radio + source: under_eighteen_assets + yes_value: "Yes_2" + no_value: "No" + + # "The client is directly or indirectly in receipt of S.4 or S.95 Asylum Support (Immigration and Asylum category work only):" + - name: Client in receipt of asylum support + type: boolean_radio + source: asylum_support? + yes_value: "Yes_2" + no_value: "No" + + # "The client has a partner whose means are to be aggregated:" + - name: Has partner whose means are to be agrgregated + type: boolean_radio + source: aggregate_partner? + yes_value: "Yes_3" + no_value: "No_2" + + # "The client's assets (held in sole name or jointly held) have been claimed by the opponent:" + - name: Please complete Part A Capital Subject matter of dispute + type: boolean_radio + source: smod_assets? + yes_value: "Yes_5" + no_value: "No_4" + +- section: smod_capital + fields: + # Part A + # Main home / current market value (SMOD) + - name: undefined_10 + type: text + source: smod_main_home_value + + # Main home / outstanding mortgage (SMOD) + - name: undefined_11 + type: text + source: smod_main_home_outstanding_mortgage + + # Other property / current market value (SMOD) + - name: Other property 1 + type: text + source: smod_additional_properties_value + + # Other property / outstanding mortgage (SMOD) + - name: Other property 2 + type: text + source: smod_additional_properties_outstanding_mortgage + + # Main home / client's share of property for assessment (SMOD) + - name: undefined_14 + type: text + source: smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (SMOD) + - name: undefined_15 + type: text + source: smod_additional_properties_percentage_owned + + # Main home / total net equity (SMOD) + - name: undefined_16 + type: text + source: smod_main_home_net_value + + # Other property / total net equity (SMOD) + - name: Other property + type: text + source: smod_additional_properties_net_value + + # Main home / client's share of total net equity (SMOD) + - name: undefined_17 + type: text + source: smod_main_home_net_equity + + # Other property / client's share of total net equity (SMOD) + - name: undefined_18 + type: text + source: smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (SMOD) + - name: undefined_19 + type: text + source: smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (SMOD) + - name: undefined_20 + type: text + source: smod_additional_properties_assessed_equity + + # Savings (SMOD) + - name: undefined_21 + type: text + source: smod_savings + + # Investments (SMOD) + - name: undefined_22 + type: text + source: smod_investments + + # Valuables (SMOD) + - name: undefined_23 + type: text + source: smod_valuables + + # Total capital part A (SMOD) + - name: undefined_25 + type: text + source: smod_total_capital + +- section: capital + fields: + # Part B + # Main home / current market value (non-SMOD) + - name: undefined_26 + type: text + source: non_smod_main_home_value + + # Main home / outstanding mortgage (non-SMOD) + - name: undefined_27 + type: text + source: non_smod_main_home_outstanding_mortgage + + # Other property / current market value (non-SMOD) + - name: Other property 1_2 + type: text + source: non_smod_additional_properties_value + + # Other property / outstanding mortgage (non-SMOD) + - name: Other property 2_2 + type: text + source: non_smod_additional_properties_mortgage + + # Main home / client's share of property for assessment (non-SMOD) + - name: undefined_30 + type: text + source: non_smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (non-SMOD) + - name: undefined_31 + type: text + source: non_smod_additional_properties_percentage_owned + + # Main home / total net equity (non-SMOD) + - name: undefined_32 + type: text + source: non_smod_main_home_net_value + + # Other property / total net equity (non-SMOD) + - name: undefined_33 + type: text + source: non_smod_additional_properties_net_value + + # Main home / client's share of total net equity (non-SMOD) + - name: undefined_34 + type: text + source: non_smod_main_home_net_equity + + # Other property / client's share of total net equity (non-SMOD) + - name: undefined_35 + type: text + source: non_smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (non-SMOD) + - name: undefined_36 + type: text + source: non_smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (non-SMOD) + - name: undefined_37 + type: text + source: non_smod_additional_properties_assessed_equity + + # Savings (non-SMOD) + - name: undefined_38 + type: text + source: non_smod_client_savings + + # Investments (non-SMOD) + - name: undefined_40 + type: text + source: non_smod_client_investments + + # Valuables (non-SMOD) + - name: undefined_42 + type: text + source: non_smod_client_valuables + + # Total capital part A (non-SMOD) + - name: undefined_46 + type: text + source: combined_non_disputed_capital + + # Total of all capital assets (Part A and Part B) + - name: undefined_47 + type: text + source: combined_assessed_capital + +- section: partner_capital + fields: + # Partner savings (non-SMOD) + - name: undefined_39 + type: text + source: partner_savings + + # Partner investments (non-SMOD) + - name: undefined_41 + type: text + source: partner_investments + + # Partner valuables (non-SMOD) + - name: undefined_43 + type: text + source: partner_valuables + +- section: income_even_if_passported + fields: + # Part C + # The client is directly or indirectly in receipt of [passporting benefit] + - name: Passported + type: boolean_radio + source: passporting + section: income_even_if_passported + yes_value: "Yes" + no_value: "No" + +- section: income + fields: + + # Gross monthly earnings / Client + - name: undefined_48 + type: text + source: client_gross_income + + # Benefits & Tax Credits / Client + - name: benefits_client + type: text + source: client_benefits + + # Maintenance from former partner / Client + - name: maintenance_client + type: text + source: client_maintenance + + # Pensions / Client + - name: pensions_client + type: text + source: client_pensions + + # Student Finance / Client + - name: studentfinance_client + type: text + source: client_student_finance + + # Family or Friends / Client + - name: friendsandfamily_client + type: text + source: client_friends_and_family + + # Property or Lodger / Client + - name: property_client + type: text + source: client_property_lodger_income + + # Other Income / Client + - name: otherincome_client + type: text + source: client_other_income + + # Benefits & Tax Credits / Partner + - name: benefits_partner + type: text + source: partner_benefits + + # Maintenance from former partner / Partner + - name: maintenance_partner + type: text + source: partner_maintenance + + # Pensions / Partner + - name: pensions_partner + type: text + source: partner_pensions + + # Student Finance / Partner + - name: studentfinance_partner + type: text + source: partner_student_finance + + # Family or Friends / Partner + - name: friendsandfamily_partner + type: text + source: partner_friends_and_family + + # Property or Lodger / Partner + - name: property_partner + type: text + source: partner_property_lodger_income + + # Other Income / Partner + - name: otherincome_partner + type: text + source: partner_other_income + + # Total gross income / Client + - name: undefined_52 + type: text + source: client_total_income + + # Total gross income Client and Partner + - name: undefined_54 + type: text + section: partner_income + source: total_combined_income + + # Mortgage instalment / Client + - name: undefined_55 + type: text + source: client_mortgage + + # Rent / Client + - name: undefined_57 + type: text + source: client_rent + + # Dependents' allowances / Partner + - name: undefined_59 + type: text + source: partner_allowance + + # Dependents' allowances / Aged 15 or under + - name: undefined_60 + type: text + source: dependants_allowance_under_16 + + # Dependents' allowances / Aged 16 or over + - name: undefined_61 + type: text + source: dependants_allowance_over_16 + + # Tax and national insurance / Client + - name: undefined_62 + type: text + source: client_tax_and_national_insurance + + # Standard allowance for employment expense / Client + - name: undefined_64 + type: text + source: client_employment_deduction + + # Maintenance allowance / Client + - name: undefined_66 + type: text + source: client_maintenance_allowance + + # Childcare costs + - name: undefined_68 + type: text + source: combined_childcare_costs + + # Payment of income contribution order / Client + - name: undefined_69 + type: text + source: client_legal_aid_contribution + + # Total allowances / Client + - name: undefined_71 + type: text + source: client_total_allowances + + # Total monthly disposable income / Client + - name: undefined_73 + type: text + source: client_disposable_income + + # Total monthly disposable income Client and partner + - name: undefined_75 + type: text + source: combined_disposable_income + + +- section: partner_income + fields: + + # Gross monthly earnings / Partner + - name: undefined_49 + type: text + source: partner_gross_income + + # Total gross income / Partner + - name: undefined_53 + type: text + source: partner_total_income + + # Mortgage instalment / Partner + - name: undefined_56 + type: text + source: partner_mortgage + + # Rent / Partner + - name: undefined_58 + type: text + source: partner_rent + + # Tax and national insurance / Partner + - name: undefined_63 + type: text + source: partner_tax_and_national_insurance + + # Standard allowance for employment expense / Partner + - name: undefined_65 + type: text + source: partner_employment_deduction + + # Maintenance allowance / Partner + - name: undefined_67 + type: text + source: partner_maintenance_allowance + + # Payment of income contribution order / Partner + - name: undefined_70 + type: text + source: partner_legal_aid_contribution + + # Total allowances / Partner + - name: undefined_72 + type: text + source: partner_total_allowances + + # Total monthly disposable income / Partner + - name: undefined_74 + type: text + source: partner_disposable_income diff --git a/app/lib/controlled_work_mappings/cw1_welsh_new.yml b/app/lib/controlled_work_mappings/cw1_welsh_new.yml new file mode 100644 index 0000000000..34fb06566c --- /dev/null +++ b/app/lib/controlled_work_mappings/cw1_welsh_new.yml @@ -0,0 +1,462 @@ +# This file defines the mappings used to prepopulate a Welsh CW1 PDF form with the answers given by a user to CCQ's questions +# combined with the output from CFE. + +# The mappings conform to the format described in ControlledWorkDocumentValueMappingService +- section: general + fields: + # "Means test required" + - name: Matter type + type: always_checked_checkbox + checked_value: "Means test required" + + # "The client is directly or indirectly in receipt of S.4 or S.95 Asylum Support (Immigration and Asylum category work only):" + - name: Asylum support + type: boolean_radio + source: asylum_support? + yes_value: "Ydyw" + no_value: "Nac ydyw" + + # "The client has a partner whose means are to be aggregated:" + - name: Partner + type: boolean_radio + source: aggregate_partner? + yes_value: "Ie" + no_value: "Na" + + # "The client's assets (held in sole name or jointly held) have been claimed by the opponent:" + - name: Client's assets claimed by opponent + type: boolean_radio + source: smod_assets? + yes_value: "Ydy" + no_value: "Nac ydy" + + - name: Under 18 + type: boolean_radio + source: under_eighteen? + yes_value: Ydy + no_value: Nac ydy + + - name: Child's means to be aggregated with an adult + type: boolean_radio + source: aggregated_means + yes_value: Ydy + no_value: Nac ydy + + - name: Child receives regular money + type: boolean_radio + source: regular_income + yes_value: Ydy + no_value: Nac ydy + + - name: Child has savings, items of value or investments totalling £2,500 or more + type: boolean_radio + source: under_eighteen_assets + yes_value: Oes + no_value: Nac oes + +- section: smod_capital + fields: + # Part A + # Main home / current market value (SMOD) + - name: FillText128 + type: text + source: smod_main_home_value + + # Main home / outstanding mortgage (SMOD) + - name: FillText129 + type: text + source: smod_main_home_outstanding_mortgage + + # Other property / current market value (SMOD) + - name: FillText130 + type: text + source: smod_additional_properties_value + + # Other property / outstanding mortgage (SMOD) + - name: FillText131 + type: text + source: smod_additional_properties_outstanding_mortgage + + # Main home / client's share of property for assessment (SMOD) + - name: FillText16 + type: text + source: smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (SMOD) + - name: FillText23 + type: text + source: smod_additional_properties_percentage_owned + + # Main home / total net equity (SMOD) + - name: FillText134 + type: text + source: smod_main_home_net_value + + # Other property / total net equity (SMOD) + - name: FillText135 + type: text + source: smod_additional_properties_net_value + + # Main home / client's share of total net equity (SMOD) + - name: FillText80 + type: text + source: smod_main_home_net_equity + + # Other property / client's share of total net equity (SMOD) + - name: FillText132 + type: text + source: smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (SMOD) + - name: FillText99 + type: text + source: smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (SMOD) + - name: FillText100 + type: text + source: smod_additional_properties_assessed_equity + + # Savings (SMOD) + - name: FillText24 + type: text + source: smod_savings + + # Investments (SMOD) + - name: FillText25 + type: text + source: smod_investments + + # Valuables (SMOD) + - name: FillText55 + type: text + source: smod_valuables + + # Total capital part A (SMOD) + - name: FillText133 + type: text + source: smod_total_capital + +- section: capital + fields: + # Part B + # Main home / current market value (non-SMOD) + - name: FillText136 + type: text + source: non_smod_main_home_value + + # Main home / outstanding mortgage (non-SMOD) + - name: FillText137 + type: text + source: non_smod_main_home_outstanding_mortgage + + # Other property / current market value (non-SMOD) + - name: FillText138 + type: text + source: non_smod_additional_properties_value + + # Other property / outstanding mortgage (non-SMOD) + - name: FillText139 + type: text + source: non_smod_additional_properties_mortgage + + # Main home / client's share of property for assessment (non-SMOD) + - name: FillText140 + type: text + source: non_smod_main_home_percentage_owned + + # Other property / client's share of property for assessment (non-SMOD) + - name: FillText141 + type: text + source: non_smod_additional_properties_percentage_owned + + # Main home / total net equity (non-SMOD) + - name: FillText144 + type: text + source: non_smod_main_home_net_value + + # Other property / total net equity (non-SMOD) + - name: FillText145 + type: text + source: non_smod_additional_properties_net_value + + # Main home / client's share of total net equity (non-SMOD) + - name: FillText142 + type: text + source: non_smod_main_home_net_equity + + # Other property / client's share of total net equity (non-SMOD) + - name: FillText143 + type: text + source: non_smod_additional_properties_net_equity + + # Main home / final assessed amount of client's equity (non-SMOD) + - name: FillText146 + type: text + source: non_smod_main_home_assessed_equity + + # Other property / final assessed amount of client's equity (non-SMOD) + - name: FillText147 + type: text + source: non_smod_additional_properties_assessed_equity + + # Savings (non-SMOD) + - name: FillText148 + type: text + source: non_smod_client_savings + + # Investments (non-SMOD) + - name: FillText111 + type: text + source: non_smod_client_investments + + # Valuables (non-SMOD) + - name: FillText112 + type: text + source: non_smod_client_valuables + + # Total capital part A (non-SMOD) + - name: FillText118 + type: text + source: combined_non_disputed_capital + + # Total of all capital assets (Part A and Part B) + - name: FillText149 + type: text + source: combined_assessed_capital + +- section: partner_capital + fields: + # Partner savings (non-SMOD) + - name: FillText114 + type: text + source: partner_savings + + # Partner investments (non-SMOD) + - name: FillText115 + type: text + source: partner_investments + + # Partner valuables (non-SMOD) + - name: FillText116 + type: text + source: partner_valuables + +- section: income_even_if_passported + fields: + # Part C + # The client is directly or indirectly in receipt of [passporting benefit] + - name: Passported + type: boolean_radio + source: passporting + section: income_even_if_passported + yes_value: "Ydy" + no_value: "Nac ydy" + +- section: income + fields: + + # Gross monthly earnings / Client + - name: FillText150 + type: text + source: client_gross_income + + # Benefits & Tax Credits / Client + - name: benefits_client + type: text + source: client_benefits + + # Maintenance from former partner / Client + - name: maintenance_client + type: text + source: client_maintenance + + # Pensions / Client + - name: pensions_client + type: text + source: client_pensions + + # Student Finance / Client + - name: studentfinance_client + type: text + source: client_student_finance + + # Family or Friends / Client + - name: friendsandfamily_client + type: text + source: client_friends_and_family + + # Property or Lodger / Client + - name: property_client + type: text + source: client_property_lodger_income + + # Other Income / Client + - name: otherincome_client + type: text + source: client_other_income + + # Benefits & Tax Credits / Partner + - name: benefits_partner + type: text + source: partner_benefits + + # Maintenance from former partner / Partner + - name: maintenance_partner + type: text + source: partner_maintenance + + # Pensions / Partner + - name: pensions_partner + type: text + source: partner_pensions + + # Student Finance / Partner + - name: studentfinance_partner + type: text + source: partner_student_finance + + # Family or Friends / Partner + - name: friendsandfamily_partner + type: text + source: partner_friends_and_family + + # Property or Lodger / Partner + - name: property_partner + type: text + source: partner_property_lodger_income + + # Other Income / Partner + - name: otherincome_partner + type: text + source: partner_other_income + + # Total gross income / Client + - name: FillText154 + type: text + source: client_total_income + + # Total gross income Client and Partner + - name: FillText164 + type: text + section: partner_income + source: total_combined_income + + # Mortgage instalment / Client + - name: FillText2 + type: text + source: client_mortgage + + # Rent / Client + - name: FillText6 + type: text + source: client_rent + + # Dependents' allowances / Partner + - name: FillText9 + type: text + source: partner_allowance + + # Dependents' allowances / Aged 15 or under + - name: FillText10 + type: text + source: dependants_allowance_under_16 + + # Dependents' allowances / Aged 16 or over + - name: FillText11 + type: text + source: dependants_allowance_over_16 + + # Tax and national insurance / Client + - name: FillText22 + type: text + source: client_tax_and_national_insurance + + # Standard allowance for employment expense / Client + - name: FillText12 + type: text + source: client_employment_deduction + + # Maintenance allowance / Client + - name: FillText14 + type: text + source: client_maintenance_allowance + + # Childcare costs + - name: FillText17 + type: text + source: combined_childcare_costs + + # Payment of income contribution order / Client + - name: FillText32 + type: text + source: client_legal_aid_contribution + + # Total allowances / Client + - name: FillText18 + type: text + source: client_total_allowances + + # Total monthly disposable income / Client + - name: FillText20 + type: text + source: client_disposable_income + + # Total monthly disposable income Client and partner + - name: FillText31 + type: text + source: combined_disposable_income + + +- section: partner_income + fields: + + # Gross monthly earnings / Partner + - name: FillText151 + type: text + source: partner_gross_income + + # Total gross income / Partner + - name: FillText163 + type: text + source: partner_total_income + + # Mortgage instalment / Partner + - name: FillText5 + type: text + source: partner_mortgage + + # Rent / Partner + - name: FillText7 + type: text + source: partner_rent + + # Tax and national insurance / Partner + - name: FillText26 + type: text + source: partner_tax_and_national_insurance + + # Standard allowance for employment expense / Partner + - name: FillText13 + type: text + source: partner_employment_deduction + + # Maintenance allowance / Partner + - name: FillText15 + type: text + source: partner_maintenance_allowance + + # Payment of income contribution order / Partner + - name: FillText33 + type: text + source: partner_legal_aid_contribution + + # Total allowances / Partner + - name: FillText19 + type: text + source: partner_total_allowances + + # Total monthly disposable income / Partner + - name: FillText21 + type: text + source: partner_disposable_income diff --git a/app/models/concerns/income_summarisable.rb b/app/models/concerns/income_summarisable.rb index c420a28c04..26b3459013 100644 --- a/app/models/concerns/income_summarisable.rb +++ b/app/models/concerns/income_summarisable.rb @@ -39,6 +39,62 @@ def combined_disposable_income from_cfe_payload("result_summary.disposable_income.combined_total_disposable_income") end + def client_benefits + from_cfe_payload("assessment.gross_income.state_benefits.monthly_equivalents.all_sources") + end + + def client_maintenance + from_cfe_payload("assessment.gross_income.other_income.monthly_equivalents.all_sources.maintenance_in") + end + + def client_pensions + from_cfe_payload("assessment.gross_income.other_income.monthly_equivalents.all_sources.pension") + end + + def client_student_finance + from_cfe_payload("assessment.gross_income.irregular_income.monthly_equivalents.student_loan") + end + + def client_friends_and_family + from_cfe_payload("assessment.gross_income.other_income.monthly_equivalents.all_sources.friends_or_family") + end + + def client_property_lodger_income + from_cfe_payload("assessment.gross_income.other_income.monthly_equivalents.all_sources.property_or_lodger") + end + + def client_other_income + from_cfe_payload("assessment.gross_income.irregular_income.monthly_equivalents.unspecified_source") + end + + def partner_benefits + from_cfe_payload("assessment.partner_gross_income.state_benefits.monthly_equivalents.all_sources") + end + + def partner_maintenance + from_cfe_payload("assessment.partner_gross_income.other_income.monthly_equivalents.all_sources.maintenance_in") + end + + def partner_pensions + from_cfe_payload("assessment.partner_gross_income.other_income.monthly_equivalents.all_sources.pension") + end + + def partner_student_finance + from_cfe_payload("assessment.partner_gross_income.irregular_income.monthly_equivalents.student_loan") + end + + def partner_friends_and_family + from_cfe_payload("assessment.partner_gross_income.other_income.monthly_equivalents.all_sources.friends_or_family") + end + + def partner_property_lodger_income + from_cfe_payload("assessment.partner_gross_income.other_income.monthly_equivalents.all_sources.property_or_lodger") + end + + def partner_other_income + from_cfe_payload("assessment.partner_gross_income.irregular_income.monthly_equivalents.unspecified_source") + end + private def employment_income(prefix = "") diff --git a/app/services/controlled_work_document_population_service.rb b/app/services/controlled_work_document_population_service.rb index 8df56f373b..bc054e87cb 100644 --- a/app/services/controlled_work_document_population_service.rb +++ b/app/services/controlled_work_document_population_service.rb @@ -10,7 +10,10 @@ class ControlledWorkDocumentPopulationService class << self def call(session_data, model) Dir.mktmpdir do |dir| - form_key = "#{model.form_type}#{'_welsh' if model.language == 'welsh'}" + # Commenting this out until all the new CW forms are updated then this will be reinstated + # form_key = "#{model.form_type}#{'_welsh' if model.language == 'welsh'}" + # We will use the method below to add _new suffix + form_key = generate_form_key(model) file_name = "#{dir}/output-form.pdf" pdftk = PdfForms.new(`which pdftk`.chomp) pdftk.fill_form template_path(form_key), file_name, values(session_data, form_key) @@ -20,15 +23,19 @@ def call(session_data, model) TEMPLATES = { "cw1" => "lib/cw1-form.pdf", + "cw1_new" => "lib/cw1-form-new.pdf", "cw2" => "lib/cw2imm-form-2023-8-21.pdf", "cw5" => "lib/cw5-form.pdf", "cw1_and_2" => "lib/cw1-and-2-form-2023-8-21.pdf", "civ_means_7" => "lib/civ-means-7-form.pdf", + "civ_means_7_new" => "lib/civ-means-7-form-new.pdf", "cw1_welsh" => "lib/cw1-form-welsh.pdf", + "cw1_welsh_new" => "lib/cw1-form-welsh-new.pdf", "cw2_welsh" => "lib/cw2imm-form-welsh.pdf", "cw5_welsh" => "lib/cw5-form-welsh.pdf", "cw1_and_2_welsh" => "lib/cw1-and-2-form-welsh.pdf", "civ_means_7_welsh" => "lib/civ-means-7-form-welsh.pdf", + "civ_means_7_welsh_new" => "lib/civ-means-7-form-welsh-new.pdf", }.freeze def template_path(form_key) @@ -39,5 +46,17 @@ def values(session_data, form_key) mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/#{form_key}.yml")).map(&:with_indifferent_access) ControlledWorkDocumentValueMappingService.call(session_data, mappings) end + + def generate_form_key(model) + form_key = model.form_type + form_key += "_welsh" if model.language == "welsh" + + # when the flag is enabled we check the form_type to determine whether form_key has the _new suffix + if FeatureFlags.enabled?(:cw_form_updates, without_session_data: true) && (model.form_type == "cw1" || model.form_type == "civ_means_7") + form_key += "_new" + end + + form_key + end end end diff --git a/helm_deploy/laa-estimate-eligibility/templates/_envs.tpl b/helm_deploy/laa-estimate-eligibility/templates/_envs.tpl index ba8b181a9e..c02c900c03 100644 --- a/helm_deploy/laa-estimate-eligibility/templates/_envs.tpl +++ b/helm_deploy/laa-estimate-eligibility/templates/_envs.tpl @@ -69,7 +69,7 @@ env: value: {{ .Values.featureFlags.basicAuthentication }} - name: OUTGOINGS_FLOW_FEATURE_FLAG value: {{ .Values.featureFlags.outgoingsFlow }} - - name: CW_FORM_UPDATE_FEATURE_FLAG + - name: CW_FORM_UPDATES_FEATURE_FLAG value: {{ .Values.featureFlags.cwFormUpdates }} - name: SHARED_OWNERSHIP_FEATURE_FLAG value: {{ .Values.featureFlags.sharedOwnership }} diff --git a/lib/civ-means-7-form-new.pdf b/lib/civ-means-7-form-new.pdf new file mode 100644 index 0000000000..e672122bf7 Binary files /dev/null and b/lib/civ-means-7-form-new.pdf differ diff --git a/lib/civ-means-7-form-welsh-new.pdf b/lib/civ-means-7-form-welsh-new.pdf new file mode 100644 index 0000000000..2ffdb994d8 Binary files /dev/null and b/lib/civ-means-7-form-welsh-new.pdf differ diff --git a/lib/cw1-form-new.pdf b/lib/cw1-form-new.pdf new file mode 100644 index 0000000000..c7de6c3b74 Binary files /dev/null and b/lib/cw1-form-new.pdf differ diff --git a/lib/cw1-form-welsh-new.pdf b/lib/cw1-form-welsh-new.pdf new file mode 100644 index 0000000000..c6806b0339 Binary files /dev/null and b/lib/cw1-form-welsh-new.pdf differ diff --git a/spec/factories/api_results.rb b/spec/factories/api_results.rb index 0f77f7cd8e..f4071723fe 100644 --- a/spec/factories/api_results.rb +++ b/spec/factories/api_results.rb @@ -64,6 +64,94 @@ net_value { 110_000 } end + factory :gross_income_api_result, class: Hash do + initialize_with { attributes } + + other_income do + { + monthly_equivalents: { + all_sources: { + pension: 15, + maintenance_in: 5, + friends_or_family: 47.67, + property_or_lodger: 6.5, + }, + }, + } + end + + state_benefits do + { + monthly_equivalents: { + all_sources: 0, + bank_transactions: [], + cash_transactions: 0, + }, + } + end + + irregular_income do + { + monthly_equivalents: { + student_loan: 108, + unspecified_source: 50, + }, + } + end + + employment_income { [] } + end + + factory :partner_gross_income_api_result, class: Hash do + initialize_with { attributes } + + other_income do + { + monthly_equivalents: { + all_sources: { + pension: 25, + maintenance_in: 20, + friends_or_family: 15, + property_or_lodger: 10, + }, + bank_transactions: { + pension: 0, + maintenance_in: 0, + friends_or_family: 0, + property_or_lodger: 0, + }, + cash_transactions: { + pension: 0, + maintenance_in: 0, + friends_or_family: 0, + property_or_lodger: 0, + }, + }, + } + end + + state_benefits do + { + monthly_equivalents: { + all_sources: 0, + bank_transactions: [], + cash_transactions: 0, + }, + } + end + + irregular_income do + { + monthly_equivalents: { + student_loan: 199, + unspecified_source: 77, + }, + } + end + + employment_income { [] } + end + factory :proceeding_type, class: Hash do initialize_with { attributes } ccms_code { "SE003" } @@ -108,6 +196,7 @@ factory :assessment, class: Hash do initialize_with { attributes } + capital do { capital_items: { @@ -135,5 +224,8 @@ }, } end + + gross_income { FactoryBot.build(:gross_income_api_result) } + partner_gross_income { FactoryBot.build(:partner_gross_income_api_result) } end end diff --git a/spec/factories/session.rb b/spec/factories/session.rb index eec086e40a..85b261ce9c 100644 --- a/spec/factories/session.rb +++ b/spec/factories/session.rb @@ -83,19 +83,6 @@ national_insurance { 112 } end - trait :with_other_income do - friends_or_family_value { 40 } - friends_or_family_frequency { "every_week" } - maintenance_value { 125 } - maintenance_frequency { "every_two_weeks" } - property_or_lodger_value { 155 } - property_or_lodger_frequency { "every_four_weeks" } - pension_value { 1234 } - pension_frequency { "monthly" } - student_finance_value { 359 } - other_value { 259 } - end - trait :with_outgoings do housing_payments_value { 555 } housing_payments_frequency { "monthly" } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a621475e28..94228c1d4d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -141,9 +141,9 @@ end config.around(:each, :cw_form_updates) do |example| - ENV["CW_FORM_UPDATE_FEATURE_FLAG"] = "enabled" + ENV["CW_FORM_UPDATES_FEATURE_FLAG"] = "enabled" example.run - ENV["CW_FORM_UPDATE_FEATURE_FLAG"] = "disabled" + ENV["CW_FORM_UPDATES_FEATURE_FLAG"] = "disabled" end config.around(:each, :shared_ownership) do |example| diff --git a/spec/services/controlled_work_document_population_service_spec.rb b/spec/services/controlled_work_document_population_service_spec.rb new file mode 100644 index 0000000000..a55d23e037 --- /dev/null +++ b/spec/services/controlled_work_document_population_service_spec.rb @@ -0,0 +1,41 @@ +require "rails_helper" + +RSpec.describe ControlledWorkDocumentPopulationService do + describe ".generate_form_key" do + # rubocop:disable RSpec/VerifiedDoubles + let(:model) { double(described_class) } + # rubocop:enable RSpec/VerifiedDoubles + + context "when form_type is cw1 and language is welsh" do + before do + allow(model).to receive_messages(form_type: "cw1", language: "welsh") + end + + it "returns cw1_welsh" do + expect(described_class.generate_form_key(model)).to eq("cw1_welsh") + end + end + + context "when form_type is cw1 and feature flag cw_form_updates is enabled" do + before do + allow(model).to receive_messages(form_type: "cw1", language: "english") + allow(FeatureFlags).to receive(:enabled?).with(:cw_form_updates, without_session_data: true).and_return(true) + end + + it "returns cw1_new" do + expect(described_class.generate_form_key(model)).to eq("cw1_new") + end + end + + context "when form_type is cw1_welsh and feature flag cw_form_updates is enabled", :cw_form_updates_flag do + before do + allow(FeatureFlags).to receive(:enabled?).with(:cw_form_updates, without_session_data: true).and_return(true) + allow(model).to receive_messages(form_type: "cw1", language: "welsh") + end + + it "returns cw1_welsh_new" do + expect(described_class.generate_form_key(model)).to eq("cw1_welsh_new") + end + end + end +end diff --git a/spec/services/controlled_work_document_value_mapping_service_spec.rb b/spec/services/controlled_work_document_value_mapping_service_spec.rb index a96dfd6870..b9ced707fd 100644 --- a/spec/services/controlled_work_document_value_mapping_service_spec.rb +++ b/spec/services/controlled_work_document_value_mapping_service_spec.rb @@ -31,7 +31,9 @@ investments: 222, valuables: 555, percentage_owned: 25, - api_response: FactoryBot.build(:api_result, main_home: FactoryBot.build(:property_api_result, value: 250_000)).with_indifferent_access, + api_response: FactoryBot.build(:api_result, + main_home: FactoryBot.build(:property_api_result, value: 250_000), + assessment: FactoryBot.build(:assessment)).with_indifferent_access, ) end @@ -54,6 +56,39 @@ expect(result).to include(representative_sample) end + it "can successfully populate the new fields on the CW1 form (other income section)" do + mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/cw1_new.yml")).map(&:with_indifferent_access) + result = described_class.call(session_data, mappings) + representative_sample = { + "Child under 18" => "No", + "Means test required" => "Yes_2", # This is always checked as CCQ is only relevant to means tested cases + "Passported" => "No", # Not passporting + "Client in receipt of asylum support" => "No", # Asylum supported not given + "Please complete Part A Capital Subject matter of dispute" => "No_4", # No SMOD + "Has partner whose means are to be agrgregated" => "Yes_3", # Has a partner + "undefined_26" => "250,000", # Property worth £250,000 + "undefined_42" => "555", # Valuables + "undefined_40" => "222", # Investments + "undefined_38" => "111", # Savings + "undefined_30" => "25", # Percentage owned + "pensions_client" => "15", + "maintenance_client" => "5", + "studentfinance_client" => "108", + "friendsandfamily_client" => "47.67", + "property_client" => "6.50", + "otherincome_client" => "50", + "benefits_client" => "0", + "pensions_partner" => "25", + "studentfinance_partner" => "199", + "friendsandfamily_partner" => "15", + "property_partner" => "10", + "otherincome_partner" => "77", + "benefits_partner" => "0", + "maintenance_partner" => "20", + } + expect(result).to include(representative_sample) + end + context "when client is under 18" do let(:session_data) do build(:minimal_complete_session, @@ -96,6 +131,31 @@ expect(result).to include(representative_sample) end + it "can successfully populate Welsh CW1 form with the added other income fields" do + mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/cw1_welsh_new.yml")).map(&:with_indifferent_access) + result = described_class.call(session_data, mappings) + representative_sample = { + "Matter type" => "Means test required", # This is always checked as CCQ is only relevant to means tested cases + "Passported" => "Nac ydy", # Not passporting + "Asylum support" => "Nac ydyw", # Asylum supported not given + "Client's assets claimed by opponent" => "Nac ydy", # No SMOD + "Partner" => "Ie", # Has a partner + "FillText136" => "250,000", # Property worth £250,000 + "FillText112" => "555", # Valuables + "FillText111" => "222", # Investments + "FillText148" => "111", # Savings + "FillText140" => "25", # Percentage owned + "property_client" => "6.50", + "otherincome_client" => "50", + "benefits_client" => "0", + "pensions_partner" => "25", + "studentfinance_partner" => "199", + "friendsandfamily_partner" => "15", + "property_partner" => "10", + } + expect(result).to include(representative_sample) + end + it "can successfully populate a CW2 IMM form (template with CCQ header)" do mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/cw2.yml")).map(&:with_indifferent_access) result = described_class.call(session_data, mappings) @@ -168,6 +228,42 @@ expect(result).to include(representative_sample) end + it "can successfully populate new CIVMEANS7 form (other income fields)" do + mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/civ_means_7_new.yml")).map(&:with_indifferent_access) + result = described_class.call(session_data, mappings) + representative_sample = { + "Passported" => "No", + "FillText36" => "110,000", # Client's share of total net equity + "FillText57" => "90,000", # Main home / outstanding mortgage + "FillText56" => "250,000", # Main home / current market value + "pensions_client" => "15", + "maintenance_client" => "5", + "studentfinance_client" => "108", + "benefits_client" => "0", + "property_partner" => "10", + "otherincome_partner" => "77", + "benefits_partner" => "0", + "maintenance_partner" => "20", + } + expect(result).to include(representative_sample) + end + + it "can successfully populate a Welsh CIVMEANS7 form with the added other income fields" do + mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/civ_means_7_welsh_new.yml")).map(&:with_indifferent_access) + result = described_class.call(session_data, mappings) + representative_sample = { + "Passported" => "Nac ydy", + "FillText30" => "110,000", # Client's share of total net equity + "FillText22" => "90,000", # Main home / outstanding mortgage + "FillText21" => "250,000", # Main home / current market value + "maintenance_client" => "5", + "studentfinance_client" => "108", + "property_partner" => "10", + "otherincome_partner" => "77", + } + expect(result).to include(representative_sample) + end + it "can successfully populate a Welsh CIVMEANS7 form" do mappings = YAML.load_file(Rails.root.join("app/lib/controlled_work_mappings/civ_means_7_welsh.yml")).map(&:with_indifferent_access) result = described_class.call(session_data, mappings) diff --git a/spec/views/check_answers_page/partner_content/other_income_spec.rb b/spec/views/check_answers_page/partner_content/other_income_spec.rb index eaf48eab9b..97ede0fcad 100644 --- a/spec/views/check_answers_page/partner_content/other_income_spec.rb +++ b/spec/views/check_answers_page/partner_content/other_income_spec.rb @@ -53,7 +53,6 @@ let(:session_data) do build(:minimal_complete_session, :with_partner, - :with_other_income, partner_friends_or_family_relevant: false, partner_maintenance_relevant: false, partner_property_or_lodger_relevant: false,