Skip to content

Commit

Permalink
fix card number issue in ATP inbound VLP mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
saipraveen18 committed Aug 30, 2024
1 parent df0e992 commit 3f4db73
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/aca_entities/atp/functions/vlp_document_hash_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def handle_identification_category(vlp_document, document_person_id)
vlp_document[:citizenship_number] = document_person_id[:identification_id]
when /naturalization\s*certificate\s*number/i
vlp_document[:naturalization_number] = document_person_id[:identification_id]
when /card\s*number/i
vlp_document[:card_number] = document_person_id[:identification_id]
end
end

Expand Down
29 changes: 29 additions & 0 deletions spec/aca_entities/atp/functions/vlp_document_hash_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@
}
end

let(:document_i766) do
{
category_code: 'I766',
document_person_ids: [
{
identification_category_text: 'Alien Number',
identification_id: '123456789'
},
{
identification_category_text: 'Card Number',
identification_id: '123456789'
}
],
expiration_date: {
date: '2022-12-31'
}
}
end

describe '#call' do
context 'with a document that is a naturalization certificate' do
it 'returns a hash with updated document information' do
Expand Down Expand Up @@ -159,6 +178,16 @@
expect(result[:card_number]).to eq('AAA0000000000')
end
end

context 'with a document that is an I-766' do
it 'returns a hash with updated document information' do
result = builder.call(document_i766)
expect(result[:category_code]).to eq('I-766 (Employment Authorization Card)')
expect(result[:alien_number]).to eq('123456789')
expect(result[:expiration_date]).to eq('2022-12-31')
expect(result[:card_number]).to eq('123456789')
end
end
end

describe '#update_subject' do
Expand Down

0 comments on commit 3f4db73

Please sign in to comment.