Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api 33481 poa v2 ind signatures #16064

Merged
merged 43 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
aeeccaf
Make reg num required
acovrig Mar 14, 2024
6cb2b0a
Add sig to PDF
acovrig Mar 14, 2024
05f8ac4
Add .first test
acovrig Mar 14, 2024
91c97ea
Remove page1 signatures
acovrig Mar 14, 2024
518880e
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 18, 2024
a8b5d69
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 18, 2024
6909c0a
Handle duplicate reps by ID
acovrig Mar 19, 2024
7def9b8
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 19, 2024
1a3e828
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 19, 2024
8ca67c5
update tests
acovrig Mar 20, 2024
3b3a741
switch to created_at
acovrig Mar 20, 2024
0177f3e
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 20, 2024
057e2d5
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 20, 2024
70460d0
Remove unused method
acovrig Mar 20, 2024
937ff32
Require rep_id in builder
acovrig Mar 21, 2024
38c3b6c
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 21, 2024
8634a4b
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 22, 2024
39af6d4
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 25, 2024
dd65266
Fix merge conflictions
acovrig Mar 25, 2024
ab66f19
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 25, 2024
d20f566
Fix merge
acovrig Mar 25, 2024
002f8d9
Fix another merge confliction
acovrig Mar 25, 2024
29a76d9
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 25, 2024
dd0b882
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 25, 2024
83148b1
Merge branch 'master' into API-33481-poa-v2-ind-signatures
acovrig Mar 25, 2024
4fd951e
Remove method again
acovrig Mar 25, 2024
06a3bbc
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 25, 2024
d2411fe
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 26, 2024
795be3c
Merge branch 'master' into API-33481-poa-v2-ind-signatures
acovrig Mar 26, 2024
5a4ec64
Merge branch 'master' into API-33481-poa-v2-ind-signatures
acovrig Mar 26, 2024
e75d48b
Remove first/last name from 2122 schema
acovrig Mar 26, 2024
793d3ff
Fix spaces
acovrig Mar 26, 2024
fe91c6e
Fix rep name on form
acovrig Mar 26, 2024
9d6d5ac
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 26, 2024
5627c82
Merge branch 'master' into API-33483-poa-v2-signatures
acovrig Mar 26, 2024
b598216
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 26, 2024
ffceb66
Fix spec
acovrig Mar 26, 2024
c739b49
Ran rswag
acovrig Mar 26, 2024
25df005
Merge branch 'API-33483-poa-v2-signatures' into API-33481-poa-v2-ind-…
acovrig Mar 26, 2024
718f1c4
Remove first name from schema
acovrig Mar 28, 2024
e26885a
Merge branch 'master' into API-33481-poa-v2-ind-signatures
acovrig Mar 28, 2024
aed7af1
Remove unused methods
acovrig Mar 29, 2024
ac6207e
Merge branch 'master' into API-33481-poa-v2-ind-signatures
acovrig Mar 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def shared_form_validation(form_number)
end

def validate_registration_number!(form_number)
return if form_number != '2122' # Placeholder until API-33481

base = form_number == '2122' ? 'serviceOrganization' : 'representative'
rn = form_attributes.dig(base, 'registrationNumber')
poa_code = form_attributes.dig(base, 'poaCode')
Expand All @@ -70,7 +68,8 @@ def validate_registration_number!(form_number)
rn).order(created_at: :desc).first
if rep.nil?
raise ::Common::Exceptions::ResourceNotFound.new(
detail: "Could not retrieve Power of Attorney with registration number: #{rn} and poa code: #{poa_code}"
detail: "Could not find an Accredited Representative with registration number: #{rn} " \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like this language update

"and poa code: #{poa_code}"
)
end
rep.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def data(power_of_attorney, form_number, rep)
})

signatures = if form_number == '2122A'
individual_signatures(power_of_attorney)
individual_signatures(power_of_attorney, rep)
else
organization_signatures(power_of_attorney, rep)
end

res.deep_merge!({ 'serviceOrganization' => {
res.deep_merge!({ (form_number == '2122A' ? 'representative' : 'serviceOrganization') => {
'firstName' => rep.first_name,
'lastName' => rep.last_name
} })
Expand All @@ -88,12 +88,21 @@ def organization_signatures(power_of_attorney, rep)
}
end

def individual_signatures(power_of_attorney)
first_name = power_of_attorney.form_data['representative']['firstName']
last_name = power_of_attorney.form_data['representative']['lastName']
def individual_signatures(power_of_attorney, rep)
{
'page1' => individual_page1_signatures(power_of_attorney, first_name, last_name),
'page2' => individual_page2_signatures(power_of_attorney, first_name, last_name)
acovrig marked this conversation as resolved.
Show resolved Hide resolved
'page2' => [
{
'signature' => "#{power_of_attorney.auth_headers['va_eauth_firstName']} " \
"#{power_of_attorney.auth_headers['va_eauth_lastName']} - signed via api.va.gov",
'x' => 35,
'y' => 306
},
{
'signature' => "#{rep.first_name} #{rep.last_name} - signed via api.va.gov",
'x' => 35,
'y' => 200
}
]
}
end

Expand Down
60 changes: 31 additions & 29 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8751,6 +8751,14 @@
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property /representative did not contain the required key registrationNumber",
"status": "422",
"source": {
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property / did not contain the required key veteran",
Expand Down Expand Up @@ -8815,7 +8823,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not find an Accredited Representative with code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/individual_controller.rb:35:in `validate_individual_poa_code!'"
}
Expand Down Expand Up @@ -9123,8 +9131,7 @@
"additionalProperties": false,
"required": [
"poaCode",
"firstName",
"lastName",
"registrationNumber",
"type"
],
"properties": {
Expand All @@ -9133,15 +9140,10 @@
"type": "string",
"example": "A1Q"
},
"firstName": {
"description": "First Name of the representative.",
"type": "string",
"example": "John"
},
"lastName": {
"description": "Last Name of the representative",
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
"example": "Doe"
"example": "12345"
},
"type": {
"description": "Type of individual representative",
Expand Down Expand Up @@ -9254,8 +9256,7 @@
},
"representative": {
"poaCode": "083",
"firstName": "my",
"lastName": "name",
"registrationNumber": "67890",
"type": "ATTORNEY",
"address": {
"addressLine1": "123",
Expand Down Expand Up @@ -9531,7 +9532,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not retrieve Power of Attorney with registration number: 67890 and poa code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/organization_controller.rb:35:in `validate_org_poa_code!'"
}
Expand Down Expand Up @@ -10078,6 +10079,14 @@
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property /representative did not contain the required key registrationNumber",
"status": "422",
"source": {
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property / did not contain the required key veteran",
Expand Down Expand Up @@ -10142,7 +10151,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not find an Accredited Representative with code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/individual_controller.rb:35:in `validate_individual_poa_code!'"
}
Expand Down Expand Up @@ -10450,8 +10459,7 @@
"additionalProperties": false,
"required": [
"poaCode",
"firstName",
"lastName",
"registrationNumber",
"type"
],
"properties": {
Expand All @@ -10460,15 +10468,10 @@
"type": "string",
"example": "A1Q"
},
"firstName": {
"description": "First Name of the representative.",
"type": "string",
"example": "John"
},
"lastName": {
"description": "Last Name of the representative",
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
"example": "Doe"
"example": "12345"
},
"type": {
"description": "Type of individual representative",
Expand Down Expand Up @@ -10581,8 +10584,7 @@
},
"representative": {
"poaCode": "083",
"firstName": "my",
"lastName": "name",
"registrationNumber": "67890",
"type": "ATTORNEY",
"address": {
"addressLine1": "123",
Expand Down Expand Up @@ -10849,7 +10851,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not retrieve Power of Attorney with registration number: 67890 and poa code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/organization_controller.rb:35:in `validate_org_poa_code!'"
}
Expand Down Expand Up @@ -11527,4 +11529,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8751,6 +8751,14 @@
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property /representative did not contain the required key registrationNumber",
"status": "422",
"source": {
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property / did not contain the required key veteran",
Expand Down Expand Up @@ -8815,7 +8823,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not find an Accredited Representative with code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/individual_controller.rb:35:in `validate_individual_poa_code!'"
}
Expand Down Expand Up @@ -9123,8 +9131,7 @@
"additionalProperties": false,
"required": [
"poaCode",
"firstName",
"lastName",
"registrationNumber",
"type"
],
"properties": {
Expand All @@ -9133,15 +9140,10 @@
"type": "string",
"example": "A1Q"
},
"firstName": {
"description": "First Name of the representative.",
"type": "string",
"example": "John"
},
"lastName": {
"description": "Last Name of the representative",
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
"example": "Doe"
"example": "12345"
},
"type": {
"description": "Type of individual representative",
Expand Down Expand Up @@ -9254,8 +9256,7 @@
},
"representative": {
"poaCode": "083",
"firstName": "my",
"lastName": "name",
"registrationNumber": "67890",
"type": "ATTORNEY",
"address": {
"addressLine1": "123",
Expand Down Expand Up @@ -9531,7 +9532,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not retrieve Power of Attorney with registration number: 67890 and poa code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/organization_controller.rb:35:in `validate_org_poa_code!'"
}
Expand Down Expand Up @@ -10078,6 +10079,14 @@
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property /representative did not contain the required key registrationNumber",
"status": "422",
"source": {
"pointer": "data/attributes/representative"
}
},
{
"title": "Unprocessable entity",
"detail": "The property / did not contain the required key veteran",
Expand Down Expand Up @@ -10142,7 +10151,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not find an Accredited Representative with code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/individual_controller.rb:35:in `validate_individual_poa_code!'"
}
Expand Down Expand Up @@ -10450,8 +10459,7 @@
"additionalProperties": false,
"required": [
"poaCode",
"firstName",
"lastName",
"registrationNumber",
"type"
],
"properties": {
Expand All @@ -10460,15 +10468,10 @@
"type": "string",
"example": "A1Q"
},
"firstName": {
"description": "First Name of the representative.",
"type": "string",
"example": "John"
},
"lastName": {
"description": "Last Name of the representative",
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
"example": "Doe"
"example": "12345"
},
"type": {
"description": "Type of individual representative",
Expand Down Expand Up @@ -10581,8 +10584,7 @@
},
"representative": {
"poaCode": "083",
"firstName": "my",
"lastName": "name",
"registrationNumber": "67890",
"type": "ATTORNEY",
"address": {
"addressLine1": "123",
Expand Down Expand Up @@ -10849,7 +10851,7 @@
{
"title": "Resource not found",
"status": "404",
"detail": "Could not retrieve Power of Attorney with registration number: 67890 and poa code: 083",
"detail": "Could not find an Accredited Representative with registration number: 67890 and poa code: 083",
"source": {
"pointer": "/modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/organization_controller.rb:35:in `validate_org_poa_code!'"
}
Expand Down Expand Up @@ -11527,4 +11529,4 @@
}
}
]
}
}
14 changes: 4 additions & 10 deletions modules/claims_api/config/schemas/v2/2122a.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@
"additionalProperties": false,
"required": [
"poaCode",
"firstName",
"lastName",
"registrationNumber",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably remove first and last name from here. That would require adding them back into the form data like what you did for 2122.

"type"
],
"properties": {
Expand All @@ -231,15 +230,10 @@
"type": "string",
"example": "A1Q"
},
"firstName": {
"description": "First Name of the representative.",
"registrationNumber": {
"description": "Registration Number of representative.",
"type": "string",
"example": "John"
},
"lastName": {
"description": "Last Name of the representative",
"type": "string",
"example": "Doe"
"example": "12345"
},
"type": {
"description": "Type of individual representative",
Expand Down
Loading
Loading