From 96cde59afec857f7f699c40b23318f6930527d29 Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Wed, 13 Nov 2024 15:16:44 +0000 Subject: [PATCH] AP-5288: Update AmendmentType handling We were sending amendment types based off DF logic, not non-SCA DF logic Use the new `non_sca_used_delegated_functions?` handler, and call it where appropriate to remove it from the payload. Also remove `DevolvedPowersDate` as we know this is not needed on an SCA application payload --- app/services/ccms/attribute_value_generator.rb | 2 +- .../ccms/requestors/case_add_requestor.rb | 4 ++-- .../ccms/requestors/case_add_requestor_spec.rb | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/services/ccms/attribute_value_generator.rb b/app/services/ccms/attribute_value_generator.rb index dffd9019c1..ff7e33ba77 100644 --- a/app/services/ccms/attribute_value_generator.rb +++ b/app/services/ccms/attribute_value_generator.rb @@ -106,7 +106,7 @@ def used_delegated_functions_on(_options) end def app_amendment_type(_options) - legal_aid_application.used_delegated_functions? ? "SUBDP" : "SUB" + legal_aid_application.non_sca_used_delegated_functions? ? "SUBDP" : "SUB" end def provider_firm_id(_options) diff --git a/app/services/ccms/requestors/case_add_requestor.rb b/app/services/ccms/requestors/case_add_requestor.rb index 30ea746d4b..3fa157e98b 100644 --- a/app/services/ccms/requestors/case_add_requestor.rb +++ b/app/services/ccms/requestors/case_add_requestor.rb @@ -106,8 +106,8 @@ def generate_application_details(xml) xml.__send__(:"casebio:Proceedings") { generate_proceedings(xml) } xml.__send__(:"casebio:MeansAssesments") { generate_means_assessment(xml) } xml.__send__(:"casebio:MeritsAssesments") { generate_merits_assessment(xml) } - xml.__send__(:"casebio:DevolvedPowersDate", @legal_aid_application.used_delegated_functions_on.to_fs(:ccms_date)) if @legal_aid_application.used_delegated_functions? - xml.__send__(:"casebio:ApplicationAmendmentType", @legal_aid_application.used_delegated_functions? ? "SUBDP" : "SUB") + xml.__send__(:"casebio:DevolvedPowersDate", @legal_aid_application.used_delegated_functions_on.to_fs(:ccms_date)) if @legal_aid_application.non_sca_used_delegated_functions? + xml.__send__(:"casebio:ApplicationAmendmentType", @legal_aid_application.non_sca_used_delegated_functions? ? "SUBDP" : "SUB") xml.__send__(:"casebio:LARDetails") { generate_lar_details(xml) } end diff --git a/spec/services/ccms/requestors/case_add_requestor_spec.rb b/spec/services/ccms/requestors/case_add_requestor_spec.rb index 2fa16a8feb..b755e62d20 100644 --- a/spec/services/ccms/requestors/case_add_requestor_spec.rb +++ b/spec/services/ccms/requestors/case_add_requestor_spec.rb @@ -403,6 +403,24 @@ module Requestors .and have_xml("#{address_xpath}/common:AddressLine3", "Placeholder City") end end + + describe "non-SCA applications" do + it "excludes the SCA_AUTO_GRANT block" do + block = XmlExtractor.call(request_xml, :global_merits, "SCA_AUTO_GRANT") + expect(block).not_to be_present + end + + it "excludes the SCA_DEVOLVED_POWERS block" do + block = XmlExtractor.call(request_xml, :global_merits, "SCA_DEVOLVED_POWERS") + expect(block).not_to be_present + end + + it "includes the FAMILY_PROSPECTS_OF_SUCCESS block" do + # this merits question is asked in all non-SCA proceedings + block = XmlExtractor.call(request_xml, :proceeding_merits, "FAMILY_PROSPECTS_OF_SUCCESS") + expect(block).to be_present + end + end end end end