Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 26-4555 no longer need an ICN to go to the SAHSHA API #19067

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def submit

response = if intent_service.use_intent_api?
handle_210966_authenticated
elsif form_is264555_and_should_use_lgy_api
elsif params[:form_number] == '26-4555'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there tests for this that you can add to or update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! I've added a test. Thanks @rmtolmach

handle264555
else
submit_form_to_benefits_intake
Expand Down Expand Up @@ -213,10 +213,6 @@ def perform_pdf_upload(location, file_path, metadata, form)
lighthouse_service.perform_upload(**upload_params)
end

def form_is264555_and_should_use_lgy_api
params[:form_number] == '26-4555' && icn
end

def icn
@current_user&.icn
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'simple_forms_api_submission/metadata_validator'
require 'common/file_helpers'
require 'lighthouse/benefits_intake/service'
require 'lgy/service'

RSpec.describe 'SimpleFormsApi::V1::SimpleForms', type: :request do
forms = [
Expand Down Expand Up @@ -346,6 +347,32 @@
end
end

context 'going to SAHSHA API' do
let(:reference_number) { 'some-reference-number' }
let(:body_status) { 'ACCEPTED' }
let(:body) { { 'reference_number' => reference_number, 'status' => body_status } }
let(:status) { 200 }
let(:lgy_response) { double(body:, status:) }

before do
sign_in
allow_any_instance_of(LGY::Service).to receive(:post_grant_application).and_return(lgy_response)
end

it 'makes the request to LGY::Service' do
fixture_path = Rails.root.join('modules', 'simple_forms_api', 'spec', 'fixtures', 'form_json',
'vba_26_4555.json')
data = JSON.parse(fixture_path.read)

post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:ok)
parsed_body = JSON.parse(response.body)
expect(parsed_body['reference_number']).to eq reference_number
expect(parsed_body['status']).to eq body_status
end
end

describe 'failed requests scrub PII from error messages' do
before do
sign_in
Expand Down
Loading