From dc31597d2b1a5f22627e235a844297ca042be246 Mon Sep 17 00:00:00 2001 From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com> Date: Wed, 31 May 2023 16:05:29 -0600 Subject: [PATCH] Maps direct deposit info for the pdf generator. (#12792) --- .../v2/disability_compensation_pdf_mapper.rb | 8 +++++++ ...disability_compensation_pdf_mapper_spec.rb | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/modules/claims_api/lib/claims_api/v2/disability_compensation_pdf_mapper.rb b/modules/claims_api/lib/claims_api/v2/disability_compensation_pdf_mapper.rb index 5929d758ac3..e23eaad1c80 100644 --- a/modules/claims_api/lib/claims_api/v2/disability_compensation_pdf_mapper.rb +++ b/modules/claims_api/lib/claims_api/v2/disability_compensation_pdf_mapper.rb @@ -17,6 +17,7 @@ def map_claim service_info disability_attributes treatment_centers + direct_deposit_information @pdf_data end @@ -287,6 +288,13 @@ def fed_activation @pdf_data end + + def direct_deposit_information + @pdf_data[:data][:attributes][:directDepositInformation] = @pdf_data[:data][:attributes][:directDeposit] + @pdf_data[:data][:attributes].delete(:directDeposit) + + @pdf_data + end end end end diff --git a/modules/claims_api/spec/lib/claims_api/v2/disability_compensation_pdf_mapper_spec.rb b/modules/claims_api/spec/lib/claims_api/v2/disability_compensation_pdf_mapper_spec.rb index 8f9e7c85f48..0e6833af417 100644 --- a/modules/claims_api/spec/lib/claims_api/v2/disability_compensation_pdf_mapper_spec.rb +++ b/modules/claims_api/spec/lib/claims_api/v2/disability_compensation_pdf_mapper_spec.rb @@ -338,5 +338,28 @@ expect(served_after_nine_eleven).to eq(false) end end + + context '526 section 8, direct deposot' do + let(:form_attributes) { auto_claim.dig('data', 'attributes') || {} } + let(:mapper) { ClaimsApi::V2::DisabilityCompensationPdfMapper.new(form_attributes, pdf_data) } + + it 'maps the attributes correctly' do + mapper.map_claim + + dir_deposit = pdf_data[:data][:attributes][:directDepositInformation] + + account_type = dir_deposit[:accountType] + account_number = dir_deposit[:accountNumber] + routing_number = dir_deposit[:routingNumber] + financial_institution_name = dir_deposit[:financialInstitutionName] + no_account = dir_deposit[:noAccount] + + expect(account_type).to eq('CHECKING') + expect(account_number).to eq('ABCDEF') + expect(routing_number).to eq('123123123') + expect(financial_institution_name).to eq('Some Bank') + expect(no_account).to eq(false) + end + end end end