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-40053-store-id-from-vnp-requests #20103

Merged
merged 6 commits into from
Jan 8, 2025

Conversation

rockwellwindsor-va
Copy link
Contributor

@rockwellwindsor-va rockwellwindsor-va commented Jan 6, 2025

Summary

  • Gets the responses from the related calls in order to acquire the IDs returned
  • Adds those IDs into the metadata if they are present and saves them on the PowerOfAttorneyRequest record when saved
  • Adds a few tests for this scenario as well as updating some related tests this addition broke

Related issue(s)

API-43737

Testing done

  • New code is covered by unit tests

Testing Notes

  • Easiest way to manually test this is hit services/claims/v2/veterans/1012829932V238054/power-of-attorney-request (or whatever ICN) and then look the record up in your DB. You should see metadata have some ID values inside the saved record (this is of course dependent on those IDs being present, I always saw them but not sure if any test users would no)
    • rec = ClaimsApi::PowerOfAttorneyRequest.find(YOUR_RECORD_ID)
rec.metadata
=> {"veteran"=>{"vnp_mail_id"=>"148859", "vnp_email_id"=>"148858", "vnp_phone_id"=>"106156"}}

Screenshots

Note: Optional

What areas of the site does it impact?

modified:   modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/request_controller.rb
modified:   modules/claims_api/app/services/claims_api/power_of_attorney_request_service/create_request.rb
modified:   modules/claims_api/spec/services/power_of_attorney_request_service/create_request_spec.rb
modified:   modules/claims_api/spec/services/power_of_attorney_request_service/orchestrator_spec.rb

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

* Gets the responses from the related calls in order to aquire the IDs returned
* Adds those IDs into the metadata if they are present and saves them on the PowerOfAttorneyRequest record when saved
	modified:   modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/request_controller.rb
	modified:   modules/claims_api/app/services/claims_api/power_of_attorney_request_service/create_request.rb
	modified:   modules/claims_api/spec/services/power_of_attorney_request_service/create_request_spec.rb
	modified:   modules/claims_api/spec/services/power_of_attorney_request_service/orchestrator_spec.rb
@rockwellwindsor-va rockwellwindsor-va added the claimsApi modules/claims_api label Jan 6, 2025
@va-vfs-bot va-vfs-bot temporarily deployed to API-40053-store-id-from-vnp-requests/main/main January 6, 2025 18:15 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to API-40053-store-id-from-vnp-requests/main/main January 6, 2025 19:09 Inactive
Copy link

github-actions bot commented Jan 6, 2025

1 Warning
⚠️ This PR changes 241 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • modules/claims_api/app/controllers/claims_api/v2/veterans/power_of_attorney/request_controller.rb (+2/-1)

  • modules/claims_api/app/services/claims_api/power_of_attorney_request_service/create_request.rb (+29/-10)

  • modules/claims_api/spec/services/power_of_attorney_request_service/create_request_spec.rb (+180/-5)

  • modules/claims_api/spec/services/power_of_attorney_request_service/orchestrator_spec.rb (+13/-1)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, *.md, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/, *.bru, *.pdf
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger

@rockwellwindsor-va rockwellwindsor-va marked this pull request as ready for review January 6, 2025 22:11
@rockwellwindsor-va rockwellwindsor-va requested a review from a team as a code owner January 6, 2025 22:11
@rockwellwindsor-va rockwellwindsor-va marked this pull request as draft January 6, 2025 22:15
@rockwellwindsor-va rockwellwindsor-va marked this pull request as ready for review January 6, 2025 22:18
@va-vfs-bot va-vfs-bot temporarily deployed to API-40053-store-id-from-vnp-requests/main/main January 6, 2025 22:25 Inactive
tycol7
tycol7 previously approved these changes Jan 7, 2025
Copy link
Contributor

@tycol7 tycol7 left a comment

Choose a reason for hiding this comment

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

The code looks good to me, but I was unable to test due to the BGS errors discussed elsewhere.

@@ -97,7 +97,8 @@ def create # rubocop:disable Metrics/MethodLength
claimant_icn = form_attributes.dig('claimant', 'claimantId')
poa_request = ClaimsApi::PowerOfAttorneyRequest.create!(proc_id: res['procId'],
veteran_icn: params[:veteranId],
claimant_icn:, poa_code:)
claimant_icn:, poa_code:,
metadata: res['meta'] || nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: || nil is redundant here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -72,22 +72,25 @@ def create_vonapp_data(person, vnp_ptcpnt_id, trace_digest) # rubocop:disable Me

promises << Concurrent::Promise.execute do
Datadog::Tracing.continue_trace!(trace_digest) do
create_vnp_mailing_address(person[:address], vnp_ptcpnt_id)
res = create_vnp_mailing_address(person[:address], vnp_ptcpnt_id)
@vnp_res_object['meta'][type.to_s]['vnp_mail_id'] = res[:vnp_ptcpnt_addrs_id] if res
Copy link
Contributor

Choose a reason for hiding this comment

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

Why type.to_s here and below but not on line 65? Arenʼt we only passing strings 'veteran' or 'claimant' as the type?

Copy link
Contributor Author

@rockwellwindsor-va rockwellwindsor-va Jan 7, 2025

Choose a reason for hiding this comment

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

This is a Rubocop change, I just had the variable in there

def add_meta_ids(vet_obj)
return vet_obj if @vnp_res_object['meta'].empty?

vet_obj['meta'] ||= {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this line if we have the guard above?

@@ -320,6 +328,22 @@ def limitation?(condition)
def format_phone(phone)
"#{phone[:areaCode]}#{phone[:phoneNumber]}"
end

def add_meta_ids(vet_obj)
return vet_obj if @vnp_res_object['meta'].empty?
Copy link
Contributor

Choose a reason for hiding this comment

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

Would .blank? be safer here in case @vnp_res_object['meta'] is nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

totally, good catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@va-vfs-bot va-vfs-bot temporarily deployed to API-40053-store-id-from-vnp-requests/main/main January 8, 2025 19:30 Inactive
@rockwellwindsor-va rockwellwindsor-va merged commit 50b23de into master Jan 8, 2025
32 checks passed
@rockwellwindsor-va rockwellwindsor-va deleted the API-40053-store-id-from-vnp-requests branch January 8, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
claimsApi modules/claims_api test-passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants