diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8da827ed0ea..a35057bbfcd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -73,7 +73,6 @@ app/controllers/v0/evss_claims_async_controller.rb @department-of-veterans-affai app/controllers/v0/evss_claims_controller.rb @department-of-veterans-affairs/benefits-management-tools-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group app/controllers/v0/example_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group app/controllers/v0/feature_toggles_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group -app/controllers/v0/financial_status_reports_controller.rb @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group app/controllers/v0/folders_controller.rb @department-of-veterans-affairs/vfs-health-modernization-initiative @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group app/controllers/v0/form1010cg/attachments_controller.rb @department-of-veterans-affairs/vfs-10-10 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group app/controllers/v0/form1095_bs_controller.rb @department-of-veterans-affairs/vfs-1095-b @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group @@ -1014,7 +1013,6 @@ spec/controllers/v0/evss_claims_async_controller_spec.rb @department-of-veterans spec/controllers/v0/evss_claims_controller_spec.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/controllers/v0/example_controller_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/controllers/v0/feature_toggles_controller_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group -spec/controllers/v0/financial_status_reports_controller_spec.rb @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group spec/controllers/v0/form1010cg @department-of-veterans-affairs/vfs-10-10 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/controllers/v0/form1010cg/attachments_controller_spec.rb @department-of-veterans-affairs/vfs-10-10 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/controllers/v0/forms_controller_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/vfs-public-websites-frontend diff --git a/app/controllers/v0/financial_status_reports_controller.rb b/app/controllers/v0/financial_status_reports_controller.rb deleted file mode 100644 index 86a884d9041..00000000000 --- a/app/controllers/v0/financial_status_reports_controller.rb +++ /dev/null @@ -1,163 +0,0 @@ -# frozen_string_literal: true - -require 'debts_api/v0/financial_status_report_service' - -module V0 - class FinancialStatusReportsController < ApplicationController - service_tag 'financial-report' - before_action { authorize :debt, :access? } - - rescue_from ::DebtsApi::V0::FinancialStatusReportService::FSRNotFoundInRedis, with: :render_not_found - - def create - render json: service.submit_financial_status_report(fsr_form) - end - - def download_pdf - send_data( - service.get_pdf, - type: 'application/pdf', - filename: 'VA Form 5655 - Submitted', - disposition: 'attachment' - ) - end - - private - - def render_not_found - render json: nil, status: :not_found - end - - def full_name - %i[first middle last] - end - - def address - %i[ - addressline_one - addressline_two - addressline_three - city - state_or_province - zip_or_postal_code - country_name - ] - end - - def name_amount - %i[name amount] - end - - # rubocop:disable Metrics/MethodLength - def fsr_form - params.permit( - streamlined: %i[ - value - type - ], - personal_identification: %i[fsr_reason ssn file_number], - personal_data: [ - :telephone_number, - :email, - :date_of_birth, - :married, - { ages_of_other_dependents: [], - veteran_full_name: full_name, - address:, - spouse_full_name: full_name, - employment_history: [ - :veteran_or_spouse, - :occupation_name, - :from, - :to, - :present, - :employer_name, - { employer_address: address } - ] } - ], - income: [ - :veteran_or_spouse, - :monthly_gross_salary, - :total_deductions, - :net_take_home_pay, - :total_monthly_net_income, - { deductions: [ - :taxes, - :retirement, - :social_security, - { other_deductions: name_amount } - ], - other_income: name_amount } - ], - expenses: [ - :rent_or_mortgage, - :food, - :utilities, - :other_living_expenses, - :expenses_installment_contracts_and_other_debts, - :total_monthly_expenses, - { other_living_expenses: name_amount } - ], - discretionary_income: %i[ - net_monthly_income_less_expenses - amount_can_be_paid_toward_debt - ], - assets: [ - :cash_in_bank, - :cash_on_hand, - :trailers_boats_campers, - :us_savings_bonds, - :stocks_and_other_bonds, - :real_estate_owned, - :total_assets, - { automobiles: %i[make model year resale_value], - other_assets: name_amount } - ], - installment_contracts_and_other_debts: [ - :creditor_name, - :date_started, - :purpose, - :original_amount, - :unpaid_balance, - :amount_due_monthly, - :amount_past_due, - { creditor_address: address } - ], - total_of_installment_contracts_and_other_debts: %i[ - original_amount - unpaid_balance - amount_due_monthly - amount_past_due - ], - additional_data: [ - :additional_comments, - { bankruptcy: %i[ - has_been_adjudicated_bankrupt - date_discharged - court_location - docket_number - ] } - ], - applicant_certifications: %i[ - veteran_signature - ], - selected_debts_and_copays: [ - :current_ar, - :debt_type, - :deduction_code, - :p_h_amt_due, - :p_h_dfn_number, - :p_h_cerner_patient_id, - :resolution_comment, - :resolution_option, - { station: [:facilit_y_num] } - ] - ).to_hash - end - # rubocop:enable Metrics/MethodLength - - def service - DebtsApi::V0::FinancialStatusReportService.new(current_user) - end - end -end diff --git a/app/swagger/swagger/requests/financial_status_reports.rb b/app/swagger/swagger/requests/financial_status_reports.rb index 80024600b35..2bc6c94b8fd 100644 --- a/app/swagger/swagger/requests/financial_status_reports.rb +++ b/app/swagger/swagger/requests/financial_status_reports.rb @@ -5,7 +5,7 @@ module Requests class FinancialStatusReports include Swagger::Blocks - swagger_path '/v0/financial_status_reports' do + swagger_path '/debts_api/v0/financial_status_reports' do operation :post do key :summary, 'Submits Form VA-5655 data to the Debt Management Center' key :description, "Submits Form VA-5655 to the Debt Management Center. @@ -32,7 +32,7 @@ class FinancialStatusReports end end - swagger_path '/v0/financial_status_reports/download_pdf' do + swagger_path '/debts_api/v0/financial_status_reports/download_pdf' do operation :get do key :summary, 'Downloads the filled copy of VA-5655 Financial Status Report' key :operationId, 'getFinancialStatusReport' diff --git a/config/routes.rb b/config/routes.rb index 141b1ee1207..e9ee58f517f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,12 +92,6 @@ end get 'benefits_reference_data/*path', to: 'benefits_reference_data#get_data' - resources :financial_status_reports, only: %i[create] do - collection do - get :download_pdf - end - end - post '/mvi_users/:id', to: 'mpi_users#submit' resource :decision_review_evidence, only: :create diff --git a/spec/controllers/v0/financial_status_reports_controller_spec.rb b/spec/controllers/v0/financial_status_reports_controller_spec.rb deleted file mode 100644 index 0236fd70a24..00000000000 --- a/spec/controllers/v0/financial_status_reports_controller_spec.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -# delete - -require 'rails_helper' -require_relative '../../../modules/debts_api/spec/support/stub_financial_status_report' -require 'support/financial_status_report_helpers' - -RSpec.describe V0::FinancialStatusReportsController, type: :controller do - let(:service_class) { DebtsApi::V0::FinancialStatusReportService } - let(:valid_form_data) { get_fixture('dmc/fsr_submission') } - let(:user) { build(:user, :loa3) } - let(:filenet_id) { '93631483-E9F9-44AA-BB55-3552376400D8' } - - before do - Flipper.disable(:financial_status_report_debts_api_module) - sign_in_as(user) - mock_pdf_fill - end - - def mock_pdf_fill - pdf_stub = class_double('PdfFill::Filler').as_stubbed_const - allow(pdf_stub).to receive(:fill_ancillary_form).and_return(::Rails.root.join(*'/spec/fixtures/dmc/5655.pdf' - .split('/')).to_s) - end - - describe '#create' do - context 'when service raises FSRNotFoundInRedis' do - before do - expect_any_instance_of(service_class).to receive( - :submit_financial_status_report - ).and_raise( - service_class::FSRNotFoundInRedis - ) - end - - it 'renders 404' do - post(:create, params: valid_form_data) - expect(response.status).to eq(404) - expect(response.header['Content-Type']).to include('application/json') - expect(JSON.parse(response.body)).to eq(nil) - end - end - - it 'submits a financial status report' do - VCR.use_cassette('dmc/submit_fsr') do - VCR.use_cassette('bgs/people_service/person_data') do - post(:create, params: valid_form_data.to_h, as: :json) - expect(response.code).to eq('200') - end - end - end - - context 'with module flipper on' do - before do - Flipper.enable(:financial_status_report_debts_api_module) - end - - after do - Flipper.disable(:financial_status_report_debts_api_module) - end - - it 'successfullfy redirects to debts-api module' do - VCR.use_cassette('dmc/submit_fsr') do - VCR.use_cassette('bgs/people_service/person_data') do - post(:create, params: valid_form_data.to_h, as: :json) - expect(response.code).to eq('200') - end - end - end - end - end - - describe '#download_pdf' do - stub_financial_status_report(:download_pdf) - - it 'downloads the filled financial status report pdf' do - set_filenet_id(user:, filenet_id:) - get(:download_pdf) - expect(response.header['Content-Type']).to eq('application/pdf') - expect(response.body).to eq(content) - end - end -end diff --git a/spec/requests/swagger_spec.rb b/spec/requests/swagger_spec.rb index 7cb1b211165..a3c3ea43848 100644 --- a/spec/requests/swagger_spec.rb +++ b/spec/requests/swagger_spec.rb @@ -725,7 +725,7 @@ VCR.use_cassette('bgs/people_service/person_data') do expect(subject).to validate( :post, - '/v0/financial_status_reports', + '/debts_api/v0/financial_status_reports', 200, headers.merge( '_data' => fsr_data @@ -3417,7 +3417,7 @@ it 'tests all documented routes' do # exclude these route as they return binaries subject.untested_mappings.delete('/v0/letters/{id}') - subject.untested_mappings.delete('/v0/financial_status_reports/download_pdf') + subject.untested_mappings.delete('/debts_api/v0/financial_status_reports/download_pdf') subject.untested_mappings.delete('/v0/form1095_bs/download_pdf/{tax_year}') subject.untested_mappings.delete('/v0/form1095_bs/download_txt/{tax_year}') subject.untested_mappings.delete('/v0/claim_letters/{document_id}')