Skip to content
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 @@ -146,7 +146,8 @@ def exclusion_periods
private

def set_type
@form_type = params['type']&.capitalize.presence || 'Chapter33'
type = params['type'].presence || 'Chapter33'
@form_type = type.casecmp('VetTec').zero? ? 'VetTec' : type.capitalize
end
Comment thread
s-caso marked this conversation as resolved.

def dispatch_confirmation_email(email)
Expand Down
2 changes: 1 addition & 1 deletion modules/meb_api/lib/dgi/automation/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_claimant_info(type)
private

def end_point(type)
"claimType/#{type.capitalize}/claimants"
"claimType/#{normalize_claim_type(type)}/claimants"
end

def request_headers
Expand Down
2 changes: 1 addition & 1 deletion modules/meb_api/lib/dgi/claimant/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_claimant_info(type)
private

def end_point(type)
"claimType/#{type.capitalize}/claimants/claimantId"
"claimType/#{normalize_claim_type(type)}/claimants/claimantId"
end

def request_headers
Expand Down
9 changes: 9 additions & 0 deletions modules/meb_api/lib/dgi/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ class Service < Common::Client::Base
def initialize(user)
@user = user
end

private

# Normalizes claim type to match DGI enum expectations.
# VetTec must preserve exact casing; other types are capitalized.
def normalize_claim_type(type)
normalized = type.to_s
normalized.casecmp('VetTec').zero? ? 'VetTec' : normalized.capitalize
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,52 @@
end
end
end

describe 'VetTec type parameter casing' do
context 'when type parameter is VetTec with various casings' do
it 'handles exact VetTec casing correctly' do
VCR.use_cassette('dgi/post_claimant_info_vettec') do
get '/meb_api/v0/claimant_info', params: { type: 'VetTec' }
expect(response).to have_http_status(:ok)
end
end

it 'handles lowercase vettec and normalizes to VetTec' do
VCR.use_cassette('dgi/post_claimant_info_vettec') do
get '/meb_api/v0/claimant_info', params: { type: 'vettec' }
expect(response).to have_http_status(:ok)
end
end

it 'handles uppercase VETTEC and normalizes to VetTec' do
VCR.use_cassette('dgi/post_claimant_info_vettec') do
get '/meb_api/v0/claimant_info', params: { type: 'VETTEC' }
expect(response).to have_http_status(:ok)
end
end

it 'handles mixed case VeTtEc and normalizes to VetTec' do
VCR.use_cassette('dgi/post_claimant_info_vettec') do
get '/meb_api/v0/claimant_info', params: { type: 'VeTtEc' }
expect(response).to have_http_status(:ok)
end
end
end

context 'when type parameter is other chapter types' do
it 'capitalizes chapter33 correctly' do
VCR.use_cassette('dgi/post_claimant_info') do
get '/meb_api/v0/claimant_info', params: { type: 'chapter33' }
expect(response).to have_http_status(:ok)
end
end

it 'capitalizes chapter1606 correctly' do
VCR.use_cassette('dgi/post_claimant_info_1606') do
get '/meb_api/v0/claimant_info', params: { type: 'chapter1606' }
expect(response).to have_http_status(:ok)
end
end
end
end
end

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

38 changes: 38 additions & 0 deletions spec/support/vcr_cassettes/dgi/post_claimant_info_vettec.yml

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

Loading