Skip to content

Commit

Permalink
get organization name from db and fix claimant sigs on 2122a (#16196)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvcAdHoc authored Apr 8, 2024
1 parent 85af796 commit 2b073e4
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,8 @@ def pdf_constructor(form_number)
#
# @return [Hash] All data to be inserted into pdf
def data(power_of_attorney, form_number, rep)
res = power_of_attorney
.form_data.deep_merge({
'veteran' => {
'firstName' => power_of_attorney.auth_headers['va_eauth_firstName'],
'lastName' => power_of_attorney.auth_headers['va_eauth_lastName'],
'ssn' => power_of_attorney.auth_headers['va_eauth_pnid'],
'birthdate' => power_of_attorney.auth_headers['va_eauth_birthdate']
}
})
res = power_of_attorney.form_data
res.deep_merge!(veteran_attributes(power_of_attorney))

signatures = if form_number == '2122A'
individual_signatures(power_of_attorney, rep)
Expand All @@ -65,10 +58,24 @@ def data(power_of_attorney, form_number, rep)
'firstName' => rep.first_name,
'lastName' => rep.last_name
} })

res.deep_merge!(organization_name(power_of_attorney)) if form_number == '2122'

res.merge!({ 'text_signatures' => signatures })
res
end

def veteran_attributes(power_of_attorney)
{
'veteran' => {
'firstName' => power_of_attorney.auth_headers['va_eauth_firstName'],
'lastName' => power_of_attorney.auth_headers['va_eauth_lastName'],
'ssn' => power_of_attorney.auth_headers['va_eauth_pnid'],
'birthdate' => power_of_attorney.auth_headers['va_eauth_birthdate']
}
}
end

def organization_signatures(power_of_attorney, rep)
first_name, last_name = veteran_or_claimant_signature(power_of_attorney)
{
Expand All @@ -89,11 +96,11 @@ def organization_signatures(power_of_attorney, rep)
end

def individual_signatures(power_of_attorney, rep)
first_name, last_name = veteran_or_claimant_signature(power_of_attorney)
{
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'signature' => "#{first_name} #{last_name} - signed via api.va.gov",
'x' => 35,
'y' => 306
},
Expand All @@ -117,6 +124,18 @@ def veteran_or_claimant_signature(power_of_attorney)
end
[first_name, last_name]
end

def organization_name(power_of_attorney)
poa_code = power_of_attorney.form_data.dig('serviceOrganization', 'poaCode')

name = ::Veteran::Service::Organization.find_by(poa: poa_code).name

{
'serviceOrganization' => {
'organizationName' => name
}
}
end
end
end
end
20 changes: 0 additions & 20 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9198,11 +9198,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -9832,11 +9827,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down Expand Up @@ -10526,11 +10516,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -11151,11 +11136,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9198,11 +9198,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -9832,11 +9827,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down Expand Up @@ -10526,11 +10516,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down Expand Up @@ -11151,11 +11136,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down
5 changes: 0 additions & 5 deletions modules/claims_api/config/schemas/v2/2122.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@
"type": "string",
"example": "A1Q"
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
},
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
Expand Down
5 changes: 0 additions & 5 deletions modules/claims_api/config/schemas/v2/2122a.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@
"example": "6789"
}
}
},
"organizationName": {
"description": "Name of the service organization.",
"type": "string",
"example": "I help vets LLC."
}
}
},
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
},
representative: {
poaCode: 'A1Q',
registrationNumber: '1234',
type: 'ATTORNEY',
firstName: 'Bob',
lastName: 'Law',
address: {
addressLine1: '2719 Hyperion Ave',
city: 'Los Angeles',
Expand All @@ -68,7 +67,8 @@
other_service_branch_temp.form_data = {
veteran: {
serviceNumber: '987654321',
otherServiceBranch: 'Air National Guard',
serviceBranch: 'OTHER',
serviceBranchOther: 'Air National Guard',
address: {
addressLine1: '2719 Hyperion Ave',
city: 'Los Angeles',
Expand Down Expand Up @@ -103,8 +103,7 @@
representative: {
poaCode: 'A1Q',
type: 'ATTORNEY',
firstName: 'Bob',
lastName: 'Law',
registrationNumber: '1234',
address: {
addressLine1: '2719 Hyperion Ave',
city: 'Los Angeles',
Expand Down Expand Up @@ -138,8 +137,7 @@
'text_signatures' => {
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'signature' => 'Lillian Disney - signed via api.va.gov',
'x' => 35,
'y' => 306
},
Expand All @@ -149,6 +147,10 @@
'y' => 200
}
]
},
'representative' => {
'firstName' => 'Bob',
'lastName' => 'Law'
}
}
)
Expand All @@ -173,8 +175,7 @@
'text_signatures' => {
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'signature' => 'Lillian Disney - signed via api.va.gov',
'x' => 35,
'y' => 306
},
Expand All @@ -184,13 +185,17 @@
'y' => 200
}
]
},
'representative' => {
'firstName' => 'Bob',
'lastName' => 'Law'
}
}
)

constructor = ClaimsApi::V2::PoaPdfConstructor::Individual.new
expected_pdf = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', '21-22A', 'v2',
'signed_filled_final.pdf')
'signed_filled_final_other_service_branch.pdf')
generated_pdf = constructor.construct(data, id: power_of_attorney.id)
expect(generated_pdf).to match_pdf_content_of(expected_pdf)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
},
serviceOrganization: {
poaCode: '456',
firstName: 'Bob',
lastName: 'Representative',
organizationName: 'I Help Vets LLC',
registrationNumber: '1234',
address: {
addressLine1: '2719 Hyperion Ave',
city: 'Los Angeles',
Expand Down Expand Up @@ -83,8 +81,7 @@
'text_signatures' => {
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'signature' => 'Lillian Disney - signed via api.va.gov',
'x' => 35,
'y' => 240
},
Expand All @@ -94,7 +91,13 @@
'y' => 200
}
]
}
},
'serviceOrganization' =>
{
'firstName' => 'Bob',
'lastName' => 'Representative',
'organizationName' => 'I Help Vets LLC'
}
}
)

Expand Down
Loading

0 comments on commit 2b073e4

Please sign in to comment.