diff --git a/Gemfile.lock b/Gemfile.lock index f5b3b9f64e..2ed3983b9a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -590,7 +590,7 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.15.1) parser (>= 3.0.1.1) - rubocop-performance (1.12.0) + rubocop-performance (1.13.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.13.1) diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index 3cddc7c046..bf8e5ca6a7 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -81,7 +81,7 @@ def check_long_question_for_cash_transactions(name:, question:, legal_aid_applic end def number_to_currency_or_na(number) - number.to_d == 999_999_999_999.0.to_d ? 'N/a' : gds_number_to_currency(number) + number.to_d == BigDecimal('999_999_999_999.0') ? 'N/a' : gds_number_to_currency(number) end def safe_yes_or_no(value) diff --git a/app/services/ccms/payload_generators/entity_attributes_generator.rb b/app/services/ccms/payload_generators/entity_attributes_generator.rb index b2ffde2374..855d22b49e 100644 --- a/app/services/ccms/payload_generators/entity_attributes_generator.rb +++ b/app/services/ccms/payload_generators/entity_attributes_generator.rb @@ -26,11 +26,11 @@ def call next unless generate_attribute_block?(config) response_value = extract_response_value(config) - @xml.__send__('common:Attribute') do - @xml.__send__('common:Attribute', attribute_name) - @xml.__send__('common:ResponseType', config[:response_type]) - @xml.__send__('common:ResponseValue', response_value) - @xml.__send__('common:UserDefinedInd', config[:user_defined]) + @xml.__send__(:'common:Attribute') do + @xml.__send__(:'common:Attribute', attribute_name) + @xml.__send__(:'common:ResponseType', config[:response_type]) + @xml.__send__(:'common:ResponseValue', response_value) + @xml.__send__(:'common:UserDefinedInd', config[:user_defined]) end end end diff --git a/app/services/ccms/requestors/applicant_add_requestor.rb b/app/services/ccms/requestors/applicant_add_requestor.rb index 0064f31910..e810a4acca 100644 --- a/app/services/ccms/requestors/applicant_add_requestor.rb +++ b/app/services/ccms/requestors/applicant_add_requestor.rb @@ -24,48 +24,48 @@ def request_xml end def soap_body(xml) - xml.__send__('clientbim:ClientAddRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('clientbim:Client') { client(xml) } + xml.__send__(:'clientbim:ClientAddRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'clientbim:Client') { client(xml) } end end def client(xml) - xml.__send__('clientbio:Name') { name(xml) } - xml.__send__('clientbio:PersonalInformation') { personal_information(xml) } - xml.__send__('clientbio:Contacts') { contacts(xml) } - xml.__send__('clientbio:NoFixedAbode', false) - xml.__send__('clientbio:Address') { applicant_address(xml) } - xml.__send__('clientbio:EthnicMonitoring', 0) + xml.__send__(:'clientbio:Name') { name(xml) } + xml.__send__(:'clientbio:PersonalInformation') { personal_information(xml) } + xml.__send__(:'clientbio:Contacts') { contacts(xml) } + xml.__send__(:'clientbio:NoFixedAbode', false) + xml.__send__(:'clientbio:Address') { applicant_address(xml) } + xml.__send__(:'clientbio:EthnicMonitoring', 0) end def name(xml) - xml.__send__('common:Surname', applicant.last_name) - xml.__send__('common:FirstName', applicant.first_name) + xml.__send__(:'common:Surname', applicant.last_name) + xml.__send__(:'common:FirstName', applicant.first_name) end # this is all mandatory: we don't hold any of this data except date of birth def personal_information(xml) - xml.__send__('clientbio:DateOfBirth', applicant.date_of_birth.to_s(:ccms_date)) - xml.__send__('clientbio:Gender', 'UNSPECIFIED') - xml.__send__('clientbio:MaritalStatus', 'U') - xml.__send__('clientbio:VulnerableClient', false) - xml.__send__('clientbio:HighProfileClient', false) - xml.__send__('clientbio:VexatiousLitigant', false) - xml.__send__('clientbio:CountryOfOrigin', 'GBR') - xml.__send__('clientbio:MentalCapacityInd', false) + xml.__send__(:'clientbio:DateOfBirth', applicant.date_of_birth.to_s(:ccms_date)) + xml.__send__(:'clientbio:Gender', 'UNSPECIFIED') + xml.__send__(:'clientbio:MaritalStatus', 'U') + xml.__send__(:'clientbio:VulnerableClient', false) + xml.__send__(:'clientbio:HighProfileClient', false) + xml.__send__(:'clientbio:VexatiousLitigant', false) + xml.__send__(:'clientbio:CountryOfOrigin', 'GBR') + xml.__send__(:'clientbio:MentalCapacityInd', false) end # this is the only mandatory item of contact data. i'm not sure what it's for... def contacts(xml) - xml.__send__('clientbio:Password', 'Testing') + xml.__send__(:'clientbio:Password', 'Testing') end def applicant_address(xml) - xml.__send__('common:AddressLine1', address.first_lines) - xml.__send__('common:City', address.city) - xml.__send__('common:Country', 'GBR') - xml.__send__('common:PostalCode', address.pretty_postcode) + xml.__send__(:'common:AddressLine1', address.first_lines) + xml.__send__(:'common:City', address.city) + xml.__send__(:'common:Country', 'GBR') + xml.__send__(:'common:PostalCode', address.pretty_postcode) end end end diff --git a/app/services/ccms/requestors/applicant_add_status_requestor.rb b/app/services/ccms/requestors/applicant_add_status_requestor.rb index a8c905c4ca..251168465e 100644 --- a/app/services/ccms/requestors/applicant_add_status_requestor.rb +++ b/app/services/ccms/requestors/applicant_add_status_requestor.rb @@ -22,9 +22,9 @@ def request_xml end def soap_body(xml) - xml.__send__('clientbim:ClientAddUpdtStatusRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('clientbim:TransactionID', applicant_add_transaction_id) + xml.__send__(:'clientbim:ClientAddUpdtStatusRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'clientbim:TransactionID', applicant_add_transaction_id) end end end diff --git a/app/services/ccms/requestors/applicant_search_requestor.rb b/app/services/ccms/requestors/applicant_search_requestor.rb index 830eecebdf..7ed263c11f 100644 --- a/app/services/ccms/requestors/applicant_search_requestor.rb +++ b/app/services/ccms/requestors/applicant_search_requestor.rb @@ -20,24 +20,24 @@ def request_xml end def soap_body(xml) - xml.__send__('clientbim:ClientInqRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('clientbim:RecordCount') { record_count(xml) } - xml.__send__('clientbim:SearchCriteria') { search_criteria(xml) } + xml.__send__(:'clientbim:ClientInqRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'clientbim:RecordCount') { record_count(xml) } + xml.__send__(:'clientbim:SearchCriteria') { search_criteria(xml) } end end def record_count(xml) - xml.__send__('common:MaxRecordsToFetch', 200) - xml.__send__('common:RetriveDataOnMaxCount', false) + xml.__send__(:'common:MaxRecordsToFetch', 200) + xml.__send__(:'common:RetriveDataOnMaxCount', false) end 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:DateOfBirth', @applicant.date_of_birth.to_s(:ccms_date)) - xml.__send__('clientbio:NINumber', @applicant.national_insurance_number) + xml.__send__(:'clientbim:ClientInfo') do + xml.__send__(:'clientbio:FirstName', @applicant.first_name) + xml.__send__(:'clientbio:Surname', @applicant.last_name) + xml.__send__(:'clientbio:DateOfBirth', @applicant.date_of_birth.to_s(:ccms_date)) + xml.__send__(:'clientbio:NINumber', @applicant.national_insurance_number) end end end diff --git a/app/services/ccms/requestors/base_requestor.rb b/app/services/ccms/requestors/base_requestor.rb index 84b0b0e154..ff2efae84b 100644 --- a/app/services/ccms/requestors/base_requestor.rb +++ b/app/services/ccms/requestors/base_requestor.rb @@ -70,18 +70,18 @@ def soap_client def soap_envelope(namespaces) Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml| - xml.__send__('soap:Envelope', namespaces) do - xml.__send__('soap:Header') { soap_header(xml) } - xml.__send__('soap:Body') { soap_body(xml) } + xml.__send__(:'soap:Envelope', namespaces) do + xml.__send__(:'soap:Header') { soap_header(xml) } + xml.__send__(:'soap:Body') { soap_body(xml) } end end end def soap_header(xml) - xml.__send__('secext:Security') do - xml.__send__('secext:UsernameToken') do - xml.__send__('secext:Username', config.client_username) - xml.__send__('secext:Password', 'Type' => config.client_password_type) do + xml.__send__(:'secext:Security') do + xml.__send__(:'secext:UsernameToken') do + xml.__send__(:'secext:Username', config.client_username) + xml.__send__(:'secext:Password', 'Type' => config.client_password_type) do xml.text(config.client_password) end end @@ -89,10 +89,10 @@ def soap_header(xml) end def ns3_header_rq(xml, provider_username) - xml.__send__('hdr:TransactionRequestID', transaction_request_id) - xml.__send__('hdr:Language', 'ENG') - xml.__send__('hdr:UserLoginID', provider_username) - xml.__send__('hdr:UserRole', config.user_role) + xml.__send__(:'hdr:TransactionRequestID', transaction_request_id) + xml.__send__(:'hdr:Language', 'ENG') + xml.__send__(:'hdr:UserLoginID', provider_username) + xml.__send__(:'hdr:UserRole', config.user_role) end def wsdl_location diff --git a/app/services/ccms/requestors/case_add_requestor.rb b/app/services/ccms/requestors/case_add_requestor.rb index b4738260cc..dd74e34a24 100644 --- a/app/services/ccms/requestors/case_add_requestor.rb +++ b/app/services/ccms/requestors/case_add_requestor.rb @@ -73,47 +73,47 @@ def request_xml end def soap_body(xml) - xml.__send__('casebim:CaseAddRQ') do - xml.__send__('hdr:HeaderRQ') { header_request(xml) } - xml.__send__('casebim:Case') { case_request(xml) } + xml.__send__(:'casebim:CaseAddRQ') do + xml.__send__(:'hdr:HeaderRQ') { header_request(xml) } + xml.__send__(:'casebim:Case') { case_request(xml) } end end def header_request(xml) - xml.__send__('hdr:TransactionRequestID', transaction_request_id) - xml.__send__('hdr:Language', 'ENG') - xml.__send__('hdr:UserLoginID', provider.username) - xml.__send__('hdr:UserRole', 'EXTERNAL') + xml.__send__(:'hdr:TransactionRequestID', transaction_request_id) + xml.__send__(:'hdr:Language', 'ENG') + xml.__send__(:'hdr:UserLoginID', provider.username) + xml.__send__(:'hdr:UserRole', 'EXTERNAL') end def case_request(xml) - xml.__send__('casebio:CaseReferenceNumber', @submission.case_ccms_reference) - xml.__send__('casebio:CaseDetails') do - xml.__send__('casebio:ApplicationDetails') { generate_application_details(xml) } - xml.__send__('casebio:RecordHistory') { generate_record_history(xml) } - xml.__send__('casebio:CaseDocs') { generate_case_docs(xml) } + xml.__send__(:'casebio:CaseReferenceNumber', @submission.case_ccms_reference) + xml.__send__(:'casebio:CaseDetails') do + xml.__send__(:'casebio:ApplicationDetails') { generate_application_details(xml) } + xml.__send__(:'casebio:RecordHistory') { generate_record_history(xml) } + xml.__send__(:'casebio:CaseDocs') { generate_case_docs(xml) } end end def generate_application_details(xml) # rubocop:disable Metrics/AbcSize - xml.__send__('casebio:Client') { generate_client(xml) } - xml.__send__('casebio:PreferredAddress', 'CLIENT') - xml.__send__('casebio:ProviderDetails') { generate_provider_details(xml) } - xml.__send__('casebio:CategoryOfLaw') { generate_category_of_law(xml) } - xml.__send__('casebio:OtherParties') { generate_other_parties(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_s(:ccms_date)) if @legal_aid_application.used_delegated_functions? - xml.__send__('casebio:ApplicationAmendmentType', @legal_aid_application.used_delegated_functions? ? 'SUBDP' : 'SUB') - xml.__send__('casebio:LARDetails') { generate_lar_details(xml) } + xml.__send__(:'casebio:Client') { generate_client(xml) } + xml.__send__(:'casebio:PreferredAddress', 'CLIENT') + xml.__send__(:'casebio:ProviderDetails') { generate_provider_details(xml) } + xml.__send__(:'casebio:CategoryOfLaw') { generate_category_of_law(xml) } + xml.__send__(:'casebio:OtherParties') { generate_other_parties(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_s(:ccms_date)) if @legal_aid_application.used_delegated_functions? + xml.__send__(:'casebio:ApplicationAmendmentType', @legal_aid_application.used_delegated_functions? ? 'SUBDP' : 'SUB') + xml.__send__(:'casebio:LARDetails') { generate_lar_details(xml) } end def generate_case_docs(xml) @submission.submission_documents.each do |document| - xml.__send__('casebio:CaseDoc') do - xml.__send__('casebio:CCMSDocumentID', document.ccms_document_id) - xml.__send__('casebio:DocumentSubject', document.document_type) + xml.__send__(:'casebio:CaseDoc') do + xml.__send__(:'casebio:CCMSDocumentID', document.ccms_document_id) + xml.__send__(:'casebio:DocumentSubject', document.document_type) end end end @@ -128,20 +128,20 @@ def generate_other_parties(xml) def generate_opponent(xml, opponent) # rubocop:disable Metrics/MethodLength first_name, last_name = opponent.split_full_name - xml.__send__('casebio:OtherParty') do - xml.__send__('casebio:OtherPartyID', "OPPONENT_#{opponent.generate_ccms_opponent_id}") - xml.__send__('casebio:SharedInd', false) - xml.__send__('casebio:OtherPartyDetail') do - xml.__send__('casebio:Person') do - xml.__send__('casebio:Name') do - xml.__send__('common:Title', '') - xml.__send__('common:Surname', last_name) - xml.__send__('common:FirstName', first_name) + xml.__send__(:'casebio:OtherParty') do + xml.__send__(:'casebio:OtherPartyID', "OPPONENT_#{opponent.generate_ccms_opponent_id}") + xml.__send__(:'casebio:SharedInd', false) + xml.__send__(:'casebio:OtherPartyDetail') do + xml.__send__(:'casebio:Person') do + xml.__send__(:'casebio:Name') do + xml.__send__(:'common:Title', '') + xml.__send__(:'common:Surname', last_name) + xml.__send__(:'common:FirstName', first_name) end - xml.__send__('casebio:Address') - xml.__send__('casebio:RelationToClient', 'NONE') - xml.__send__('casebio:RelationToCase', 'OPP') - xml.__send__('casebio:ContactDetails') + xml.__send__(:'casebio:Address') + xml.__send__(:'casebio:RelationToClient', 'NONE') + xml.__send__(:'casebio:RelationToCase', 'OPP') + xml.__send__(:'casebio:ContactDetails') end end end @@ -149,58 +149,58 @@ def generate_opponent(xml, opponent) # rubocop:disable Metrics/MethodLength def generate_involved_child(xml, child) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength first_name, last_name = child.split_full_name - xml.__send__('casebio:OtherParty') do - xml.__send__('casebio:OtherPartyID', "OPPONENT_#{child.generate_ccms_opponent_id}") - xml.__send__('casebio:SharedInd', false) - xml.__send__('casebio:OtherPartyDetail') do - xml.__send__('casebio:Person') do - xml.__send__('casebio:Name') do - xml.__send__('common:Title', '') - xml.__send__('common:Surname', last_name) - xml.__send__('common:FirstName', first_name) + xml.__send__(:'casebio:OtherParty') do + xml.__send__(:'casebio:OtherPartyID', "OPPONENT_#{child.generate_ccms_opponent_id}") + xml.__send__(:'casebio:SharedInd', false) + xml.__send__(:'casebio:OtherPartyDetail') do + xml.__send__(:'casebio:Person') do + xml.__send__(:'casebio:Name') do + xml.__send__(:'common:Title', '') + xml.__send__(:'common:Surname', last_name) + xml.__send__(:'common:FirstName', first_name) end - xml.__send__('casebio:DateOfBirth', child.date_of_birth.strftime('%F')) - xml.__send__('casebio:Address') - xml.__send__('casebio:RelationToClient', 'UNKNOWN') - xml.__send__('casebio:RelationToCase', 'CHILD') - xml.__send__('casebio:ContactDetails') + xml.__send__(:'casebio:DateOfBirth', child.date_of_birth.strftime('%F')) + xml.__send__(:'casebio:Address') + xml.__send__(:'casebio:RelationToClient', 'UNKNOWN') + xml.__send__(:'casebio:RelationToCase', 'CHILD') + xml.__send__(:'casebio:ContactDetails') end end end end def generate_record_history(xml) - xml.__send__('common:DateCreated', Time.current.to_s(:ccms_date_time)) - xml.__send__('common:LastUpdatedBy') do - xml.__send__('common:UserLoginID', provider.username) - xml.__send__('common:UserName', provider.username) - xml.__send__('common:UserType', 'EXTERNAL') + xml.__send__(:'common:DateCreated', Time.current.to_s(:ccms_date_time)) + xml.__send__(:'common:LastUpdatedBy') do + xml.__send__(:'common:UserLoginID', provider.username) + xml.__send__(:'common:UserName', provider.username) + xml.__send__(:'common:UserType', 'EXTERNAL') end - xml.__send__('common:DateLastUpdated', Time.current.to_s(:ccms_date_time)) + xml.__send__(:'common:DateLastUpdated', Time.current.to_s(:ccms_date_time)) end def generate_lar_details(xml) - xml.__send__('casebio:LARScopeFlag', true) + xml.__send__(:'casebio:LARScopeFlag', true) end def generate_client(xml) - xml.__send__('casebio:ClientReferenceNumber', @submission.applicant_ccms_reference) - xml.__send__('casebio:FirstName', applicant.first_name) - xml.__send__('casebio:Surname', applicant.last_name) + xml.__send__(:'casebio:ClientReferenceNumber', @submission.applicant_ccms_reference) + xml.__send__(:'casebio:FirstName', applicant.first_name) + xml.__send__(:'casebio:Surname', applicant.last_name) end def generate_provider_details(xml) - xml.__send__('casebio:ProviderFirmID', provider.firm.ccms_id) - xml.__send__('casebio:ProviderOfficeID', @legal_aid_application.office.ccms_id) - xml.__send__('casebio:ContactUserID') do - xml.__send__('common:UserLoginID', provider.contact_id) + xml.__send__(:'casebio:ProviderFirmID', provider.firm.ccms_id) + xml.__send__(:'casebio:ProviderOfficeID', @legal_aid_application.office.ccms_id) + xml.__send__(:'casebio:ContactUserID') do + xml.__send__(:'common:UserLoginID', provider.contact_id) end end def generate_category_of_law(xml) - xml.__send__('casebio:CategoryOfLawCode', @legal_aid_application.lead_proceeding.category_law_code) - xml.__send__('casebio:CategoryOfLawDescription', @legal_aid_application.lead_proceeding.category_of_law) - xml.__send__('casebio:RequestedAmount', as_currency(@legal_aid_application.substantive_cost_limitation)) + xml.__send__(:'casebio:CategoryOfLawCode', @legal_aid_application.lead_proceeding.category_law_code) + xml.__send__(:'casebio:CategoryOfLawDescription', @legal_aid_application.lead_proceeding.category_of_law) + xml.__send__(:'casebio:RequestedAmount', as_currency(@legal_aid_application.substantive_cost_limitation)) end def generate_proceedings(xml) @@ -208,56 +208,56 @@ def generate_proceedings(xml) end def generate_proceeding(xml, proceeding) - xml.__send__('casebio:Proceeding') do - xml.__send__('casebio:ProceedingCaseID', proceeding.case_p_num) - xml.__send__('casebio:Status', 'Draft') - xml.__send__('casebio:LeadProceedingIndicator', proceeding.lead_proceeding) - xml.__send__('casebio:ProceedingDetails') { generate_proceeding_type(xml, proceeding) } + xml.__send__(:'casebio:Proceeding') do + xml.__send__(:'casebio:ProceedingCaseID', proceeding.case_p_num) + xml.__send__(:'casebio:Status', 'Draft') + xml.__send__(:'casebio:LeadProceedingIndicator', proceeding.lead_proceeding) + xml.__send__(:'casebio:ProceedingDetails') { generate_proceeding_type(xml, proceeding) } end end def generate_proceeding_type(xml, proceeding) - xml.__send__('casebio:ProceedingType', proceeding.ccms_code) - xml.__send__('casebio:ProceedingDescription', proceeding.description) - xml.__send__('casebio:MatterType', proceeding.ccms_matter_code) - xml.__send__('casebio:LevelOfService', proceeding.default_level_of_service_level) - xml.__send__('casebio:Stage', 8) # TODO: CCMS placeholder - This will need reviewing when we add more proceedings and/or matter types - xml.__send__('casebio:ClientInvolvementType', 'A') - xml.__send__('casebio:ScopeLimitations') { generate_scope_limitations(xml, proceeding) } + xml.__send__(:'casebio:ProceedingType', proceeding.ccms_code) + xml.__send__(:'casebio:ProceedingDescription', proceeding.description) + xml.__send__(:'casebio:MatterType', proceeding.ccms_matter_code) + xml.__send__(:'casebio:LevelOfService', proceeding.default_level_of_service_level) + xml.__send__(:'casebio:Stage', 8) # TODO: CCMS placeholder - This will need reviewing when we add more proceedings and/or matter types + xml.__send__(:'casebio:ClientInvolvementType', 'A') + xml.__send__(:'casebio:ScopeLimitations') { generate_scope_limitations(xml, proceeding) } end def generate_scope_limitations(xml, proceeding) - xml.__send__('casebio:ScopeLimitation') do - xml.__send__('casebio:ScopeLimitation', proceeding.substantive_scope_limitation_code) - xml.__send__('casebio:ScopeLimitationWording', proceeding.substantive_scope_limitation_description) - xml.__send__('casebio:DelegatedFunctionsApply', false) + xml.__send__(:'casebio:ScopeLimitation') do + xml.__send__(:'casebio:ScopeLimitation', proceeding.substantive_scope_limitation_code) + xml.__send__(:'casebio:ScopeLimitationWording', proceeding.substantive_scope_limitation_description) + xml.__send__(:'casebio:DelegatedFunctionsApply', false) end return if proceeding.used_delegated_functions_on.nil? - xml.__send__('casebio:ScopeLimitation') do - xml.__send__('casebio:ScopeLimitation', proceeding.delegated_functions_scope_limitation_code) - xml.__send__('casebio:ScopeLimitationWording', proceeding.delegated_functions_scope_limitation_description) - xml.__send__('casebio:DelegatedFunctionsApply', true) + xml.__send__(:'casebio:ScopeLimitation') do + xml.__send__(:'casebio:ScopeLimitation', proceeding.delegated_functions_scope_limitation_code) + xml.__send__(:'casebio:ScopeLimitationWording', proceeding.delegated_functions_scope_limitation_description) + xml.__send__(:'casebio:DelegatedFunctionsApply', true) end end def generate_means_assessment(xml) - xml.__send__('casebio:AssesmentResults') do - xml.__send__('common:Results') { generate_means_assessment_results(xml) } - xml.__send__('common:AssesmentDetails') { generate_means_assessment_details(xml) } + xml.__send__(:'casebio:AssesmentResults') do + xml.__send__(:'common:Results') { generate_means_assessment_results(xml) } + xml.__send__(:'common:AssesmentDetails') { generate_means_assessment_details(xml) } end end def generate_means_assessment_results(xml) - xml.__send__('common:Goal') do - xml.__send__('common:Attribute', 'CLIENT_PROV_LA') - xml.__send__('common:AttributeValue', true) + xml.__send__(:'common:Goal') do + xml.__send__(:'common:Attribute', 'CLIENT_PROV_LA') + xml.__send__(:'common:AttributeValue', true) end end def generate_means_assessment_details(xml) - xml.__send__('common:AssessmentScreens') do - xml.__send__('common:ScreenName', 'SUMMARY') + xml.__send__(:'common:AssessmentScreens') do + xml.__send__(:'common:ScreenName', 'SUMMARY') sequence_no = 1 means_entity_configs.each do |config| if predicate_true?(config) @@ -269,15 +269,15 @@ def generate_means_assessment_details(xml) end def generate_opponent_other_parties_means_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', 'OPPONENT_OTHER_PARTIES') + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', 'OPPONENT_OTHER_PARTIES') other_parties.each { |other_party| generate_opponent_other_parties_means_instance(xml, other_party, config) } end def generate_opponent_other_parties_means_instance(xml, other_party, config) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', "OPPONENT_#{other_party.generate_ccms_opponent_id}") - xml.__send__('common:Attributes') do + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', "OPPONENT_#{other_party.generate_ccms_opponent_id}") + xml.__send__(:'common:Attributes') do EntityAttributesGenerator.call(self, xml, config[:yaml_section], other_party: other_party) end end @@ -296,7 +296,7 @@ def predicate_true?(config) def generate_entity_from_config(xml, sequence_no, config) config[:resolved_instance_label] = resolve_instance_label(config) - xml.__send__('common:Entity') do + xml.__send__(:'common:Entity') do __send__(config[:method], xml, sequence_no, config) end end @@ -311,52 +311,52 @@ def resolve_instance_label(config) end def generate_valuable_possessions_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', config[:entity_name]) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', config[:instance_label]) - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section]) } + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', config[:entity_name]) + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', config[:instance_label]) + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section]) } end end def generate_bank_accounts_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', config[:entity_name]) + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', config[:entity_name]) bank_accounts.each_with_index { |acct, index| generate_bank_account_instance(xml, acct, config, index) } end def generate_bank_account_instance(xml, bank_account, config, index) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', bank_account.ccms_instance_name(index)) - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section], bank_acct: bank_account) } + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', bank_account.ccms_instance_name(index)) + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section], bank_acct: bank_account) } end end def generate_vehicles_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', config[:entity_name]) + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', config[:entity_name]) generate_vehicle_instance(xml, vehicle, config) if vehicle end def generate_vehicle_instance(xml, vehicle, config) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', config[:instance_label]) - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section], vehicle: vehicle) } + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', config[:instance_label]) + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section], vehicle: vehicle) } end end def generate_means_proceeding_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', config[:entity_name]) + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', config[:entity_name]) proceedings.reverse_each do |proceeding| generate_means_proceeding_instance(xml, proceeding, config) end end def generate_means_proceeding_instance(xml, proceeding, config) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', proceeding.case_p_num) - xml.__send__('common:Attributes') do + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', proceeding.case_p_num) + xml.__send__(:'common:Attributes') do EntityAttributesGenerator.call(self, xml, config[:yaml_section], @@ -366,58 +366,58 @@ def generate_means_proceeding_instance(xml, proceeding, config) end def generate_entity(xml, sequence_no, config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', config[:entity_name]) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', config[:resolved_instance_label]) - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section]) } + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', config[:entity_name]) + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', config[:resolved_instance_label]) + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, config[:yaml_section]) } end end def generate_merits_assessment(xml) - xml.__send__('casebio:AssesmentResults') do - xml.__send__('common:Results') { generate_merits_assessment_results(xml) } - xml.__send__('common:AssesmentDetails') { generate_merits_assessment_details(xml) } + xml.__send__(:'casebio:AssesmentResults') do + xml.__send__(:'common:Results') { generate_merits_assessment_results(xml) } + xml.__send__(:'common:AssesmentDetails') { generate_merits_assessment_details(xml) } end end def generate_merits_assessment_results(xml) - xml.__send__('common:Goal') do - xml.__send__('common:Attribute', 'ASSESS_COMPLETE') - xml.__send__('common:AttributeValue', true) + xml.__send__(:'common:Goal') do + xml.__send__(:'common:Attribute', 'ASSESS_COMPLETE') + xml.__send__(:'common:AttributeValue', true) end end def generate_merits_assessment_details(xml) - xml.__send__('common:AssessmentScreens') do - xml.__send__('common:ScreenName', 'SUMMARY') - xml.__send__('common:Entity') { generate_global_merits_entity(xml, 1) } - xml.__send__('common:Entity') { generate_merits_proceeding_entity(xml, 2) } - xml.__send__('common:Entity') { generate_opponent_other_parties_merits_entity(xml, 4) } + xml.__send__(:'common:AssessmentScreens') do + xml.__send__(:'common:ScreenName', 'SUMMARY') + xml.__send__(:'common:Entity') { generate_global_merits_entity(xml, 1) } + xml.__send__(:'common:Entity') { generate_merits_proceeding_entity(xml, 2) } + xml.__send__(:'common:Entity') { generate_opponent_other_parties_merits_entity(xml, 4) } end end def generate_global_merits_entity(xml, sequence_no) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', 'global') - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', @submission.case_ccms_reference) - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, :global_merits) } + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', 'global') + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', @submission.case_ccms_reference) + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, :global_merits) } end end # :nocov: def generate_merits_proceeding_entity(xml, sequence_no) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', 'PROCEEDING') + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', 'PROCEEDING') proceedings.reverse_each { |proceeding| generate_merits_proceeding_instance(xml, proceeding) } end # :nocov: def generate_merits_proceeding_instance(xml, proceeding) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', proceeding.case_p_num) - xml.__send__('common:Attributes') do + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', proceeding.case_p_num) + xml.__send__(:'common:Attributes') do EntityAttributesGenerator.call(self, xml, :proceeding_merits, @@ -429,28 +429,28 @@ def generate_merits_proceeding_instance(xml, proceeding) end def generate_client_residing_person_entity(xml, sequence_no, _config) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', 'CLIENT_RESIDING_PERSON') + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', 'CLIENT_RESIDING_PERSON') @legal_aid_application.dependants.each_with_index { |dependant, index| generate_client_residing_person_instance(xml, dependant, index) } end def generate_client_residing_person_instance(xml, dependant, index) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', "the client's residing person#{index + 1}") - xml.__send__('common:Attributes') { EntityAttributesGenerator.call(self, xml, :client_residing_person, dependant: dependant) } + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', "the client's residing person#{index + 1}") + xml.__send__(:'common:Attributes') { EntityAttributesGenerator.call(self, xml, :client_residing_person, dependant: dependant) } end end def generate_opponent_other_parties_merits_entity(xml, sequence_no) - xml.__send__('common:SequenceNumber', sequence_no) - xml.__send__('common:EntityName', 'OPPONENT_OTHER_PARTIES') + xml.__send__(:'common:SequenceNumber', sequence_no) + xml.__send__(:'common:EntityName', 'OPPONENT_OTHER_PARTIES') other_parties.each { |other_party| generate_opponent_other_parties_instance_merits(xml, other_party) } end def generate_opponent_other_parties_instance_merits(xml, other_party) - xml.__send__('common:Instances') do - xml.__send__('common:InstanceLabel', "OPPONENT_#{other_party.generate_ccms_opponent_id}") - xml.__send__('common:Attributes') do + xml.__send__(:'common:Instances') do + xml.__send__(:'common:InstanceLabel', "OPPONENT_#{other_party.generate_ccms_opponent_id}") + xml.__send__(:'common:Attributes') do EntityAttributesGenerator.call(self, xml, :opponent_other_parties_merits, other_party: other_party) end end diff --git a/app/services/ccms/requestors/case_add_status_requestor.rb b/app/services/ccms/requestors/case_add_status_requestor.rb index 3d2c4b4800..1f86c3c277 100644 --- a/app/services/ccms/requestors/case_add_status_requestor.rb +++ b/app/services/ccms/requestors/case_add_status_requestor.rb @@ -22,9 +22,9 @@ def request_xml end def soap_body(xml) - xml.__send__('casebim:CaseAddUpdtStatusRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('casebim:TransactionID', case_add_transaction_id) + xml.__send__(:'casebim:CaseAddUpdtStatusRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'casebim:TransactionID', case_add_transaction_id) end end end diff --git a/app/services/ccms/requestors/document_id_requestor.rb b/app/services/ccms/requestors/document_id_requestor.rb index 3738a4116c..dc4946771b 100644 --- a/app/services/ccms/requestors/document_id_requestor.rb +++ b/app/services/ccms/requestors/document_id_requestor.rb @@ -23,24 +23,24 @@ def request_xml end def soap_body(xml) - xml.__send__('casebim:DocumentUploadRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('casebim:NotificationID', -1) - xml.__send__('casebim:CaseReferenceNumber', case_ccms_reference) - xml.__send__('casebim:Document') { document_type(xml) } + xml.__send__(:'casebim:DocumentUploadRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'casebim:NotificationID', -1) + xml.__send__(:'casebim:CaseReferenceNumber', case_ccms_reference) + xml.__send__(:'casebim:Document') { document_type(xml) } end end def document_type(xml) case @document_type when 'bank_transaction_report' - xml.__send__('casebio:DocumentType', 'BSTMT') + xml.__send__(:'casebio:DocumentType', 'BSTMT') when 'gateway_evidence_pdf' - xml.__send__('casebio:DocumentType', 'STATE') + xml.__send__(:'casebio:DocumentType', 'STATE') else - xml.__send__('casebio:DocumentType', 'ADMIN1') + xml.__send__(:'casebio:DocumentType', 'ADMIN1') end - xml.__send__('casebio:Channel', 'E') + xml.__send__(:'casebio:Channel', 'E') end end end diff --git a/app/services/ccms/requestors/document_upload_requestor.rb b/app/services/ccms/requestors/document_upload_requestor.rb index 00c434524a..ee1fb1fba6 100644 --- a/app/services/ccms/requestors/document_upload_requestor.rb +++ b/app/services/ccms/requestors/document_upload_requestor.rb @@ -25,32 +25,32 @@ def request_xml end def soap_body(xml) - xml.__send__('casebim:DocumentUploadRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('casebim:NotificationID', -1) - xml.__send__('casebim:CaseReferenceNumber', case_ccms_reference) - xml.__send__('casebim:Document') { document(xml) } + xml.__send__(:'casebim:DocumentUploadRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'casebim:NotificationID', -1) + xml.__send__(:'casebim:CaseReferenceNumber', case_ccms_reference) + xml.__send__(:'casebim:Document') { document(xml) } end end def document(xml) - xml.__send__('casebio:CCMSDocumentID', ccms_document_id) + xml.__send__(:'casebio:CCMSDocumentID', ccms_document_id) document_type(xml) - xml.__send__('casebio:Channel', 'E') - xml.__send__('casebio:BinData', document_encoded_base64) + xml.__send__(:'casebio:Channel', 'E') + xml.__send__(:'casebio:BinData', document_encoded_base64) end def document_type(xml) case @document_type when 'bank_transaction_report' - xml.__send__('casebio:DocumentType', 'BSTMT') - xml.__send__('casebio:FileExtension', 'csv') + xml.__send__(:'casebio:DocumentType', 'BSTMT') + xml.__send__(:'casebio:FileExtension', 'csv') when 'gateway_evidence_pdf' - xml.__send__('casebio:DocumentType', 'STATE') - xml.__send__('casebio:FileExtension', 'pdf') + xml.__send__(:'casebio:DocumentType', 'STATE') + xml.__send__(:'casebio:FileExtension', 'pdf') else - xml.__send__('casebio:DocumentType', 'ADMIN1') - xml.__send__('casebio:FileExtension', 'pdf') + xml.__send__(:'casebio:DocumentType', 'ADMIN1') + xml.__send__(:'casebio:FileExtension', 'pdf') end end end diff --git a/app/services/ccms/requestors/reference_data_requestor.rb b/app/services/ccms/requestors/reference_data_requestor.rb index e6336b230c..78ae53cca9 100644 --- a/app/services/ccms/requestors/reference_data_requestor.rb +++ b/app/services/ccms/requestors/reference_data_requestor.rb @@ -19,16 +19,16 @@ def request_xml private def soap_body(xml) - xml.__send__('refdatabim:ReferenceDataInqRQ') do - xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } - xml.__send__('refdatabim:SearchCriteria') { search_criteria(xml) } + xml.__send__(:'refdatabim:ReferenceDataInqRQ') do + xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) } + xml.__send__(:'refdatabim:SearchCriteria') { search_criteria(xml) } end end def search_criteria(xml) - xml.__send__('refdatabio:ContextKey', 'CaseReferenceNumber') - xml.__send__('refdatabio:SearchKey') do - xml.__send__('refdatabio:Key', 'CaseReferenceNumber') + xml.__send__(:'refdatabio:ContextKey', 'CaseReferenceNumber') + xml.__send__(:'refdatabio:SearchKey') do + xml.__send__(:'refdatabio:Key', 'CaseReferenceNumber') end end end diff --git a/spec/support/back_link_matcher.rb b/spec/support/back_link_matcher.rb index 63d3c693da..b3cd7194f9 100644 --- a/spec/support/back_link_matcher.rb +++ b/spec/support/back_link_matcher.rb @@ -14,7 +14,7 @@ def extract_back_link(html) atag = parsed_response_body(html).css('a.govuk-back-link').first - atag.nil? ? nil : atag.attr('href') + atag.nil? ? nil : atag.attr(:href) end # URLs match if content same even if order of query part is diferent diff --git a/spec/support/common_methods.rb b/spec/support/common_methods.rb index 36db9f5b3d..91000dbd15 100644 --- a/spec/support/common_methods.rb +++ b/spec/support/common_methods.rb @@ -3,7 +3,7 @@ def parsed_response_body(html = response.body) end def button_value(html_body:, attr:) - parsed_response_body(html_body).css(attr)[0].attr('value') + parsed_response_body(html_body).css(attr)[0].attr(:value) end def save_xml_in_temp_file(_xml)