diff --git a/lib/lighthouse/veteran_verification/constants.rb b/lib/lighthouse/veteran_verification/constants.rb index 633e8b6fb6a..a75fe7ff580 100644 --- a/lib/lighthouse/veteran_verification/constants.rb +++ b/lib/lighthouse/veteran_verification/constants.rb @@ -1,16 +1,18 @@ +# frozen_string_literal: true + module VeteranVerification module Constants NOT_FOUND_MESSAGE = [ 'We’re sorry. There’s a problem with your discharge status records. We can’t provide a Veteran status ' \ - 'card for you right now.', + 'card for you right now.', 'To fix the problem with your records, call the Defense Manpower Data Center at 800-538-9552 (TTY: 711).' \ - ' They’re open Monday through Friday, 8:00 a.m. to 8:00 p.m. ET.' - ] + ' They’re open Monday through Friday, 8:00 a.m. to 8:00 p.m. ET.' + ].freeze NOT_ELIGIBLE_MESSAGE = [ 'Our records show that you’re not eligible for a Veteran status card. To get a Veteran status card, you ' \ - 'must have received an honorable discharge for at least one period of service.', + 'must have received an honorable discharge for at least one period of service.', 'If you think your discharge status is incorrect, call the Defense Manpower Data Center at 800-538-9552 ' \ - '(TTY: 711). They’re open Monday through Friday, 8:00 a.m. to 8:00 p.m. ET.' - ] + '(TTY: 711). They’re open Monday through Friday, 8:00 a.m. to 8:00 p.m. ET.' + ].freeze end -end \ No newline at end of file +end diff --git a/lib/lighthouse/veteran_verification/service.rb b/lib/lighthouse/veteran_verification/service.rb index 7a3eab592fa..e46b2e47fd2 100644 --- a/lib/lighthouse/veteran_verification/service.rb +++ b/lib/lighthouse/veteran_verification/service.rb @@ -60,14 +60,14 @@ def handle_error(error, lighthouse_client_id, endpoint) def transform_response(response) attributes = response['data']['attributes'] - return response if attributes['veteran_status'] != 'not confirmed' || !attributes.include?('not_confirmed_reason') - - if attributes['not_confirmed_reason'] == 'NOT_TITLE_38' - response['data']['message'] = VeteranVerification::Constants::NOT_ELIGIBLE_MESSAGE - else - response['data']['message'] = VeteranVerification::Constants::NOT_FOUND_MESSAGE - end + return response if attributes['veteran_status'] != 'not confirmed' || attributes.exclude?('not_confirmed_reason') + response['data']['message'] = + if attributes['not_confirmed_reason'] == 'NOT_TITLE_38' + VeteranVerification::Constants::NOT_ELIGIBLE_MESSAGE + else + VeteranVerification::Constants::NOT_FOUND_MESSAGE + end response end end