Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP-5288: Update AmendmentType handling
Browse files Browse the repository at this point in the history
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
colinbruce committed Nov 18, 2024
1 parent c5bcf46 commit 96cde59
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/ccms/attribute_value_generator.rb
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions app/services/ccms/requestors/case_add_requestor.rb
Original file line number Diff line number Diff line change
@@ -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

18 changes: 18 additions & 0 deletions spec/services/ccms/requestors/case_add_requestor_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 96cde59

Please sign in to comment.