Skip to content

Commit

Permalink
MBMS-73637 re-organized preneed meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorJeff committed Sep 3, 2024
1 parent d3d094b commit 4004d51
Showing 1 changed file with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,41 @@ def initialize(data)
@data = data
end

def veteran_or_claimant_first_name(form_data)
relationship = form_data.dig('application', 'claimant', 'relationship_to_vet')

if relationship != '1' && relationship != 'veteran'
form_data.dig('application', 'veteran', 'current_name', 'first')
else
form_data.dig('application', 'claimant', 'name', 'first')
end
end

def veteran_or_claimant_last_name(form_data)
relationship = form_data.dig('application', 'claimant', 'relationship_to_vet')

if relationship != '1' && relationship != 'veteran'
form_data.dig('application', 'veteran', 'current_name', 'last')
else
form_data.dig('application', 'claimant', 'name', 'last')
endq
end

def veteran_or_claimant_file_number(form_data)
relationship = form_data.dig('application', 'claimant', 'relationship_to_vet')

if relationship != '1' && relationship != 'veteran'
form_data.dig('application', 'veteran', 'ssn') || ''
else
form_data.dig('application', 'claimant', 'ssn') || ''
end
end

def metadata
{
'veteranFirstName' => @data.dig('application', 'claimant', 'name', 'first'),
'veteranLastName' => @data.dig('application', 'claimant', 'name', 'last'),
'fileNumber' => @data.dig('application', 'claimant', 'ssn')&.gsub('-', ''),
'veteranFirstName' => veteran_or_claimant_first_name(@data),
'veteranLastName' => veteran_or_claimant_last_name(@data),
'fileNumber' => veteran_or_claimant_file_number(@data)&.gsub('-', ''),
'zipCode' => @data.dig('application', 'claimant', 'address', 'postal_code'),
'source' => 'VA Platform Digital Forms',
'docType' => @data['form_number'],
Expand Down

0 comments on commit 4004d51

Please sign in to comment.