Skip to content

Commit

Permalink
API-26190-526-v2-sec-1-vet-identification-pdf-gen (#12600)
Browse files Browse the repository at this point in the history
* Adds section 1 to v2 526 mapper

* Refactors mapper
  • Loading branch information
stiehlrod authored May 15, 2023
1 parent 7434461 commit 168123b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ def get_pdf_data
{
data: {
attributes:
{
claimProcessType: '',
claimCertificationAndSignature: {
dateSigned: ''
}
}
{}
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,39 @@ def initialize(auto_claim, pdf_data)
end

def map_claim
claim_attributes
veteran_info

@pdf_data
end

def claim_attributes
@pdf_data[:data][:attributes] = @auto_claim.deep_symbolize_keys
claim_date
claim_process_type

@pdf_data
end

def claim_date
@pdf_data[:data][:attributes][:claimCertificationAndSignature][:dateSigned] =
@auto_claim['claimDate']
@pdf_data[:data][:attributes].merge!(claimCertificationAndSignature: { dateSigned: @auto_claim['claimDate'] })
@pdf_data[:data][:attributes].delete(:claimDate)
@pdf_data
end

def claim_process_type
@pdf_data[:data][:attributes][:claimProcessType] = @auto_claim['claimProcessType']
def veteran_info
@pdf_data[:data][:attributes].merge!(
identificationInformation: @auto_claim['veteranIdentification'].deep_symbolize_keys
)
zip

@pdf_data
end

def zip
zip = @auto_claim['veteranIdentification']['mailingAddress']['zipFirstFive'] +
@auto_claim['veteranIdentification']['mailingAddress']['zipLastFour']
@pdf_data[:data][:attributes][:identificationInformation][:mailingAddress].merge!(zip:)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"city": "Portland",
"country": "USA",
"zipFirstFive": "41726",
"zipLastFour": "",
"zipLastFour": "1234",
"state": "OR"
},
"serviceNumber": "ABCDEFGH",
"serviceNumber": "123456789",
"emailAddress": {
"email": "valid@somedomain.com",
"agreeToEmailRelatedToClaim": true
Expand All @@ -22,7 +22,7 @@
"telephone": "1234567890",
"internationalTelephone": "1234567890"
},
"vaFileNumber": "ABCDEF"
"vaFileNumber": "AB123CDEF"
},
"serviceInformation": {
"servicePeriods": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
{
data: {
attributes:
{
claimProcessType: '',
claimCertificationAndSignature: {
dateSigned: ''
}
}
{}
}
}
end
Expand All @@ -40,14 +35,56 @@

it 'maps the claim date' do
mapper.map_claim
attribute = pdf_data[:data][:attributes][:claimCertificationAndSignature][:dateSigned]
expect(attribute).to eq('2023-02-18')

date_signed = pdf_data[:data][:attributes][:claimCertificationAndSignature][:dateSigned]
claim_process_type = pdf_data[:data][:attributes][:claimProcessType]

expect(date_signed).to eq('2023-02-18')
expect(claim_process_type).to eq('STANDARD_CLAIM_PROCESS')
end
end

it 'maps the claim process type' do
context '526 section 1' do
let(:form_attributes) { auto_claim.dig('data', 'attributes') || {} }
let(:mapper) { ClaimsApi::V2::DisabilitiyCompensationPdfMapper.new(form_attributes, pdf_data) }

it 'maps the mailing address' do
mapper.map_claim
attribute = pdf_data[:data][:attributes][:claimProcessType]
expect(attribute).to eq('STANDARD_CLAIM_PROCESS')

number_and_street = pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:numberAndStreet]
apartment_or_unit_number =
pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:apartmentOrUnitNumber]
city = pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:city]
country = pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:country]
zip = pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:zip]
state = pdf_data[:data][:attributes][:identificationInformation][:mailingAddress][:state]

expect(number_and_street).to eq('1234 Couch Street')
expect(apartment_or_unit_number).to eq('22')
expect(city).to eq('Portland')
expect(country).to eq('USA')
expect(zip).to eq('417261234')
expect(state).to eq('OR')
end

it 'maps the other veteran info' do
mapper.map_claim

currently_va_employee = pdf_data[:data][:attributes][:identificationInformation][:currentlyVaEmployee]
va_file_number = pdf_data[:data][:attributes][:identificationInformation][:vaFileNumber]
email = pdf_data[:data][:attributes][:identificationInformation][:emailAddress][:email]
agree_to_email =
pdf_data[:data][:attributes][:identificationInformation][:emailAddress][:agreeToEmailRelatedToClaim]
telephone = pdf_data[:data][:attributes][:identificationInformation][:veteranNumber][:telephone]
international_telephone =
pdf_data[:data][:attributes][:identificationInformation][:veteranNumber][:internationalTelephone]

expect(currently_va_employee).to eq(false)
expect(va_file_number).to eq('AB123CDEF')
expect(email).to eq('valid@somedomain.com')
expect(agree_to_email).to eq(true)
expect(telephone).to eq('1234567890')
expect(international_telephone).to eq('1234567890')
end
end
end
Expand Down

0 comments on commit 168123b

Please sign in to comment.