Skip to content

Commit

Permalink
mobile - update claim request decision response (#12952)
Browse files Browse the repository at this point in the history
  • Loading branch information
aherzberg authored Jun 12, 2023
1 parent 5e84d5e commit f1724a9
Show file tree
Hide file tree
Showing 5 changed files with 3,015 additions and 1,161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ def get_appeal

def request_decision
jid = if Flipper.enabled?(:mobile_lighthouse_claims, @current_user)
lighthouse_claims_proxy.request_decision(params[:id])
response = lighthouse_claims_proxy.request_decision(params[:id])
adapt_response(response)
else
evss_claims_proxy.request_decision(params[:id])
end

render json: { data: { job_id: jid } }, status: :accepted
end

Expand Down Expand Up @@ -154,6 +156,10 @@ def filter_by_completed(list, filter)
entry[:completed] == ActiveRecord::Type::Boolean.new.deserialize(filter)
end
end

def adapt_response(response)
response['success'] ? 'success' : 'failure'
end
end
end
end
4,068 changes: 2,911 additions & 1,157 deletions modules/mobile/docs/index.html

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion modules/mobile/docs/schemas/ClaimDocUpload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ properties:
properties:
jobId:
type: string
description: job id of upload process
enum:
- success
- failure
example: 'success'
description: job status

12 changes: 10 additions & 2 deletions modules/mobile/spec/request/claims_decision_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@

after { Flipper.disable(:mobile_lighthouse_claims) }

it 'returns jid with 202 status' do
it 'returns success with 202 status' do
VCR.use_cassette('mobile/lighthouse_claims/request_decision/200_response') do
post '/mobile/v0/claim/600397108/request-decision', headers: iam_headers
end
expect(response).to have_http_status(:accepted)
expect(response.parsed_body.dig('data', 'jobId')).to eq({ 'success' => true })
expect(response.parsed_body.dig('data', 'jobId')).to eq('success')
end

it 'returns failure with 202 status' do
VCR.use_cassette('mobile/lighthouse_claims/request_decision/200_failure_response') do
post '/mobile/v0/claim/600397108/request-decision', headers: iam_headers
end
expect(response).to have_http_status(:accepted)
expect(response.parsed_body.dig('data', 'jobId')).to eq('failure')
end

it 'returns 404 for non-existent record' do
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f1724a9

Please sign in to comment.