Skip to content

Commit

Permalink
Updated PDF, fixtures, and PDF mapping logic (#15998)
Browse files Browse the repository at this point in the history
* Updated PDF, fixtures, and PDF mapping logic

* update generated test PDFs
  • Loading branch information
danlim715 authored Mar 25, 2024
1 parent eb77987 commit 3a83f6c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
Binary file modified lib/pdf_fill/forms/pdfs/21P-527EZ.pdf
Binary file not shown.
12 changes: 6 additions & 6 deletions lib/pdf_fill/forms/va21p527ez.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ def expand_veteran_service_information
@form_data['serviceBranch'] = @form_data['serviceBranch']&.select { |_, value| value == true }

@form_data['pow'] = to_radio_yes_no(@form_data['powDateRange'].present?)
if @form_data['pow'].zero?
if @form_data['pow'] == 1
@form_data['powDateRange'] ||= {}
@form_data['powDateRange']['from'] = split_date(@form_data.dig('powDateRange', 'from'))
@form_data['powDateRange']['to'] = split_date(@form_data.dig('powDateRange', 'to'))
Expand Down Expand Up @@ -1372,10 +1372,10 @@ def expand_pension_information
)

# If "YES," skip question 4B
@form_data['medicalCondition'] = 'Off' if @form_data['socialSecurityDisability'].zero?
@form_data['medicalCondition'] = 'Off' if @form_data['socialSecurityDisability'] == 1

# If "NO," skip question 4D
@form_data['medicaidStatus'] = 'Off' if @form_data['nursingHome'] == 1
@form_data['medicaidStatus'] = 'Off' if @form_data['nursingHome'] == 2

@form_data['vaTreatmentHistory'] = to_radio_yes_no(@form_data['vaTreatmentHistory'])
@form_data['federalTreatmentHistory'] = to_radio_yes_no(@form_data['federalTreatmentHistory'])
Expand All @@ -1392,7 +1392,7 @@ def expand_employment_history
})
end

@form_data['currentEmployers'] = nil if @form_data['currentEmployment'] == 1
@form_data['currentEmployers'] = nil if @form_data['currentEmployment'] == 2
end

# SECTION VI: MARITAL STATUS
Expand Down Expand Up @@ -1575,7 +1575,7 @@ def expand_income_and_assets
end
@form_data['transferredAssets'] = to_radio_yes_no(@form_data['transferredAssets'])
@form_data['homeOwnership'] = to_radio_yes_no(@form_data['homeOwnership'])
if (@form_data['homeOwnership']).zero?
if (@form_data['homeOwnership']) == 1
@form_data['homeAcreageMoreThanTwo'] = to_radio_yes_no(@form_data['homeAcreageMoreThanTwo'])
@form_data['landMarketable'] = to_radio_yes_no(@form_data['landMarketable'])
end
Expand Down Expand Up @@ -1711,7 +1711,7 @@ def to_checkbox_on_off(obj)
end

def to_radio_yes_no(obj)
obj ? 0 : 1
obj ? 1 : 2
end
end
end
Expand Down
Binary file modified spec/fixtures/pdf_fill/21P-527EZ/kitchen_sink.pdf
Binary file not shown.
42 changes: 21 additions & 21 deletions spec/fixtures/pdf_fill/21P-527EZ/merge_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"second": "22",
"third": "4444"
},
"vaClaimsHistory": 0,
"vaClaimsHistory": 1,
"vaFileNumber": "12345678",
"veteranDateOfBirth": {
"month": "01",
Expand Down Expand Up @@ -55,25 +55,25 @@
"year": "1973"
}
},
"socialSecurityDisability": 1,
"medicalCondition": 1,
"nursingHome": 0,
"socialSecurityDisability": 2,
"medicalCondition": 2,
"nursingHome": 1,
"medicaidCoverage": false,
"medicaidStatus": 0,
"specialMonthlyPension": 1,
"vaTreatmentHistory": 0,
"medicaidStatus": 1,
"specialMonthlyPension": 2,
"vaTreatmentHistory": 1,
"vaMedicalCenters": [
{
"medicalCenter": "Dallas VA Medical Center"
}
],
"federalTreatmentHistory": 0,
"federalTreatmentHistory": 1,
"federalMedicalCenters": [
{
"medicalCenter": "Memphis Health Care"
}
],
"currentEmployment": 0,
"currentEmployment": 1,
"currentEmployers": [
{
"jobType": "Customer service",
Expand Down Expand Up @@ -141,7 +141,7 @@
"second": "22",
"third": "4444"
},
"spouseIsVeteran": 0,
"spouseIsVeteran": 1,
"spouseVaFileNumber": "23423444",
"spouseAddress": {
"street": "123 7th st",
Expand Down Expand Up @@ -345,7 +345,7 @@
"monthlyPaymentOverflow": "$2,300.00"
}
],
"totalNetWorth": 1,
"totalNetWorth": 2,
"netWorthEstimation": {
"part_cents": "00",
"part_two": "1",
Expand Down Expand Up @@ -579,15 +579,15 @@
"paymentAmountOverflow": "$100.00"
}
],
"transferredAssets": 0,
"homeOwnership": 0,
"homeAcreageMoreThanTwo": 0,
"transferredAssets": 1,
"homeOwnership": 1,
"homeAcreageMoreThanTwo": 1,
"homeAcreageValue": {
"part_cents": "00",
"part_two": "75",
"part_one": "000"
},
"landMarketable": 0,
"landMarketable": 1,
"receivesIncome": true,
"incomeSources": [
{
Expand Down Expand Up @@ -673,7 +673,7 @@
"noRapidProcessing": 1,
"statementOfTruthCertified": true,
"statementOfTruthSignature": "John Edmund Doe",
"pow": 0,
"pow": 1,
"placeOfSeparationLineOne": "West Brookfield, M",
"placeOfSeparationLineTwo": "A",
"previousEmployers": null,
Expand All @@ -692,10 +692,10 @@
"marriageType": 1,
"otherExplanation": "Other reason"
},
"additionalMarriages": 1,
"additionalSpouseMarriages": 1,
"additionalMarriages": 2,
"additionalSpouseMarriages": 2,
"dependentChildrenInHousehold": "2",
"dependentsNotWithYouAtSameAddress": 0,
"dependentsNotWithYouAtSameAddress": 1,
"custodians": [
{
"first": "Joe",
Expand All @@ -715,8 +715,8 @@
"dependentsWithCustodianOverflow": "Emily Anne Doe"
}
],
"moreThanFourIncomeSources": 1,
"hasAnyExpenses": 0,
"moreThanFourIncomeSources": 2,
"hasAnyExpenses": 1,
"signatureDate": {
"month": "12",
"day": "31",
Expand Down
Binary file modified spec/fixtures/pdf_fill/21P-527EZ/overflow.pdf
Binary file not shown.
Binary file modified spec/fixtures/pdf_fill/21P-527EZ/simple.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions spec/lib/pdf_fill/forms/va21p527ez_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def basic_class

describe '#to_radio_yes_no' do
it 'returns correct values' do
expect(described_class.new({}).to_radio_yes_no(true)).to eq(0)
expect(described_class.new({}).to_radio_yes_no(false)).to eq(1)
expect(described_class.new({}).to_radio_yes_no(true)).to eq(1)
expect(described_class.new({}).to_radio_yes_no(false)).to eq(2)
end
end

Expand Down Expand Up @@ -85,7 +85,7 @@ def basic_class
expect(updated_data['dependents'].length).to eq(1)
expect(updated_data['custodians'].length).to eq(1)
expect(updated_data['dependentChildrenInHousehold']).to eq('0')
expect(updated_data['dependentsNotWithYouAtSameAddress']).to eq(0)
expect(updated_data['dependentsNotWithYouAtSameAddress']).to eq(1)
end
end
end

0 comments on commit 3a83f6c

Please sign in to comment.