From 56b4af517786a150aafceef21ca9e773371574b0 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Tue, 6 Feb 2024 15:01:39 +0000 Subject: [PATCH 01/14] ap-4783: Migration to add last_name_at_birth to applicants --- ...20240206145546_add_last_name_at_birth_to_applicants.rb | 6 ++++++ db/schema.rb | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20240206145546_add_last_name_at_birth_to_applicants.rb diff --git a/db/migrate/20240206145546_add_last_name_at_birth_to_applicants.rb b/db/migrate/20240206145546_add_last_name_at_birth_to_applicants.rb new file mode 100644 index 0000000000..2c36f2604f --- /dev/null +++ b/db/migrate/20240206145546_add_last_name_at_birth_to_applicants.rb @@ -0,0 +1,6 @@ +class AddLastNameAtBirthToApplicants < ActiveRecord::Migration[7.1] + def change + add_column :applicants, :last_name_at_birth, :string + add_column :applicants, :changed_last_name, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 66bbb6d671..b6cda45343 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_24_161717) do +ActiveRecord::Schema[7.1].define(version: 2024_02_06_145546) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -110,9 +110,9 @@ t.integer "failed_attempts", default: 0, null: false t.string "unlock_token" t.datetime "locked_at", precision: nil + t.boolean "employed" t.datetime "remember_created_at", precision: nil t.string "remember_token" - t.boolean "employed" t.boolean "self_employed", default: false t.boolean "armed_forces", default: false t.boolean "has_national_insurance_number" @@ -125,6 +125,8 @@ t.decimal "student_finance_amount" t.boolean "extra_employment_information" t.string "extra_employment_information_details" + t.string "last_name_at_birth" + t.boolean "changed_last_name" t.index ["confirmation_token"], name: "index_applicants_on_confirmation_token", unique: true t.index ["email"], name: "index_applicants_on_email" t.index ["unlock_token"], name: "index_applicants_on_unlock_token", unique: true @@ -593,9 +595,9 @@ t.boolean "no_cash_income" t.boolean "no_cash_outgoings" t.date "purgeable_on" + t.string "required_document_categories", default: [], null: false, array: true t.boolean "extra_employment_information" t.string "extra_employment_information_details" - t.string "required_document_categories", default: [], null: false, array: true t.string "full_employment_details" t.datetime "client_declaration_confirmed_at", precision: nil t.boolean "substantive_cost_override" From 37969e4e84844200811f0c1d46b74cbb6342b672 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Wed, 7 Feb 2024 08:19:47 +0000 Subject: [PATCH 02/14] ap-4783: changes to applicant_details view --- app/views/shared/forms/_applicant_form.html.erb | 9 ++++++++- config/locales/en/shared.yml | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/shared/forms/_applicant_form.html.erb b/app/views/shared/forms/_applicant_form.html.erb index eba61fbbce..5acb2e05c7 100644 --- a/app/views/shared/forms/_applicant_form.html.erb +++ b/app/views/shared/forms/_applicant_form.html.erb @@ -18,7 +18,14 @@ <%= form.govuk_text_field :first_name, label: { text: "First name" }, width: "three-quarters" %> <%= form.govuk_text_field :last_name, label: { text: "Last name" }, width: "three-quarters" %> <% end %> - + <%= form.govuk_radio_buttons_fieldset :changed_last_name, + legend: { size: "m", tag: "h2", text: t(".changed_last_name") }, + hint: { text: t(".changed_last_name_hint") } do %> + <%= form.govuk_radio_button :changed_last_name, true, link_errors: true, label: { text: t("generic.yes") } do %> + <%= form.govuk_text_field :last_name_at_birth, label: { text: t(".last_name_at_birth") }, width: "three-quarters" %> + <% end %> + <%= form.govuk_radio_button :changed_last_name, false, label: { text: t("generic.no") } %> + <% end %>
<%= form.govuk_date_field :date_of_birth, legend: { text: t("shared.forms.date_input_fields.date_of_birth_label") }, hint: { text: t("shared.forms.date_input_fields.date_of_birth_hint") } %> diff --git a/config/locales/en/shared.yml b/config/locales/en/shared.yml index b0d07befce..9f8df6b180 100644 --- a/config/locales/en/shared.yml +++ b/config/locales/en/shared.yml @@ -567,6 +567,9 @@ en: page_title: Enter your client's details name: Name email_label: Email address + changed_last_name: Has your client ever changed their last name? + changed_last_name_hint: For example, through marriage or deed poll + last_name_at_birth: What was your client's last name at birth? date_input_fields: date_of_birth_hint: For example, 31 3 1980. date_of_birth_label: Date of birth From aab4dcfd2d39972221f6fa3546dcb4f68439b309 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Wed, 7 Feb 2024 10:12:45 +0000 Subject: [PATCH 03/14] ap-4783: Update applicant_details controller and form --- .../providers/applicant_details_controller.rb | 2 +- .../providers/applicants_controller.rb | 2 +- app/forms/applicants/basic_details_form.rb | 16 ++- config/locales/en/activemodel.yml | 4 + spec/factories/applicants.rb | 6 ++ .../applicants/basic_details_form_spec.rb | 102 +++++++++++++++++- .../applicant_details_controller_spec.rb | 2 + .../providers/applicants_controller_spec.rb | 1 + .../concerns/providers/draftable_spec.rb | 1 + 9 files changed, 131 insertions(+), 5 deletions(-) diff --git a/app/controllers/providers/applicant_details_controller.rb b/app/controllers/providers/applicant_details_controller.rb index 01715d39fd..54338836cc 100644 --- a/app/controllers/providers/applicant_details_controller.rb +++ b/app/controllers/providers/applicant_details_controller.rb @@ -17,7 +17,7 @@ def applicant def form_params merged_params = merge_with_model(applicant) do - params.require(:applicant).permit(:first_name, :last_name, :date_of_birth) + params.require(:applicant).permit(:first_name, :last_name, :date_of_birth, :changed_last_name, :last_name_at_birth) end convert_date_params(merged_params) end diff --git a/app/controllers/providers/applicants_controller.rb b/app/controllers/providers/applicants_controller.rb index 8ddad351ea..155dfc7d43 100644 --- a/app/controllers/providers/applicants_controller.rb +++ b/app/controllers/providers/applicants_controller.rb @@ -43,7 +43,7 @@ def edit_applicant_key_point def form_params merged_params = merge_with_model(applicant) do - params.require(:applicant).permit(:first_name, :last_name, :date_of_birth) + params.require(:applicant).permit(:first_name, :last_name, :date_of_birth, :changed_last_name, :last_name_at_birth) end convert_date_params(merged_params) end diff --git a/app/forms/applicants/basic_details_form.rb b/app/forms/applicants/basic_details_form.rb index 8712832600..4e6ea00fb3 100644 --- a/app/forms/applicants/basic_details_form.rb +++ b/app/forms/applicants/basic_details_form.rb @@ -6,7 +6,9 @@ class BasicDetailsForm < BaseForm last_name date_of_birth_1i date_of_birth_2i - date_of_birth_3i].freeze + date_of_birth_3i + changed_last_name + last_name_at_birth].freeze form_for Applicant @@ -14,7 +16,7 @@ class BasicDetailsForm < BaseForm attr_writer :date_of_birth before_validation do - squish_whitespaces(:first_name, :last_name) + squish_whitespaces(:first_name, :last_name, :last_name_at_birth) end # Note order of validation here determines order they appear on page @@ -23,6 +25,8 @@ class BasicDetailsForm < BaseForm validates :first_name, presence: true, unless: proc { draft? && last_name.present? } validates :last_name, presence: true, unless: proc { draft? && first_name.present? } validates :date_of_birth, presence: true, unless: :draft_and_not_partially_complete_date_of_birth? + validates :changed_last_name, inclusion: %w[true false], unless: :draft? + validates :last_name_at_birth, presence: true, unless: proc { draft? || changed_last_name.to_s != "true" } validates( :date_of_birth, @@ -32,5 +36,13 @@ class BasicDetailsForm < BaseForm }, allow_nil: true, ) + + def save + if changed_last_name.to_s == "false" + attributes[:last_name_at_birth] = nil + end + super + end + alias_method :save!, :save end end diff --git a/config/locales/en/activemodel.yml b/config/locales/en/activemodel.yml index 5a767322c5..6af3dc8d59 100644 --- a/config/locales/en/activemodel.yml +++ b/config/locales/en/activemodel.yml @@ -114,6 +114,10 @@ en: inclusion: Select yes if the client has a National Insurance number last_name: blank: Enter last name + last_name_at_birth: + blank: Enter your client's last name at birth + changed_last_name: + inclusion: Select yes if your client has ever changed their last name national_insurance_number: blank: Enter a National Insurance number not_valid: Enter a valid National Insurance number diff --git a/spec/factories/applicants.rb b/spec/factories/applicants.rb index fc7733df5f..5c99816b4e 100644 --- a/spec/factories/applicants.rb +++ b/spec/factories/applicants.rb @@ -9,6 +9,7 @@ employed { false } student_finance { nil } student_finance_amount { nil } + changed_last_name { false } trait :with_address do addresses { build_list(:address, 1) } @@ -118,6 +119,11 @@ extra_employment_information_details { Faker::Lorem.paragraph(sentence_count: 2) } end + trait :with_changed_last_name do + changed_last_name { true } + last_name_at_birth { Faker::Name.last_name } + end + # use :with_bank_accounts: 2 to create 2 bank accounts for the applicant transient do with_bank_accounts { 0 } diff --git a/spec/forms/applicants/basic_details_form_spec.rb b/spec/forms/applicants/basic_details_form_spec.rb index c5d1177071..963e2e2866 100644 --- a/spec/forms/applicants/basic_details_form_spec.rb +++ b/spec/forms/applicants/basic_details_form_spec.rb @@ -3,12 +3,13 @@ RSpec.describe Applicants::BasicDetailsForm, type: :form do subject(:form) { described_class.new(params) } - let(:params) { attributes.slice(*attr_list).merge(model: legal_aid_application.build_applicant) } + let(:params) { attributes.slice(*attr_list).merge(model: legal_aid_application.build_applicant, changed_last_name: "false") } let(:attr_list) do %i[ first_name last_name date_of_birth + last_name_at_birth ] end let(:legal_aid_application_id) { legal_aid_application.id } @@ -100,6 +101,7 @@ date_of_birth_1i: attributes[:date_of_birth].year.to_s, date_of_birth_2i: attributes[:date_of_birth].month.to_s, date_of_birth_3i: attributes[:date_of_birth].day.to_s, + changed_last_name: "false", model: applicant, } end @@ -122,6 +124,7 @@ date_of_birth_1i: "10", date_of_birth_2i: "21", date_of_birth_3i: "44", + changed_last_name: "false", model: applicant, } end @@ -138,6 +141,15 @@ end describe "save_as_draft" do + let(:attr_list) do + %i[ + first_name + last_name + date_of_birth + last_name_at_birth + ] + end + let(:applicant) { Applicant.last } it "creates a new applicant" do @@ -159,6 +171,7 @@ date_of_birth_1i: "0001", date_of_birth_2i: "13", date_of_birth_3i: "32", + changed_last_name: "false", } end @@ -185,6 +198,7 @@ date_of_birth_1i: "1999", date_of_birth_2i: "12", date_of_birth_3i: "31", + changed_last_name: "false", } end @@ -211,6 +225,7 @@ date_of_birth_1i: "1999", date_of_birth_2i: "12", date_of_birth_3i: "31", + changed_last_name: "false", } end @@ -232,6 +247,7 @@ date_of_birth_1i: "1999", date_of_birth_2i: "12", date_of_birth_3i: "31", + changed_last_name: "false", } end @@ -254,6 +270,7 @@ last_name: attributes[:last_name], date_of_birth_2i: "10", date_of_birth_3i: "4", + changed_last_name: "false", model: applicant, } end @@ -266,6 +283,89 @@ end end + context "with changed last name" do + let(:params) do + { + first_name: "Fred", + last_name: "Bloggs", + date_of_birth_1i: "1999", + date_of_birth_2i: "12", + date_of_birth_3i: "31", + changed_last_name: "true", + last_name_at_birth: "Smith", + } + end + + it "is valid" do + expect(form).to be_valid + end + + it "saves to the database" do + expect { form.save }.to change(Applicant, :count) + end + end + + context "with changed_last_name nil" do + let(:params) do + { + first_name: "Fred", + last_name: "Bloggs", + date_of_birth_1i: "1999", + date_of_birth_2i: "12", + date_of_birth_3i: "31", + changed_last_name: nil, + last_name_at_birth: "", + } + end + + it "adds expected error" do + form.save! + expect(form.errors[:changed_last_name]).to contain_exactly("Select yes if your client has ever changed their last name") + end + end + + context "with changed_last_name but no last_name_at_birth" do + let(:params) do + { + first_name: "Fred", + last_name: "Bloggs", + date_of_birth_1i: "1999", + date_of_birth_2i: "12", + date_of_birth_3i: "31", + changed_last_name: true, + last_name_at_birth: "", + } + end + + it "adds expected error" do + form.save! + expect(form.errors[:last_name_at_birth]).to contain_exactly("Enter your client's last name at birth") + end + end + + context "when saving as draft with changed_last_name but no last_name_at_birth" do + let(:params) do + { + first_name: "Fred", + last_name: "Bloggs", + date_of_birth_1i: "1999", + date_of_birth_2i: "12", + date_of_birth_3i: "31", + changed_last_name: "true", + last_name_at_birth: "", + } + end + + it "saves to the database" do + expect { form.save_as_draft }.to change(Applicant, :count) + end + + it "is valid" do + form.save_as_draft + expect(form).to be_valid + end + end + describe "#model" do it "returns a new applicant" do expect(form.model).to be_a(Applicant) diff --git a/spec/requests/providers/applicant_details_controller_spec.rb b/spec/requests/providers/applicant_details_controller_spec.rb index 6e5aa02b24..57fe59c885 100644 --- a/spec/requests/providers/applicant_details_controller_spec.rb +++ b/spec/requests/providers/applicant_details_controller_spec.rb @@ -47,6 +47,7 @@ "date_of_birth(2i)": "07", "date_of_birth(3i)": "11", email: Faker::Internet.email, + changed_last_name: "false", }, } end @@ -90,6 +91,7 @@ "date_of_birth(2i)": "07", "date_of_birth(3i)": "11", email: Faker::Internet.email, + changed_last_name: "false", }, } end diff --git a/spec/requests/providers/applicants_controller_spec.rb b/spec/requests/providers/applicants_controller_spec.rb index 54e4aa9617..3c006bb391 100644 --- a/spec/requests/providers/applicants_controller_spec.rb +++ b/spec/requests/providers/applicants_controller_spec.rb @@ -34,6 +34,7 @@ "date_of_birth(1i)": "1981", "date_of_birth(2i)": "07", "date_of_birth(3i)": "11", + changed_last_name: false, }, } end diff --git a/spec/requests/providers/concerns/providers/draftable_spec.rb b/spec/requests/providers/concerns/providers/draftable_spec.rb index c335bcecb4..95c19e09b8 100644 --- a/spec/requests/providers/concerns/providers/draftable_spec.rb +++ b/spec/requests/providers/concerns/providers/draftable_spec.rb @@ -17,6 +17,7 @@ "date_of_birth(1i)": "1981", "date_of_birth(2i)": "07", "date_of_birth(3i)": "11", + changed_last_name: false, }, } end From 5cda6624dc9944b6bac419ac3f4ab137bbcd7ab3 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Wed, 7 Feb 2024 15:43:21 +0000 Subject: [PATCH 04/14] ap-4783: Fix applicant_deatils.feature --- features/providers/applicant_details.feature | 8 ++++++++ features/providers/applicant_under_16_blocked.feature | 1 + features/providers/copy_case.feature | 1 + features/providers/cost_override.feature | 1 + features/providers/link_case.feature | 1 + features/providers/no_nino_flow.feature | 1 + .../under_18_application_journey.feature | 1 + .../with_delegated_functions.feature | 1 + .../without_delegated_functions.feature | 1 + .../regressions/back_button_on_proceedings.feature | 1 + features/providers/regressions/scope_limitations.feature | 1 + features/providers/search_proceedings.feature | 2 ++ 12 files changed, 20 insertions(+) diff --git a/features/providers/applicant_details.feature b/features/providers/applicant_details.feature index 82473949a6..14ee9cfe6a 100644 --- a/features/providers/applicant_details.feature +++ b/features/providers/applicant_details.feature @@ -3,6 +3,8 @@ Feature: Applicant details Scenario: Completes the application using address lookup with multiple proceedings Given I start the journey as far as the applicant page Then I enter name 'Test', 'User' + Then I choose 'Yes' + Then I enter last name at birth 'Smith' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page @@ -132,6 +134,7 @@ Feature: Applicant details Scenario: Completes the application using address lookup Given I start the journey as far as the applicant page Then I enter name 'Test', 'User' + Then I choose 'No' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page @@ -191,6 +194,7 @@ Feature: Applicant details Scenario: Completes the application using manual address Given I start the journey as far as the applicant page Then I enter name 'Test', 'User' + Then I choose 'No' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page @@ -268,6 +272,7 @@ Feature: Applicant details Given I start the journey as far as the applicant page And a "bank holiday" exists in the database Then I enter name 'Test', 'Walker' + Then I choose 'No' Then I enter the date of birth '10-1-1980' Then I click 'Save and continue' Then I am on the postcode entry page @@ -320,6 +325,7 @@ Feature: Applicant details Scenario: I can see that the applicant does not receive benefits Given I start the journey as far as the applicant page Then I enter name 'Test', 'Paul' + Then I choose 'No' Then I enter the date of birth '10-12-1961' Then I click 'Save and continue' Then I am on the postcode entry page @@ -366,6 +372,7 @@ Feature: Applicant details Then I click the first link 'Client name' Then I should be on a page showing "Enter your client's details" Then I enter name 'Kyle', 'Walker' + Then I choose 'No' Then I enter the date of birth '10-1-1980' When I click 'Save and continue' Then I should be on a page with title "Does your client have a National Insurance number?" @@ -380,6 +387,7 @@ Feature: Applicant details Scenario: Allows return to, and proceed from, Delegated Function date view Given I start the journey as far as the applicant page Then I enter name 'Test', 'User' + Then I choose 'No' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/applicant_under_16_blocked.feature b/features/providers/applicant_under_16_blocked.feature index d5939e7842..00945333c5 100644 --- a/features/providers/applicant_under_16_blocked.feature +++ b/features/providers/applicant_under_16_blocked.feature @@ -5,6 +5,7 @@ Feature: Applicant under 16 blocked Given I start the journey as far as the applicant page When I enter name 'Test', 'Paul' + Then I choose 'No' And I enter a date of birth that will make me 16 today And I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/copy_case.feature b/features/providers/copy_case.feature index 226c1e761b..db895bde13 100644 --- a/features/providers/copy_case.feature +++ b/features/providers/copy_case.feature @@ -5,6 +5,7 @@ Background: And I start the journey as far as the applicant page And I have previously created an application with reference "L-TVH-U0T" When I enter name 'Test', 'User' + Then I choose 'No' And I enter the date of birth '03-04-1999' When I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/cost_override.feature b/features/providers/cost_override.feature index 0a75b960b3..ad186780c6 100644 --- a/features/providers/cost_override.feature +++ b/features/providers/cost_override.feature @@ -3,6 +3,7 @@ Feature: Emergency cost override Scenario: Provider is prompted to override emergency cost limitation Given I start the journey as far as the applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter the date of birth '03-04-1999' When I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/link_case.feature b/features/providers/link_case.feature index 37bdce9ff1..5cad1dd64c 100644 --- a/features/providers/link_case.feature +++ b/features/providers/link_case.feature @@ -5,6 +5,7 @@ Background: And I start the journey as far as the applicant page And I have previously created an application with reference "L-TVH-U0T" When I enter name 'Test', 'User' + Then I choose 'No' And I enter the date of birth '03-04-1999' When I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/no_nino_flow.feature b/features/providers/no_nino_flow.feature index 7f093edbbc..9369c5454e 100644 --- a/features/providers/no_nino_flow.feature +++ b/features/providers/no_nino_flow.feature @@ -6,6 +6,7 @@ Feature: No national insurance number for applicant And a "bank holiday" exists in the database When I enter name 'Test', 'Walker' + Then I choose 'No' And I enter the date of birth '10-1-1980' And I click 'Save and continue' Then I should be on a page with title "Enter your client's correspondence address" diff --git a/features/providers/non_means_tested_journey/under_18_application_journey.feature b/features/providers/non_means_tested_journey/under_18_application_journey.feature index 7b85da846f..89106f1461 100644 --- a/features/providers/non_means_tested_journey/under_18_application_journey.feature +++ b/features/providers/non_means_tested_journey/under_18_application_journey.feature @@ -15,6 +15,7 @@ Feature: Under 18 applicant journey Then I should be on the Applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter a date of birth that will make me 18 tomorrow And I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/non_means_tested_journey/with_delegated_functions.feature b/features/providers/non_means_tested_journey/with_delegated_functions.feature index 0499959339..31411807e5 100644 --- a/features/providers/non_means_tested_journey/with_delegated_functions.feature +++ b/features/providers/non_means_tested_journey/with_delegated_functions.feature @@ -15,6 +15,7 @@ Feature: Non-means-tested applicant journey with use of delegation functions Then I should be on the Applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter a date of birth that will make me 18 today And I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/non_means_tested_journey/without_delegated_functions.feature b/features/providers/non_means_tested_journey/without_delegated_functions.feature index 207079e22e..35d208347c 100644 --- a/features/providers/non_means_tested_journey/without_delegated_functions.feature +++ b/features/providers/non_means_tested_journey/without_delegated_functions.feature @@ -15,6 +15,7 @@ Feature: Non-means-tested applicant journey without use of delegation functions Then I should be on the Applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter a date of birth that will make me 18 tomorrow And I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/regressions/back_button_on_proceedings.feature b/features/providers/regressions/back_button_on_proceedings.feature index 09d70ac512..760c65abf3 100644 --- a/features/providers/regressions/back_button_on_proceedings.feature +++ b/features/providers/regressions/back_button_on_proceedings.feature @@ -3,6 +3,7 @@ Feature: Using the back button on proceedings should not lock a user out Scenario: When a provider is adding proceedings and uses the back button they should route to the list of proceedings first Given I start the journey as far as the applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter the date of birth '03-04-1999' And I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/regressions/scope_limitations.feature b/features/providers/regressions/scope_limitations.feature index 24986eddc5..925a044e88 100644 --- a/features/providers/regressions/scope_limitations.feature +++ b/features/providers/regressions/scope_limitations.feature @@ -3,6 +3,7 @@ Feature: Scope limitations not being set Scenario: When a provider creates an application with multiple proceedings and uses the back button, scope limitations should not be removed Given I start the journey as far as the applicant page When I enter name 'Test', 'User' + Then I choose 'No' And I enter the date of birth '03-04-1999' When I click 'Save and continue' Then I am on the postcode entry page diff --git a/features/providers/search_proceedings.feature b/features/providers/search_proceedings.feature index 0588e21213..3b9ef66416 100644 --- a/features/providers/search_proceedings.feature +++ b/features/providers/search_proceedings.feature @@ -12,6 +12,7 @@ Feature: Search proceedings When I click 'Agree and continue' Then I should be on the Applicant page Then I enter name 'Test', 'User' + Then I choose 'No' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page @@ -35,6 +36,7 @@ Feature: Search proceedings When I click 'Agree and continue' Then I should be on the Applicant page Then I enter name 'Test', 'User' + Then I choose 'No' Then I enter the date of birth '03-04-1999' Then I click 'Save and continue' Then I am on the postcode entry page From 796ebc77bd295a3c547def9474a501a463acf1a1 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Thu, 8 Feb 2024 08:15:49 +0000 Subject: [PATCH 05/14] ap-4783: Amend cya page --- .../check_provider_answers/_shared.html.erb | 2 +- .../check_answers/_client_details.html.erb | 24 ++++++++++++++ config/locales/en/shared.yml | 2 ++ .../providers/check_provider_answers.feature | 32 +++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/app/views/providers/check_provider_answers/_shared.html.erb b/app/views/providers/check_provider_answers/_shared.html.erb index 028768aed5..920fc3af2a 100644 --- a/app/views/providers/check_provider_answers/_shared.html.erb +++ b/app/views/providers/check_provider_answers/_shared.html.erb @@ -2,7 +2,7 @@ <%= render( "shared/check_answers/client_details", - attributes: %i[first_name last_name date_of_birth national_insurance_number employment_status address], + attributes: %i[first_name last_name last_name_at_birth changed_last_name date_of_birth national_insurance_number employment_status address], applicant: @applicant, address: @address, read_only: @read_only, diff --git a/app/views/shared/check_answers/_client_details.html.erb b/app/views/shared/check_answers/_client_details.html.erb index 498965bec5..5be0091c38 100644 --- a/app/views/shared/check_answers/_client_details.html.erb +++ b/app/views/shared/check_answers/_client_details.html.erb @@ -25,6 +25,30 @@ <% end %> <% end %> + <% if :changed_last_name.in?(attributes) %> + <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__changed_last_name" }) do |row| %> + <%= row.with_key(text: t(".changed_last_name"), classes: "govuk-!-width-one-half") %> + <%= row.with_value(text: yes_no(applicant.changed_last_name)) %> + <%= row.with_action( + text: t("generic.change"), + href: providers_legal_aid_application_applicant_details_path(@legal_aid_application, anchor: :changed_last_name), + visually_hidden_text: "#{t('.aria_prefix')} #{t('.changed_last_name')}", + ) %> + <% end %> + <% end %> + + <% if :last_name_at_birth.in?(attributes) %> + <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__last_name_at_birth" }) do |row| %> + <%= row.with_key(text: t(".last_name_at_birth"), classes: "govuk-!-width-one-half") %> + <%= row.with_value(text: applicant.last_name_at_birth.presence || applicant.last_name) %> + <%= row.with_action( + text: t("generic.change"), + href: providers_legal_aid_application_applicant_details_path(@legal_aid_application, anchor: :last_name_at_birth), + visually_hidden_text: "#{t('.aria_prefix')} #{t('.last_name_at_birth')}", + ) %> + <% end %> + <% end %> + <% if :date_of_birth.in?(attributes) %> <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__date_of_birth" }) do |row| %> <%= row.with_key(text: t(".dob"), classes: "govuk-!-width-one-half") %> diff --git a/config/locales/en/shared.yml b/config/locales/en/shared.yml index 9f8df6b180..911d9b7722 100644 --- a/config/locales/en/shared.yml +++ b/config/locales/en/shared.yml @@ -336,6 +336,8 @@ en: email: Email address first_name: First name last_name: Last name + changed_last_name: Has your client ever changed their last name? + last_name_at_birth: What was your client's last name at birth? nino: National Insurance number has_partner: Does your client have a partner? has_partner_aria_label: Change whether your client has a partner diff --git a/features/providers/check_provider_answers.feature b/features/providers/check_provider_answers.feature index c88828d057..4ea0061e85 100644 --- a/features/providers/check_provider_answers.feature +++ b/features/providers/check_provider_answers.feature @@ -15,6 +15,8 @@ Feature: Checking client details answers backwards and forwards | question | answer | | First name | Test | | Last name | Walker | + | Has your client ever changed their last name? | No | + | What was your client's last name at birth? | Walker | | Date of birth | 10 January 1980 | | Correspondence address | Transport For London\n98 Petty France\nLondon\nSW1H 9EA | | National Insurance number | JA293483A | @@ -26,6 +28,8 @@ Feature: Checking client details answers backwards and forwards | question | answer | | First name | Test | | Last name | Walker | + | Has your client ever changed their last name? | No | + | What was your client's last name at birth? | Walker | When I click Check Your Answers Change link for "First name" Then I should be on a page with title "Enter your client's details" @@ -38,6 +42,34 @@ Feature: Checking client details answers backwards and forwards | question | answer | | First name | Fred | | Last name | Bloggs | + | Has your client ever changed their last name? | No | + | What was your client's last name at birth? | Bloggs | + + @javascript + Scenario: I am able to return and amend the client's last name at birth + Given I complete the passported journey as far as check your answers for client details + And the "Client details" check your answers section should contain: + | question | answer | + | First name | Test | + | Last name | Walker | + | Has your client ever changed their last name? | No | + | What was your client's last name at birth? | Walker | + + When I click Check Your Answers Change link for "Changed last name" + Then I should be on a page with title "Enter your client's details" + + And I choose 'Yes' + Then I enter last name at birth 'Bloggs' + + When I click 'Save and continue' + Then I should be on a page with title "Check your answers" + + And the "Client details" check your answers section should contain: + | question | answer | + | First name | Test | + | Last name | Walker | + | Has your client ever changed their last name? | Yes | + | What was your client's last name at birth? | Bloggs | @javascript @vcr Scenario: I am able to return and amend the client's address From a3fb2ee9163246cab1f4b006720cdc3d006bf737 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Thu, 8 Feb 2024 11:36:02 +0000 Subject: [PATCH 06/14] ap-4783: remove tag and add missing hint text --- app/views/shared/forms/_applicant_form.html.erb | 4 ++-- config/locales/en/shared.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/shared/forms/_applicant_form.html.erb b/app/views/shared/forms/_applicant_form.html.erb index 5acb2e05c7..78129b5f09 100644 --- a/app/views/shared/forms/_applicant_form.html.erb +++ b/app/views/shared/forms/_applicant_form.html.erb @@ -19,10 +19,10 @@ <%= form.govuk_text_field :last_name, label: { text: "Last name" }, width: "three-quarters" %> <% end %> <%= form.govuk_radio_buttons_fieldset :changed_last_name, - legend: { size: "m", tag: "h2", text: t(".changed_last_name") }, + legend: { text: t(".changed_last_name") }, hint: { text: t(".changed_last_name_hint") } do %> <%= form.govuk_radio_button :changed_last_name, true, link_errors: true, label: { text: t("generic.yes") } do %> - <%= form.govuk_text_field :last_name_at_birth, label: { text: t(".last_name_at_birth") }, width: "three-quarters" %> + <%= form.govuk_text_field :last_name_at_birth, label: { text: t(".last_name_at_birth") }, hint: { text: t(".last_name_at_birth_hint") }, width: "three-quarters" %> <% end %> <%= form.govuk_radio_button :changed_last_name, false, label: { text: t("generic.no") } %> <% end %> diff --git a/config/locales/en/shared.yml b/config/locales/en/shared.yml index 911d9b7722..c196f783c9 100644 --- a/config/locales/en/shared.yml +++ b/config/locales/en/shared.yml @@ -572,6 +572,7 @@ en: changed_last_name: Has your client ever changed their last name? changed_last_name_hint: For example, through marriage or deed poll last_name_at_birth: What was your client's last name at birth? + last_name_at_birth_hint: This lets us check for any records we have for your client under a previous name date_input_fields: date_of_birth_hint: For example, 31 3 1980. date_of_birth_label: Date of birth From 80549408bb318b9a09f48d598a5a2368a99cbf1f Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Thu, 8 Feb 2024 11:47:22 +0000 Subject: [PATCH 07/14] ap-4783: amend visually hidden text by removing aria-prefix --- app/views/shared/check_answers/_client_details.html.erb | 4 ++-- spec/forms/applicants/basic_details_form_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/shared/check_answers/_client_details.html.erb b/app/views/shared/check_answers/_client_details.html.erb index 5be0091c38..f3c9c4c82e 100644 --- a/app/views/shared/check_answers/_client_details.html.erb +++ b/app/views/shared/check_answers/_client_details.html.erb @@ -32,7 +32,7 @@ <%= row.with_action( text: t("generic.change"), href: providers_legal_aid_application_applicant_details_path(@legal_aid_application, anchor: :changed_last_name), - visually_hidden_text: "#{t('.aria_prefix')} #{t('.changed_last_name')}", + visually_hidden_text: t(".changed_last_name"), ) %> <% end %> <% end %> @@ -44,7 +44,7 @@ <%= row.with_action( text: t("generic.change"), href: providers_legal_aid_application_applicant_details_path(@legal_aid_application, anchor: :last_name_at_birth), - visually_hidden_text: "#{t('.aria_prefix')} #{t('.last_name_at_birth')}", + visually_hidden_text: t(".last_name_at_birth"), ) %> <% end %> <% end %> diff --git a/spec/forms/applicants/basic_details_form_spec.rb b/spec/forms/applicants/basic_details_form_spec.rb index 963e2e2866..71fef4dbbe 100644 --- a/spec/forms/applicants/basic_details_form_spec.rb +++ b/spec/forms/applicants/basic_details_form_spec.rb @@ -332,7 +332,7 @@ date_of_birth_1i: "1999", date_of_birth_2i: "12", date_of_birth_3i: "31", - changed_last_name: true, + changed_last_name: "true", last_name_at_birth: "", } end From 09a434d42db8d0e11a50260e0de39672591baae6 Mon Sep 17 00:00:00 2001 From: Katharine Ahern Date: Thu, 8 Feb 2024 12:43:55 +0000 Subject: [PATCH 08/14] ap-4783: make display of last name at birth on cya conditional on whether the provider has stated that the client has changed their last name --- app/views/shared/check_answers/_client_details.html.erb | 2 +- features/providers/check_provider_answers.feature | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/shared/check_answers/_client_details.html.erb b/app/views/shared/check_answers/_client_details.html.erb index f3c9c4c82e..d7a8d348ce 100644 --- a/app/views/shared/check_answers/_client_details.html.erb +++ b/app/views/shared/check_answers/_client_details.html.erb @@ -37,7 +37,7 @@ <% end %> <% end %> - <% if :last_name_at_birth.in?(attributes) %> + <% if :last_name_at_birth.in?(attributes) && !applicant.last_name_at_birth.nil? %> <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__last_name_at_birth" }) do |row| %> <%= row.with_key(text: t(".last_name_at_birth"), classes: "govuk-!-width-one-half") %> <%= row.with_value(text: applicant.last_name_at_birth.presence || applicant.last_name) %> diff --git a/features/providers/check_provider_answers.feature b/features/providers/check_provider_answers.feature index 4ea0061e85..0d1aee0f8e 100644 --- a/features/providers/check_provider_answers.feature +++ b/features/providers/check_provider_answers.feature @@ -16,7 +16,6 @@ Feature: Checking client details answers backwards and forwards | First name | Test | | Last name | Walker | | Has your client ever changed their last name? | No | - | What was your client's last name at birth? | Walker | | Date of birth | 10 January 1980 | | Correspondence address | Transport For London\n98 Petty France\nLondon\nSW1H 9EA | | National Insurance number | JA293483A | @@ -29,7 +28,8 @@ Feature: Checking client details answers backwards and forwards | First name | Test | | Last name | Walker | | Has your client ever changed their last name? | No | - | What was your client's last name at birth? | Walker | + + And I should not see "What was your client's last name at birth?" When I click Check Your Answers Change link for "First name" Then I should be on a page with title "Enter your client's details" @@ -43,7 +43,6 @@ Feature: Checking client details answers backwards and forwards | First name | Fred | | Last name | Bloggs | | Has your client ever changed their last name? | No | - | What was your client's last name at birth? | Bloggs | @javascript Scenario: I am able to return and amend the client's last name at birth @@ -53,7 +52,8 @@ Feature: Checking client details answers backwards and forwards | First name | Test | | Last name | Walker | | Has your client ever changed their last name? | No | - | What was your client's last name at birth? | Walker | + + And I should not see "What was your client's last name at birth?" When I click Check Your Answers Change link for "Changed last name" Then I should be on a page with title "Enter your client's details" From 0e964411f93085a62c96ebbcd8913a61904fe0f1 Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Wed, 7 Feb 2024 12:24:13 +0000 Subject: [PATCH 09/14] AP-4782: Update applicant with surname_at_birth method This adds a helper method that aligns with the CCMS naming convention and allows simple ternary check to return a last_namne_at_birth, if present, or the just the last_name value --- app/models/applicant.rb | 5 +++++ spec/models/applicant_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/app/models/applicant.rb b/app/models/applicant.rb index 9da498d7d6..4bee373bb1 100644 --- a/app/models/applicant.rb +++ b/app/models/applicant.rb @@ -35,6 +35,11 @@ def full_name "#{first_name} #{last_name}".strip end + def surname_at_birth + # used by CCMS generators + last_name_at_birth.presence || last_name + end + def true_layer_token encrypted_true_layer_token&.fetch("token", nil) end diff --git a/spec/models/applicant_spec.rb b/spec/models/applicant_spec.rb index d834220f81..3b697e93e8 100644 --- a/spec/models/applicant_spec.rb +++ b/spec/models/applicant_spec.rb @@ -137,6 +137,26 @@ end end + describe "#surname_at_birth" do + subject(:surname_at_birth) { legal_aid_application.applicant.surname_at_birth } + + let(:legal_aid_application) do + build(:legal_aid_application, :with_transaction_period, applicant:) + end + + context "when a last_name_at_birth is set" do + let(:applicant) { build(:applicant, last_name: "current", last_name_at_birth: "different") } + + it { is_expected.to eql "different" } + end + + context "when a last_name_at_birth is not set" do + let(:applicant) { build(:applicant, last_name: "current", last_name_at_birth: nil) } + + it { is_expected.to eql "current" } + end + end + describe "#age" do subject(:age) { legal_aid_application.applicant.age } From d0a698d3f30155db14fd70273f44f60a76ca49e5 Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Thu, 8 Feb 2024 08:21:43 +0000 Subject: [PATCH 10/14] AP-4782: Add file helper to extract url from wsdl This is based on the code in soap_call and allows tests to not need to hard code urls --- spec/support/file_helpers.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/support/file_helpers.rb b/spec/support/file_helpers.rb index 1834369cd4..e2f5305b44 100644 --- a/spec/support/file_helpers.rb +++ b/spec/support/file_helpers.rb @@ -10,3 +10,9 @@ def squish_xml(xml) def remove_xml_header(xml) xml.gsub("\n", "") end + +def extract_url_from(wsdl) + File.open(wsdl) do |f| + Nokogiri::XML(f).xpath("//soap:address").attribute("location").value + end +end From e679c56c51f6e38ecbb842630def53d7f4a00a76 Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Wed, 7 Feb 2024 07:41:16 +0000 Subject: [PATCH 11/14] AP-4782: Update ApplicantSearchRequestor Add SurnameAtBirth handling Use the new Faraday::SoapCall and update tests --- .../requestors/applicant_search_requestor.rb | 4 +- .../applicant_search_requestor_spec.rb | 45 ++++++++++++++----- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/app/services/ccms/requestors/applicant_search_requestor.rb b/app/services/ccms/requestors/applicant_search_requestor.rb index 9c29b6eadd..4cf9fe7dfa 100644 --- a/app/services/ccms/requestors/applicant_search_requestor.rb +++ b/app/services/ccms/requestors/applicant_search_requestor.rb @@ -10,7 +10,7 @@ def initialize(applicant, provider_username) end def call - soap_client.call(:get_client_details, xml: request_xml) + Faraday::SoapCall.new(wsdl_location, :ccms).call(request_xml) end private @@ -35,7 +35,7 @@ def record_count(xml) def search_criteria(xml) xml.__send__(:"clientbim:ClientInfo") do xml.__send__(:"clientbio:FirstName", @applicant.first_name) - xml.__send__(:"clientbio:Surname", @applicant.last_name) + xml.__send__(:"clientbio:Surname", @applicant.surname_at_birth) xml.__send__(:"clientbio:DateOfBirth", @applicant.date_of_birth.to_fs(:ccms_date)) xml.__send__(:"clientbio:NINumber", @applicant.national_insurance_number) end diff --git a/spec/services/ccms/requestors/applicant_search_requestor_spec.rb b/spec/services/ccms/requestors/applicant_search_requestor_spec.rb index 84db481889..24b405fb93 100644 --- a/spec/services/ccms/requestors/applicant_search_requestor_spec.rb +++ b/spec/services/ccms/requestors/applicant_search_requestor_spec.rb @@ -3,7 +3,6 @@ module CCMS module Requestors RSpec.describe ApplicantSearchRequestor, :ccms do - let(:expected_xml) { ccms_data_from_file "applicant_search_request.xml" } let(:expected_tx_id) { "20190101121530000000" } let(:applicant) do create(:applicant, @@ -22,12 +21,35 @@ module Requestors expect(requestor.formatted_xml).to be_soap_envelope_with( command: "clientbim:ClientInqRQ", transaction_id: expected_tx_id, - matching: [ - "#{applicant.last_name}", - "#{applicant.first_name}", + matching: %w[ + lenovo + hurlock ], ) end + + context "when the applicant has a surname_at_birth" do + let(:applicant) do + create(:applicant, + first_name: "lenovo", + last_name: "hurlock", + last_name_at_birth: "different", + date_of_birth: Date.new(1969, 1, 1), + national_insurance_number: "YS327299B") + end + + it "generates the expected XML" do + allow(requestor).to receive(:transaction_request_id).and_return(expected_tx_id) + expect(requestor.formatted_xml).to be_soap_envelope_with( + command: "clientbim:ClientInqRQ", + transaction_id: expected_tx_id, + matching: %w[ + different + lenovo + ], + ) + end + end end describe "#transaction_request_id" do @@ -39,16 +61,17 @@ module Requestors end describe "#call" do - let(:soap_client_double) { Savon.client(env_namespace: :soap, wsdl: requestor.__send__(:wsdl_location)) } - let(:expected_soap_operation) { :get_client_details } - let(:expected_xml) { requestor.__send__(:request_xml) } - before do - allow(requestor).to receive(:soap_client).and_return(soap_client_double) + allow(Faraday::SoapCall).to receive(:new).and_return(soap_call) + stub_request(:post, expected_url) end - it "calls the savon soap client" do - expect(soap_client_double).to receive(:call).with(expected_soap_operation, xml: expected_xml) + let(:soap_call) { instance_double(Faraday::SoapCall) } + let(:expected_xml) { requestor.__send__(:request_xml) } + let(:expected_url) { extract_url_from(requestor.__send__(:wsdl_location)) } + + it "invokes the fadaday soap_call" do + expect(soap_call).to receive(:call).with(expected_xml).once requestor.call end end From 74139a15da14b796964e61c06329652d2e633e11 Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Wed, 7 Feb 2024 09:39:12 +0000 Subject: [PATCH 12/14] AP-4782: Update ApplicantAddRequestor Add the SurnameAtBirth handler and update to use Faraday::SoapCall --- .../requestors/applicant_add_requestor.rb | 3 +- .../applicant_add_requestor_spec.rb | 54 ++++++++++++++----- .../applicant_search_requestor_spec.rb | 4 +- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/app/services/ccms/requestors/applicant_add_requestor.rb b/app/services/ccms/requestors/applicant_add_requestor.rb index 37afcc299a..e9618750b3 100644 --- a/app/services/ccms/requestors/applicant_add_requestor.rb +++ b/app/services/ccms/requestors/applicant_add_requestor.rb @@ -14,7 +14,7 @@ def initialize(applicant, provider_username) end def call - soap_client.call(:create_client, xml: request_xml) + Faraday::SoapCall.new(wsdl_location, :ccms).call(request_xml) end private @@ -42,6 +42,7 @@ def client(xml) def name(xml) xml.__send__(:"common:Surname", applicant.last_name) xml.__send__(:"common:FirstName", applicant.first_name) + xml.__send__(:"common:SurnameAtBirth", applicant.surname_at_birth.presence) end # this is all mandatory: we don't hold any of this data except date of birth diff --git a/spec/services/ccms/requestors/applicant_add_requestor_spec.rb b/spec/services/ccms/requestors/applicant_add_requestor_spec.rb index dd21633b3a..81226fe309 100644 --- a/spec/services/ccms/requestors/applicant_add_requestor_spec.rb +++ b/spec/services/ccms/requestors/applicant_add_requestor_spec.rb @@ -5,7 +5,7 @@ module Requestors RSpec.describe ApplicantAddRequestor, :ccms do let(:expected_xml) { ccms_data_from_file "applicant_add_request.xml" } let(:expected_tx_id) { "20190101121530000000" } - + let(:last_name_at_birth) { nil } let(:address) do create(:address, address_line_one: "102 Petty France", @@ -20,6 +20,8 @@ module Requestors address:, first_name: "lenovo", last_name: "Hurlock", + last_name_at_birth:, + national_insurance_number: "QQ123456Q", date_of_birth: Date.new(1969, 1, 1)) end @@ -34,16 +36,41 @@ module Requestors command: "clientbim:ClientAddRQ", transaction_id: expected_tx_id, matching: [ - "#{applicant.national_insurance_number}", - "#{applicant.address.address_line_one}", - "#{applicant.address.address_line_two}", - "#{applicant.address.city}", - "#{applicant.address.county}", + "Hurlock", + "Hurlock", + "QQ123456Q", + "102 Petty France", + "St James Park", + "London", + "Westminster", "GBR", "SW1H 9AJ", ], ) end + + context "when the applicant has a surname_at_birth" do + let(:last_name_at_birth) { "different" } + + it "generates the expected XML" do + allow(requestor).to receive(:transaction_request_id).and_return(expected_tx_id) + expect(requestor.formatted_xml).to be_soap_envelope_with( + command: "clientbim:ClientAddRQ", + transaction_id: expected_tx_id, + matching: [ + "Hurlock", + "different", + "QQ123456Q", + "102 Petty France", + "St James Park", + "London", + "Westminster", + "GBR", + "SW1H 9AJ", + ], + ) + end + end end describe "#transaction_request_id" do @@ -61,16 +88,17 @@ module Requestors end describe "#call" do - let(:soap_client_double) { Savon.client(env_namespace: :soap, wsdl: requestor.__send__(:wsdl_location)) } - let(:expected_soap_operation) { :create_client } - let(:expected_xml) { requestor.__send__(:request_xml) } - before do - allow(requestor).to receive(:soap_client).and_return(soap_client_double) + allow(Faraday::SoapCall).to receive(:new).and_return(soap_call) + stub_request(:post, expected_url) end - it "calls the savon soap client" do - expect(soap_client_double).to receive(:call).with(expected_soap_operation, xml: expected_xml) + let(:soap_call) { instance_double(Faraday::SoapCall) } + let(:expected_xml) { requestor.__send__(:request_xml) } + let(:expected_url) { extract_url_from(requestor.__send__(:wsdl_location)) } + + it "invokes the fadaday soap_call" do + expect(soap_call).to receive(:call).with(expected_xml).once requestor.call end end diff --git a/spec/services/ccms/requestors/applicant_search_requestor_spec.rb b/spec/services/ccms/requestors/applicant_search_requestor_spec.rb index 24b405fb93..88d75a4328 100644 --- a/spec/services/ccms/requestors/applicant_search_requestor_spec.rb +++ b/spec/services/ccms/requestors/applicant_search_requestor_spec.rb @@ -22,8 +22,8 @@ module Requestors command: "clientbim:ClientInqRQ", transaction_id: expected_tx_id, matching: %w[ - lenovo - hurlock + hurlock + lenovo ], ) end From 221ce963759a61e07433570a7d6f69b17a5bc15b Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Wed, 7 Feb 2024 12:26:29 +0000 Subject: [PATCH 13/14] AP-4782: Update CaseAddRequestor to populate SurnameAtBirth --- .../ccms/requestors/case_add_requestor.rb | 2 +- config/ccms/attribute_block_configs/base.yml | 4 +- ...case_add_request_with_surname_at_birth.xml | 3210 +++++++++++++++++ .../requestors/case_add_requestor_spec.rb | 37 +- 4 files changed, 3241 insertions(+), 12 deletions(-) create mode 100644 spec/data/ccms/case_add_request_with_surname_at_birth.xml diff --git a/app/services/ccms/requestors/case_add_requestor.rb b/app/services/ccms/requestors/case_add_requestor.rb index ed8f0a8a0b..9148c62be2 100644 --- a/app/services/ccms/requestors/case_add_requestor.rb +++ b/app/services/ccms/requestors/case_add_requestor.rb @@ -27,7 +27,7 @@ def initialize(submission, options) def call save_request(@options[:case_type]) unless Rails.env.production? - soap_client.call(:create_case_application, xml: request_xml) unless @options[:no_call] + Faraday::SoapCall.new(wsdl_location, :ccms).call(request_xml) end private diff --git a/config/ccms/attribute_block_configs/base.yml b/config/ccms/attribute_block_configs/base.yml index 43e1dc2dde..975486fcc0 100644 --- a/config/ccms/attribute_block_configs/base.yml +++ b/config/ccms/attribute_block_configs/base.yml @@ -376,7 +376,7 @@ global_means: response_type: currency user_defined: false SURNAME_AT_BIRTH: - value: '#applicant_last_name' + value: '#applicant_surname_at_birth' br100_meaning: 'Client: Surname at birth' response_type: text user_defined: true @@ -2819,7 +2819,7 @@ global_merits: response_type: boolean user_defined: false SURNAME_AT_BIRTH: - value: '#applicant_last_name' + value: '#applicant_surname_at_birth' br100_meaning: 'Client: Surname at birth' response_type: text user_defined: true diff --git a/spec/data/ccms/case_add_request_with_surname_at_birth.xml b/spec/data/ccms/case_add_request_with_surname_at_birth.xml new file mode 100644 index 0000000000..550f577659 --- /dev/null +++ b/spec/data/ccms/case_add_request_with_surname_at_birth.xml @@ -0,0 +1,3210 @@ + + + + + + FakeUser + FakePassword + + + + + + + 202011241154290000006983477 + ENG + saturnina + EXTERNAL + + + 300000000001 + + + + + Shery + Ledner + + CASE + + 10 Foobar Lane + Bluewater + Ipswich + Essex + GBR + GH0 8NY + + + 169 + 4727432767 + + + + + + MAT + Family + 25000.00 + + + + OPPONENT_88123456 + false + + + + + Test-Opponent + Joffrey + + + NONE + OPP + + + + + + OPPONENT_88123457 + false + + + + + TestChild + First + + 2019-01-20 + + UNKNOWN + CHILD + + + + + + OPPONENT_88123458 + false + + + + + TestChild + Second + + 2020-02-15 + + UNKNOWN + CHILD + + + + + + + + P_55000001 + Draft + true + + DA001 + to be represented on an application for an injunction, order or declaration under the inherent jurisdiction of the court. + MINJN + 3 + 8 + A + + + FM062 + Limited to all steps up to and including final hearing and any action necessary to implement (but not enforce) the order. + false + + + + + + + + + + CLIENT_PROV_LA + true + + + + + SUMMARY + + 1 + VALUABLE_POSSESSION + + the valuable possession1 + + + VALPOSSESS_INPUT_T_12WP2_7A + text + Aggregate of valuable possessions + true + + + VALPOSSESS_INPUT_C_12WP2_8A + currency + 144524.74 + true + + + + + + 2 + PROCEEDING + + P_55000001 + + + CLIENT_INVOLVEMENT_TYPE + text + A + true + + + SCOPE_LIMIT_IS_DEFAULT + boolean + true + true + + + LEVEL_OF_SERVICE + text + 3 + true + + + PROCEEDING_ID + text + P_55000001 + true + + + MATTER_TYPE + text + MINJN + true + + + NEW_OR_EXISTING + text + NEW + true + + + REQUESTED_SCOPE + text + FM062 + true + + + PROCEEDING_NAME + text + DA001 + true + + + + + + 3 + OPPONENT_OTHER_PARTIES + + OPPONENT_88123456 + + + OTHER_PARTY_NAME + text + Joffrey Test-Opponent + true + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OTHER_PARTY_ID + text + OPPONENT_88123456 + true + + + RELATIONSHIP_TO_CASE + text + OPP + true + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + + + OPPONENT_88123457 + + + OTHER_PARTY_NAME + text + First TestChild + true + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OTHER_PARTY_ID + text + OPPONENT_88123457 + true + + + RELATIONSHIP_TO_CASE + text + CHILD + true + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + + + OPPONENT_88123458 + + + OTHER_PARTY_NAME + text + Second TestChild + true + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OTHER_PARTY_ID + text + OPPONENT_88123458 + true + + + RELATIONSHIP_TO_CASE + text + CHILD + true + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + + + + 4 + global + + 300000000001 + + + APPLY_CASE_MEANS_REVIEW + boolean + false + false + + + IS_PASSPORTED + text + YES + true + + + BEN_DOB + date + 10-04-1977 + false + + + BEN_NI_NO + text + EG587804M + false + + + BEN_SURNAME + text + Ledner + false + + + COUNTRY + text + GBR + true + + + GB_INPUT_B_14WP2_8A + boolean + true + true + + + OUT_CAP_CONT + currency + 0.00 + false + + + GB_PROC_B_41WP3_11A + boolean + false + false + + + GB_ROUT_B_43WP3_13A + boolean + false + false + + + GB_PROC_B_40WP3_17A + boolean + false + false + + + GB_PROC_B_40WP3_29A + boolean + false + false + + + GB_INPUT_B_14WP2_7A + boolean + false + true + + + GB_INPUT_B_3WP2_1A + boolean + true + true + + + GB_PROC_B_41WP3_10A + boolean + false + false + + + APP_AMEND_TYPE + text + SUB + true + + + CATEGORY_OF_LAW + text + MAT + true + + + HIGH_PROFILE + boolean + false + true + + + INCOME_CONT + currency + 0.00 + false + + + SURNAME_AT_BIRTH + text + different + true + + + LAR_INPUT_B_37WP2_4A + boolean + false + true + + + LAR_PER_RES_INPUT_B_37WP2_7A + boolean + false + true + + + LAR_PROC_B_40WP3_29A + boolean + false + false + + + GB_PROC_B_40WP3_15A + boolean + false + false + + + GB_PROC_B_40WP3_39A + boolean + false + false + + + GB_PROC_B_40WP3_27A + boolean + false + false + + + GB_INPUT_B_4WP3_209A + boolean + false + true + + + LAR_INPUT_T_1WP2_8A + text + . + true + + + GB_INPUT_B_8WP2_1A + boolean + false + true + + + GB_PROC_B_41WP3_20A + boolean + false + false + + + GB_INPUT_B_38WP3_3SCREEN + boolean + true + true + + + POA_OR_BILL_FLAG + text + N/A + true + + + GB_INPUT_B_16WP2_7A + boolean + true + true + + + GB_PROC_B_39WP3_41A + boolean + false + false + + + GB_PROC_B_41WP3_15A + boolean + false + false + + + GB_INPUT_B_18WP2_2A + boolean + false + true + + + GB_PROC_B_41WP3_14A + boolean + false + false + + + GB_PROC_B_39WP3_40A + boolean + false + false + + + GB_INPUT_B_1WP1_2A + boolean + false + true + + + GB_PROC_B_39WP3_31A + boolean + false + false + + + DEVOLVED_POWERS_CONTRACT_FLAG + text + Yes - Excluding JR Proceedings + true + + + GB_PROC_B_41WP3_13A + boolean + false + false + + + SURNAME + text + Ledner + true + + + GB_INPUT_B_18WP2_4A + boolean + false + true + + + GB_PROC_B_40WP3_19A + boolean + false + false + + + GB_PROC_B_40WP3_9A + boolean + false + false + + + GB_PROC_B_39WP3_30A + boolean + false + false + + + GB_PROC_B_39WP3_42A + boolean + false + false + + + GB_PROC_B_41WP3_12A + boolean + false + false + + + GB_PROC_B_40WP3_10A + boolean + false + false + + + GB_PROC_B_40WP3_46A + boolean + false + false + + + GB_PROC_B_40WP3_58A + boolean + false + false + + + REQ_COST_LIMITATION + currency + 25000.00 + true + + + PUI_CLIENT_CAP_CONT + currency + 0.00 + false + + + GB_PROC_B_41WP3_6A + boolean + false + false + + + GB_PROC_B_39WP3_21A + boolean + false + false + + + GB_PROC_B_39WP3_33A + boolean + false + false + + + POST_CODE + text + GH0 8NY + true + + + GB_PROC_B_40WP3_33A + boolean + false + false + + + GB_PROC_B_40WP3_21A + boolean + false + false + + + GB_PROC_B_40WP3_57A + boolean + false + false + + + GB_PROC_B_40WP3_45A + boolean + false + false + + + GB_INPUT_B_17WP2_7A + boolean + false + true + + + GB_INPUT_B_17WP2_8A + boolean + false + true + + + GB_PROC_B_39WP3_32A + boolean + false + false + + + GB_INPUT_B_5WP1_18A + boolean + true + true + + + GB_PROC_B_41WP3_5A + boolean + false + false + + + GB_PROC_B_39WP3_20A + boolean + false + false + + + GB_INPUT_B_18WP2_6A + boolean + false + true + + + GB_PROC_B_40WP3_44A + boolean + false + false + + + GB_PROC_B_40WP3_56A + boolean + false + false + + + GB_PROC_B_41WP3_4A + boolean + false + false + + + GB_PROC_B_39WP3_47A + boolean + false + false + + + GB_PROC_B_39WP3_23A + boolean + false + false + + + GB_PROC_B_39WP3_35A + boolean + false + false + + + GB_DECL_B_38WP3_13A + boolean + true + true + + + GB_PROC_B_40WP3_31A + boolean + false + false + + + GB_PROC_B_40WP3_55A + boolean + false + false + + + GB_PROC_B_40WP3_43A + boolean + false + false + + + GB_INFER_B_1WP1_1A + boolean + false + false + + + GB_PROC_B_41WP3_3A + boolean + false + false + + + GB_PROC_B_39WP3_22A + boolean + false + false + + + GB_PROC_B_39WP3_34A + boolean + false + false + + + GB_PROC_B_39WP3_46A + boolean + false + false + + + GB_PROC_B_40WP3_42A + boolean + false + false + + + GB_PROC_B_40WP3_4A + boolean + false + false + + + GB_INPUT_B_1WP2_22A + boolean + false + true + + + GB_PROC_B_41WP3_2A + boolean + false + false + + + GB_INPUT_B_1WP4_3B + boolean + false + true + + + GB_PROC_B_39WP3_25A + boolean + false + false + + + GB_PROC_B_39WP3_37A + boolean + false + false + + + PUI_CLIENT_ELIGIBILITY + text + In Scope + false + + + GB_INPUT_B_7WP2_1A + boolean + false + true + + + GB_INPUT_B_4WP2_1A + boolean + true + true + + + GB_PROC_B_40WP3_13A + boolean + false + false + + + GB_PROC_B_40WP3_25A + boolean + false + false + + + GB_PROC_B_40WP3_49A + boolean + false + false + + + GB_PROC_B_40WP3_3A + boolean + false + false + + + GB_INPUT_B_1WP4_2B + boolean + false + true + + + GB_PROC_B_39WP3_36A + boolean + false + false + + + GB_PROC_B_41WP3_1A + boolean + false + false + + + GB_PROC_B_39WP3_24A + boolean + false + false + + + APPLICATION_CASE_REF + text + 300000000001 + true + + + GB_PROC_B_40WP3_48A + boolean + false + false + + + GB_INPUT_B_5WP1_3A + boolean + false + true + + + GB_PROC_B_40WP3_2A + boolean + false + false + + + GB_PROC_B_39WP3_39A + boolean + false + false + + + GB_INPUT_B_6WP2_1A + boolean + true + true + + + GB_INPUT_B_1WP4_1B + boolean + false + true + + + GB_PROC_B_39WP3_15A + boolean + false + false + + + GB_INPUT_B_5WP2_1A + boolean + true + true + + + GB_PROC_B_40WP3_35A + boolean + false + false + + + GB_PROC_B_40WP3_23A + boolean + false + false + + + GB_PROC_B_40WP3_47A + boolean + false + false + + + GB_PROC_B_40WP3_1A + boolean + false + false + + + GB_PROC_B_39WP3_38A + boolean + false + false + + + MEANS_TASK_AUTO_GEN + boolean + false + false + + + GB_PROC_B_39WP3_14A + boolean + false + false + + + MEANS_SUBMISSION_PG_DISPLAYED + boolean + true + true + + + GB_INPUT_B_11WP3_367A + boolean + false + true + + + GB_PROC_B_39WP3_29A + boolean + false + false + + + GB_PROC_B_39WP3_17A + boolean + false + false + + + GB_INPUT_B_1WP2_27A + boolean + false + true + + + GB_PROC_B_39WP3_16A + boolean + false + false + + + GB_INPUT_B_1WP2_14A + boolean + false + true + + + GB_INPUT_B_5WP1_22A + boolean + false + true + + + GB_INPUT_B_39WP3_70B + boolean + false + true + + + GB_PROC_B_39WP3_19A + boolean + false + false + + + GB_INPUT_B_41WP3_40A + boolean + false + true + + + GB_PROC_B_39WP3_1A + boolean + false + false + + + GB_INPUT_B_2WP2_1A + boolean + true + true + + + GB_INPUT_B_9WP2_1A + boolean + false + true + + + GB_PROC_B_39WP3_18A + boolean + false + false + + + GB_INPUT_B_10WP2_1A + boolean + false + true + + + GB_INPUT_B_1WP2_36A + boolean + false + true + + + GB_INPUT_D_18WP2_1A + date + 25-03-2020 + true + + + LAR_INFER_B_1WP1_36A + boolean + true + false + + + GB_PROC_B_40WP3_54A + boolean + false + false + + + DEFAULT_COST_LIMITATION + currency + 25000.00 + true + + + GB_DECL_B_38WP3_11A + boolean + true + false + + + NEW_APPL_OR_AMENDMENT + text + APPLICATION + true + + + GB_INPUT_B_13WP2_7A + boolean + false + true + + + GB_PROC_B_40WP3_53A + boolean + false + false + + + GB_PROC_B_40WP3_41A + boolean + false + false + + + GB_PROC_B_39WP3_2A + boolean + false + false + + + GB_PROC_B_41WP3_9A + boolean + false + false + + + LAR_SCOPE_FLAG + boolean + true + true + + + GB_PROC_B_40WP3_40A + boolean + false + false + + + GB_PROC_B_40WP3_52A + boolean + false + false + + + GB_PROC_B_41WP3_8A + boolean + false + false + + + GB_PROC_B_40WP3_51A + boolean + false + false + + + GB_RFLAG_B_2WP3_01A + boolean + false + false + + + GB_INPUT_B_38WP3_2SCREEN + boolean + true + true + + + GB_PROC_B_41WP3_7A + boolean + false + false + + + COST_LIMIT_CHANGED_FLAG + text + false + true + + + GB_INPUT_B_15WP2_8A + boolean + true + true + + + GB_PROC_B_40WP3_50A + boolean + false + false + + + MEANS_EVIDENCE_PROVIDED + boolean + true + true + + + LAR_PROC_B_39WP3_53A + boolean + false + false + + + GB_PROC_B_39WP3_7A + boolean + false + false + + + GB_INPUT_B_6WP3_240A + boolean + false + true + + + LAR_PROC_B_40WP3_31A + boolean + false + false + + + LAR_PROC_B_39WP3_54A + boolean + false + false + + + GB_INPUT_B_1WP3_165A + boolean + false + false + + + LAR_PROC_B_40WP3_30A + boolean + false + false + + + USER_TYPE + text + EXTERNAL + true + + + GB_PROC_B_41WP3_18A + boolean + false + false + + + USER_PROVIDER_FIRM_ID + number + 169 + true + + + CLIENT_ELIGIBILITY + text + In Scope + false + + + GB_PROC_B_41WP3_17A + boolean + false + false + + + DATE_ASSESSMENT_STARTED + date + 25-03-2020 + true + + + GB_PROC_B_39WP3_8A + boolean + false + false + + + LAR_PROC_B_40WP3_32A + boolean + false + false + + + GB_PROC_B_41WP3_16A + boolean + false + false + + + GB_INPUT_B_12WP2_2A + boolean + true + true + + + MEANS_EVIDENCE_REQD + boolean + false + false + + + GB_INPUT_B_11WP2_3A + boolean + false + true + + + FIRST_NAME + text + Shery + true + + + DATE_OF_BIRTH + date + 10-04-1977 + true + + + CAP_CONT + currency + 0.00 + false + + + MARITIAL_STATUS + text + UNKNOWN + true + + + PASSPORTED_NINO + text + EG587804M + true + + + APPLICATION_FROM_APPLY + boolean + true + false + + + _SYSTEM_PUI_USERID + text + patrick_rath@example.net + true + + + + + + + + + + + + + ASSESS_COMPLETE + true + + + + + SUMMARY + + 1 + global + + 300000000001 + + + APPLY_CASE_MEANS_REVIEW + boolean + false + false + + + GB_INFER_T_6WP1_66A + text + CLIENT + false + + + COPY_SEPARATE_STATEMENT + boolean + false + true + + + EVIDENCE_ICACU_LETTER + boolean + false + false + + + DECLARATION_WILL_BE_SIGNED + boolean + true + true + + + COURT_ATTEND_IN_LAST_12_MONTHS + boolean + false + true + + + MERITS_EVIDENCE_PROVIDED + boolean + true + true + + + EVIDENCE_CA_POLICE_CAUTION + boolean + false + false + + + EXISTING_COUNSEL_OPINION + boolean + false + true + + + CASES_FEES_DISTRIBUTED + number + 1 + true + + + EVID_DEC_AGAINST_INSTRUCTIONS + boolean + false + false + + + REASON_APPLYING_FHH_LR + text + . + true + + + URGENT_HEARING_DATE + date + 25-03-2020 + true + + + EVIDENCE_AMD_COUNSEL_OPINION + boolean + false + false + + + EVIDENCE_CA_INJ_PSO + boolean + false + false + + + EVIDENCE_DV_POLICE_CAUTION_2A + boolean + false + false + + + APP_AMEND_TYPE + text + SUB + true + + + EVIDENCE_DV_PUB_BODY + boolean + false + false + + + EVIDENCE_EXISTING_EXPERT_RPT + boolean + false + false + + + EVIDENCE_AMD_CORRESPONDENCE + boolean + false + false + + + EMERGENCY_FC_CRITERIA + text + . + true + + + CAT_OF_LAW_DESCRIPTION + text + Family + false + + + CATEGORY_OF_LAW + text + MAT + true + + + HIGH_PROFILE + boolean + false + true + + + EVIDENCE_PLEADINGS_REQUIRED + boolean + false + false + + + SURNAME_AT_BIRTH + text + different + true + + + SUBSTANTIVE_APP + boolean + true + false + + + EVIDENCE_AMD_COURT_ORDER + boolean + false + false + + + EVIDENCE_DV_REFUGE + boolean + false + false + + + ACTION_AGAINST_POLICE + boolean + false + false + + + EVIDENCE_DV_SUPP_SERVICE + boolean + false + false + + + NEGOTIATION_CORRESPONDENCE + boolean + false + true + + + EVIDENCE_AMD_EXPERT_RPT + boolean + false + false + + + DEFAULT_COST_LIMITATION + currency + 25000.00 + true + + + EVIDENCE_EXISTING_COUNSEL_OP + boolean + false + false + + + EVIDENCE_DV_PUBLIC_BODY + boolean + false + false + + + EVIDENCE_DV_HEALTH_LETTER + boolean + false + false + + + EVIDENCE_COPY_PR_ORDER + boolean + false + false + + + COUNTRY + text + GBR + true + + + MERITS_ROUTING + text + SFM + false + + + EVIDENCE_PR_AGREEMENT + boolean + false + false + + + DATE_CLIENT_VISITED_FIRM + date + 25-03-2020 + true + + + EVIDENCE_CA_SOCSERV_LTTR + boolean + false + false + + + NEW_APPL_OR_AMENDMENT + text + APPLICATION + true + + + EVIDENCE_DV_HOUSING_AUTHORITY + boolean + false + false + + + EVIDENCE_DV_IMMRULES_289A + boolean + false + false + + + EXISTING_EXPERT_REPORTS + boolean + false + true + + + _SYSTEM_PUI_USERID + text + patrick_rath@example.net + true + + + EVIDENCE_PRE_ACTION_DISCLOSURE + boolean + false + false + + + COST_LIMIT_CHANGED + boolean + false + false + + + EVIDENCE_DV_DVPN_2 + boolean + false + false + + + MAIN_PURPOSE_OF_APPLICATION + text + . + true + + + EVIDENCE_EXISTING_STATEMENT + boolean + false + false + + + EVIDENCE_DV_COURT_ORDER + boolean + false + false + + + EVIDENCE_IQ_REPORT_ON_DEATH + boolean + false + false + + + APP_GRANTED_USING_DP + boolean + false + false + + + OTHER_PARTIES_MAY_BENEFIT + boolean + false + true + + + EVIDENCE_OMBUDSMAN_COMP_RPT + boolean + false + false + + + ACTUAL_LIKELY_COSTS_EXCEED_25K + boolean + false + true + + + EVIDENCE_DV_CONVICTION + boolean + false + false + + + CLIENT_REQ_SEP_REP + boolean + true + true + + + CLIENT_AGE + number + 42 + false + + + DEVOLVED_POWERS_CONTRACT_FLAG + text + Yes - Excluding JR Proceedings + true + + + SURNAME + text + Ledner + true + + + EVIDENCE_DV_CRIM_PROCS_2A + boolean + false + false + + + DECLARATION_IDENTIFIER + boolean + false + true + + + EVIDENCE_DV_FIN_ABUSE + boolean + false + false + + + OTHERS_WHO_MAY_BENEFIT + boolean + false + true + + + APP_BROUGHT_BY_PERSONAL_REP + boolean + false + true + + + EVIDENCE_RELEVANT_CORR_ADR + boolean + false + false + + + CLIENT_HAS_DV_RISK + boolean + true + true + + + COST_LIMIT_CHANGED_FLAG + text + false + true + + + APP_IS_FAMILY + boolean + true + false + + + EVIDENCE_AMD_PLEADINGS + boolean + false + false + + + EVIDENCE_RELEVANT_CORR_SETTLE + boolean + false + false + + + REQ_COST_LIMITATION + currency + 25000.00 + true + + + EVIDENCE_CA_UNSPENT_CONVICTION + boolean + false + false + + + EVIDENCE_IQ_CORONER_CORR + boolean + false + false + + + POST_CODE + text + GH0 8NY + true + + + EVIDENCE_CA_POLICE_BAIL + boolean + false + false + + + EVIDENCE_DV_PARTY_ON_BAIL_2A + boolean + false + false + + + DEFAULT_COST_LIMITATION_MERITS + currency + 25000.00 + false + + + ECF_FLAG + boolean + false + true + + + MENTAL_HEAL_ACT_MENTAL_CAP_ACT + boolean + false + true + + + EVIDENCE_CA_SOCSERV_ASSESS + boolean + false + false + + + EVIDENCE_WARNING_LETTER + boolean + false + false + + + USER_TYPE + text + EXTERNAL + true + + + EVIDENCE_EXISTING_CT_ORDER + boolean + false + false + + + EVIDENCE_IQ_COSTS_SCHEDULE + boolean + false + false + + + USER_PROVIDER_FIRM_ID + number + 169 + true + + + MERITS_EVIDENCE_REQD + boolean + false + false + + + CASE_OWNER_STD_FAMILY_MERITS + boolean + true + false + + + EVIDENCE_DV_FINDING_FACT_2A + boolean + false + false + + + EVIDENCE_EXPERT_REPORT + boolean + false + false + + + REASON_SEPARATE_REP_REQ + text + . + true + + + PROCS_ARE_BEFORE_THE_COURT + boolean + false + true + + + URGENT_FLAG + boolean + false + true + + + EVIDENCE_MEDIATOR_APP7A + boolean + false + false + + + DATE_ASSESSMENT_STARTED + date + 25-03-2020 + true + + + CLIENT_HAS_RECEIVED_LA_BEFORE + boolean + false + true + + + UPLOAD_SEPARATE_STATEMENT + boolean + false + true + + + ECFDV_18A + boolean + false + true + + + FH_LOWER_PROVIDED + boolean + false + true + + + EVIDENCE_LETTER_BEFORE_ACTION + boolean + false + false + + + REASON_NO_ATTEMPT_TO_SETTLE + text + . + true + + + EVIDENCE_DV_IDVA + boolean + false + false + + + CAT_OF_LAW_HIGH_LEVEL + text + Family + false + + + EVIDENCE_DV_PROT_INJUNCT + boolean + false + false + + + EVIDENCE_DV_SUPPORT_ORG + boolean + false + false + + + EVIDENCE_DV_UNDERTAKING_2A + boolean + false + false + + + EVIDENCE_CA_CRIME_PROCS + boolean + false + false + + + CAT_OF_LAW_MEANING + text + Inherent jurisdiction high court injunction + false + + + APPLICATION_CASE_REF + text + 300000000001 + true + + + AMENDMENT + boolean + false + false + + + EVIDENCE_CA_PROTECTIVE_INJ + boolean + false + false + + + FIRST_NAME + text + Shery + true + + + EVIDENCE_CA_FINDING_FACT + boolean + false + false + + + DECLARATION_REVOKE_IMP_SUBDP + boolean + true + true + + + DATE_OF_BIRTH + date + 10-04-1977 + true + + + MERITS_DECLARATION_SCREEN + boolean + true + true + + + EVIDENCE_AMD_SOLICITOR_RPT + boolean + false + false + + + APPLICATION_FROM_APPLY + boolean + true + false + + + NON_MAND_EVIDENCE_AMD_CORR + boolean + false + false + + + NON_MAND_EVIDENCE_AMD_COUNSEL + boolean + false + false + + + NON_MAND_EVIDENCE_AMD_CT_ORDER + boolean + false + false + + + NON_MAND_EVIDENCE_AMD_EXPERT + boolean + false + false + + + NON_MAND_EVIDENCE_AMD_PLEAD + boolean + false + false + + + NON_MAND_EVIDENCE_AMD_SOLS_RPT + boolean + false + false + + + NON_MAND_EVIDENCE_CORR_ADR + boolean + false + false + + + NON_MAND_EVIDENCE_CORR_SETTLE + boolean + false + false + + + NON_MAND_EVIDENCE_COUNSEL_OP + boolean + false + false + + + NON_MAND_EVIDENCE_CTORDER + boolean + false + false + + + NON_MAND_EVIDENCE_EXPERT_EXIST + boolean + false + false + + + NON_MAND_EVIDENCE_EXPERT_RPT + boolean + false + false + + + NON_MAND_EVIDENCE_ICA_LETTER + boolean + false + false + + + NON_MAND_EVIDENCE_LTTR_ACTION + boolean + false + false + + + NON_MAND_EVIDENCE_OMBUD_RPT + boolean + false + false + + + NON_MAND_EVIDENCE_PLEADINGS + boolean + false + false + + + NON_MAND_EVIDENCE_PRE_ACT_DISC + boolean + false + false + + + NON_MAND_EVIDENCE_SEP_STATE + boolean + false + false + + + NON_MAND_EVIDENCE_WARNING_LTTR + boolean + false + false + + + + + + 2 + PROCEEDING + + P_55000001 + + + REQUESTED_SCOPE + text + FM062 + true + + + PROCEEDING_ID + text + P_55000001 + true + + + LEVEL_OF_SERVICE + text + 3 + true + + + SCOPE_LIMIT_IS_DEFAULT + boolean + true + true + + + PROCEEDING_APPLICATION_TYPE + text + Substantive + false + + + WARNING_LETTER_SENT + boolean + false + true + + + POLICE_NOTIFIED + boolean + true + true + + + FAMILY_PROSPECTS_OF_SUCCESS + text + Marginal + true + + + INJ_RESPONDENT_CAPACITY + boolean + false + true + + + PROCEEDING_NAME + text + DA001 + true + + + BAIL_CONDITIONS_SET + boolean + true + true + + + CHILD_PARTIES_C + boolean + false + true + + + NEW_OR_EXISTING + text + NEW + true + + + LEAD_PROCEEDING + boolean + true + true + + + INJ_REASON_NO_WARNING_LETTER + text + . + true + + + INJ_RECENT_INCIDENT_DETAIL + text + . + true + + + INJ_REASON_POLICE_NOT_NOTIFIED + text + . + true + + + CLIENT_INVOLVEMENT_TYPE + text + A + true + + + MATTER_TYPE + text + MINJN + true + + + PROCEEDING_LEVEL_OF_SERVICE + text + Full Representation + false + + + UNLAWFUL_REMOVAL_OF_CHILDREN_C + boolean + false + false + + + + + + 4 + OPPONENT_OTHER_PARTIES + + OPPONENT_88123456 + + + RELATIONSHIP_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_CASE_INTERVENOR + boolean + false + false + + + RELATIONSHIP_TENANT + boolean + false + false + + + RELATIONSHIP_MEDICAL_PRO + boolean + false + false + + + RELATIONSHIP_CASE_OPPONENT + boolean + true + false + + + RELATIONSHIP_EMPLOYER + boolean + false + false + + + RELATIONSHIP_NONE + boolean + false + false + + + OTHER_PARTY_PERSON + boolean + true + false + + + PARTY_IS_A_CHILD + boolean + false + false + + + OTHER_PARTY_ORG + boolean + false + false + + + RELATIONSHIP_STEP_PARENT + boolean + false + false + + + RELATIONSHIP_CASE_GAL + boolean + false + false + + + RELATIONSHIP_EX_HUSBAND_WIFE + boolean + false + false + + + RELATIONSHIP_LEGAL_GUARDIAN + boolean + false + false + + + RELATIONSHIP_SOL_BARRISTER + boolean + false + false + + + RELATIONSHIP_EX_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_LOCAL_AUTHORITY + boolean + false + false + + + OPP_RELATIONSHIP_TO_CASE + text + Opponent + false + + + RELATIONSHIP_PARENT + boolean + false + false + + + RELATIONSHIP_OTHER_FAM_MEMBER + boolean + false + false + + + RELATIONSHIP_CASE_BENEFICIARY + boolean + false + false + + + OTHER_PARTY_ID + text + OPPONENT_88123456 + true + + + RELATIONSHIP_GRANDPARENT + boolean + false + false + + + RELATIONSHIP_LANDLORD + boolean + false + false + + + RELATIONSHIP_CHILD + boolean + false + false + + + OTHER_PARTY_NAME + text + Joffrey Test-Opponent + true + + + RELATIONSHIP_CUSTOMER + boolean + false + false + + + OTHER_PARTY_NAME_MERITS + text + Joffrey Test-Opponent + false + + + RELATIONSHIP_CASE_INT_PARTY + boolean + false + false + + + RELATIONSHIP_TO_CASE + text + OPP + true + + + RELATIONSHIP_PROPERTY_OWNER + boolean + false + false + + + RELATIONSHIP_SUPPLIER + boolean + false + false + + + RELATIONSHIP_EMPLOYEE + boolean + false + false + + + RELATIONSHIP_CASE_CHILD + boolean + false + false + + + RELATIONSHIP_CASE_AGENT + boolean + false + false + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OPP_RELATIONSHIP_TO_CLIENT + text + Unknown + false + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + RELATIONSHIP_HUSBAND_WIFE + boolean + false + false + + + + + OPPONENT_88123457 + + + RELATIONSHIP_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_CASE_INTERVENOR + boolean + false + false + + + RELATIONSHIP_TENANT + boolean + false + false + + + RELATIONSHIP_MEDICAL_PRO + boolean + false + false + + + RELATIONSHIP_CASE_OPPONENT + boolean + false + false + + + RELATIONSHIP_EMPLOYER + boolean + false + false + + + RELATIONSHIP_NONE + boolean + false + false + + + OTHER_PARTY_PERSON + boolean + true + false + + + PARTY_IS_A_CHILD + boolean + true + false + + + OTHER_PARTY_ORG + boolean + false + false + + + RELATIONSHIP_STEP_PARENT + boolean + false + false + + + RELATIONSHIP_CASE_GAL + boolean + false + false + + + RELATIONSHIP_EX_HUSBAND_WIFE + boolean + false + false + + + RELATIONSHIP_LEGAL_GUARDIAN + boolean + false + false + + + RELATIONSHIP_SOL_BARRISTER + boolean + false + false + + + RELATIONSHIP_EX_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_LOCAL_AUTHORITY + boolean + false + false + + + OPP_RELATIONSHIP_TO_CASE + text + Child + false + + + RELATIONSHIP_PARENT + boolean + false + false + + + RELATIONSHIP_OTHER_FAM_MEMBER + boolean + false + false + + + RELATIONSHIP_CASE_BENEFICIARY + boolean + false + false + + + OTHER_PARTY_ID + text + OPPONENT_88123457 + true + + + RELATIONSHIP_GRANDPARENT + boolean + false + false + + + OPPONENT_DOB + date + 20-01-2019 + true + + + RELATIONSHIP_LANDLORD + boolean + false + false + + + RELATIONSHIP_CHILD + boolean + true + false + + + OTHER_PARTY_NAME + text + First TestChild + true + + + RELATIONSHIP_CUSTOMER + boolean + false + false + + + OTHER_PARTY_NAME_MERITS + text + First TestChild + false + + + RELATIONSHIP_CASE_INT_PARTY + boolean + false + false + + + RELATIONSHIP_TO_CASE + text + CHILD + true + + + RELATIONSHIP_PROPERTY_OWNER + boolean + false + false + + + RELATIONSHIP_SUPPLIER + boolean + false + false + + + RELATIONSHIP_EMPLOYEE + boolean + false + false + + + RELATIONSHIP_CASE_CHILD + boolean + true + false + + + OPPONENT_DOB_MERITS + date + 20-01-2019 + false + + + RELATIONSHIP_CASE_AGENT + boolean + false + false + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OPP_RELATIONSHIP_TO_CLIENT + text + Unknown + false + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + RELATIONSHIP_HUSBAND_WIFE + boolean + false + false + + + + + OPPONENT_88123458 + + + RELATIONSHIP_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_CASE_INTERVENOR + boolean + false + false + + + RELATIONSHIP_TENANT + boolean + false + false + + + RELATIONSHIP_MEDICAL_PRO + boolean + false + false + + + RELATIONSHIP_CASE_OPPONENT + boolean + false + false + + + RELATIONSHIP_EMPLOYER + boolean + false + false + + + RELATIONSHIP_NONE + boolean + false + false + + + OTHER_PARTY_PERSON + boolean + true + false + + + PARTY_IS_A_CHILD + boolean + true + false + + + OTHER_PARTY_ORG + boolean + false + false + + + RELATIONSHIP_STEP_PARENT + boolean + false + false + + + RELATIONSHIP_CASE_GAL + boolean + false + false + + + RELATIONSHIP_EX_HUSBAND_WIFE + boolean + false + false + + + RELATIONSHIP_LEGAL_GUARDIAN + boolean + false + false + + + RELATIONSHIP_SOL_BARRISTER + boolean + false + false + + + RELATIONSHIP_EX_CIVIL_PARTNER + boolean + false + false + + + RELATIONSHIP_LOCAL_AUTHORITY + boolean + false + false + + + OPP_RELATIONSHIP_TO_CASE + text + Child + false + + + RELATIONSHIP_PARENT + boolean + false + false + + + RELATIONSHIP_OTHER_FAM_MEMBER + boolean + false + false + + + RELATIONSHIP_CASE_BENEFICIARY + boolean + false + false + + + OTHER_PARTY_ID + text + OPPONENT_88123458 + true + + + RELATIONSHIP_GRANDPARENT + boolean + false + false + + + OPPONENT_DOB + date + 15-02-2020 + true + + + RELATIONSHIP_LANDLORD + boolean + false + false + + + RELATIONSHIP_CHILD + boolean + true + false + + + OTHER_PARTY_NAME + text + Second TestChild + true + + + RELATIONSHIP_CUSTOMER + boolean + false + false + + + OTHER_PARTY_NAME_MERITS + text + Second TestChild + false + + + RELATIONSHIP_CASE_INT_PARTY + boolean + false + false + + + RELATIONSHIP_TO_CASE + text + CHILD + true + + + RELATIONSHIP_PROPERTY_OWNER + boolean + false + false + + + RELATIONSHIP_SUPPLIER + boolean + false + false + + + RELATIONSHIP_EMPLOYEE + boolean + false + false + + + RELATIONSHIP_CASE_CHILD + boolean + true + false + + + OPPONENT_DOB_MERITS + date + 15-02-2020 + false + + + RELATIONSHIP_CASE_AGENT + boolean + false + false + + + OTHER_PARTY_TYPE + text + PERSON + true + + + OPP_RELATIONSHIP_TO_CLIENT + text + Unknown + false + + + RELATIONSHIP_TO_CLIENT + text + UNKNOWN + true + + + RELATIONSHIP_HUSBAND_WIFE + boolean + false + false + + + + + + + + + SUB + + true + + + + 2020-11-24T11:54:29.000 + + saturnina + saturnina + EXTERNAL + + 2020-11-24T11:54:29.000 + + + + + + + diff --git a/spec/services/ccms/requestors/case_add_requestor_spec.rb b/spec/services/ccms/requestors/case_add_requestor_spec.rb index c631beacf2..25d07a76f4 100644 --- a/spec/services/ccms/requestors/case_add_requestor_spec.rb +++ b/spec/services/ccms/requestors/case_add_requestor_spec.rb @@ -26,11 +26,12 @@ module Requestors create(:applicant, first_name: "Shery", last_name: "Ledner", + last_name_at_birth:, national_insurance_number: "EG587804M", date_of_birth: Date.new(1977, 4, 10), address:) end - + let(:last_name_at_birth) { nil } let(:proceeding) { legal_aid_application.proceedings.detect { |p| p.ccms_code == "DA001" } } let(:chances_of_success) { proceeding.chances_of_success } let(:vehicles) { create_list(:vehicle, 1, estimated_value: 3030, payment_remaining: 881, purchased_on: Date.new(2008, 8, 22), used_regularly: true) } @@ -78,16 +79,20 @@ module Requestors allow(CCMS::OpponentId).to receive(:next_serial_id).and_return(88_123_456, 88_123_457, 88_123_458) end - it "calls the savon soap client with expected arguments" do - soap_client = instance_double(Savon::Client) - allow(soap_client).to receive(:call) - allow(requestor).to receive(:soap_client).and_return(soap_client) + describe "#call" do + before do + allow(Faraday::SoapCall).to receive(:new).and_return(soap_call) + stub_request(:post, expected_url) + end - requestor.call + let(:soap_call) { instance_double(Faraday::SoapCall) } + let(:expected_xml) { requestor.__send__(:request_xml) } + let(:expected_url) { extract_url_from(requestor.__send__(:wsdl_location)) } - expect(soap_client) - .to have_received(:call) - .with(:create_case_application, xml: request_xml) + it "invokes the fadaday soap_call" do + expect(soap_call).to receive(:call).with(expected_xml).once + requestor.call + end end it "generates the expected xml" do @@ -99,6 +104,20 @@ module Requestors end end + context "when the client has a different surname at birth" do + let(:expected_request_xml) { ccms_data_from_file("case_add_request_with_surname_at_birth.xml") } + let(:last_name_at_birth) { "different" } + + it "generates the expected xml" do + travel_to(request_created_at) do + request_hash = Hash.from_xml(request_xml).deep_symbolize_keys! + expected_request_hash = Hash.from_xml(expected_request_xml).deep_symbolize_keys! + + expect(request_hash).to match(expected_request_hash) + end + end + end + context "when the proceeding type has a chosen client involvement type" do let(:expected_request_xml) { ccms_data_from_file("non_default_client_involvement_type.xml") } From 9210915ff9a734045e19df9c6cfaa8e43494313c Mon Sep 17 00:00:00 2001 From: Adam Goldstone <13471320+agoldstone93@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:56:10 +0000 Subject: [PATCH 14/14] AP-4796: Add surname at birth details to reports Add to means report, merits report and review and print page --- app/views/providers/means_reports/show.html.erb | 2 +- app/views/providers/merits_reports/show.html.erb | 2 +- .../shared/review_application/_questions_and_answers.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/providers/means_reports/show.html.erb b/app/views/providers/means_reports/show.html.erb index bbafbfa92c..e7eff86277 100644 --- a/app/views/providers/means_reports/show.html.erb +++ b/app/views/providers/means_reports/show.html.erb @@ -9,7 +9,7 @@ <%= render( "shared/check_answers/client_details", - attributes: %i[first_name last_name date_of_birth age means_test national_insurance_number], + attributes: %i[first_name last_name last_name_at_birth changed_last_name date_of_birth age means_test national_insurance_number], applicant: @legal_aid_application.applicant, read_only: true, ) %> diff --git a/app/views/providers/merits_reports/show.html.erb b/app/views/providers/merits_reports/show.html.erb index 2ef7d244cd..5179038ad3 100644 --- a/app/views/providers/merits_reports/show.html.erb +++ b/app/views/providers/merits_reports/show.html.erb @@ -7,7 +7,7 @@ <%= render( "shared/check_answers/client_details", - attributes: %i[first_name last_name date_of_birth age means_test national_insurance_number], + attributes: %i[first_name last_name last_name_at_birth changed_last_name date_of_birth age means_test national_insurance_number], applicant: @legal_aid_application.applicant, read_only: true, ) %> diff --git a/app/views/shared/review_application/_questions_and_answers.html.erb b/app/views/shared/review_application/_questions_and_answers.html.erb index 8cf218af16..eb67f4736a 100644 --- a/app/views/shared/review_application/_questions_and_answers.html.erb +++ b/app/views/shared/review_application/_questions_and_answers.html.erb @@ -24,7 +24,7 @@

<%= t(".client_details_heading") %>

<%= render( "shared/check_answers/client_details", - attributes: %i[first_name last_name date_of_birth national_insurance_number email address], + attributes: %i[first_name last_name last_name_at_birth changed_last_name date_of_birth national_insurance_number email address], applicant: @legal_aid_application.applicant, address: @legal_aid_application.applicant.address, read_only: true,