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-34448] VA Notify - Send declined notification #19362

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

tycol7
Copy link
Contributor

@tycol7 tycol7 commented Nov 8, 2024

⚠️ Please do not merge until after https://github.com/department-of-veterans-affairs/vsp-infra-application-manifests/pull/3262 and https://github.com/department-of-veterans-affairs/vsp-infra-application-manifests/pull/3263.

Summary

Send an email to the participant when their POA request is declined.

  • add participantId and representativeId to the /decide request
  • rename VANotifyJob to VANotifyAcceptedJob
  • create VANotifyDeclinedJob
  • add read_poa_request_by_ptcpnt_id to local BGS ManageRepresentativeService
sequenceDiagram
    Client->>RequestController: POST /decide { procId:, participantId:, decision: 'DECLINED', representativeId: }
    RequestController->>BGSʼ ManageRepresentativeService: read_poa_request_by_ptcpnt_id(ptcpnt_id: participantId)
    BGSʼ ManageRepresentativeService->>RequestController: poa_requests
    RequestController-->RequestController: get first name from matching poa_request (by procId)
    RequestController->>BGSʼ ManageRepresentativeService: update_poa_request(procId:, secondary_status: 'DECLINED')
    BGSʼ ManageRepresentativeService-->BGSʼ ManageRepresentativeService: decline the request
    BGSʼ ManageRepresentativeService->>RequestController: Result ({ procId:, secondaryStatus: 'DEC', … })
    RequestController->>VaNotifyDeclinedJob: perform_async(encrypted_ptcpnt_id:, encrypted_first_name:, representative_id: representativeId)
    RequestController->>Client: 200 OK Result ({ procId:, secondaryStatus: 'DEC', … })
    VaNotifyDeclinedJob->>Database: find Representative by representative_id
    Database->>VaNotifyDeclinedJob: Representative record (user_type determines which email to send)
    VaNotifyDeclinedJob-->VaNotifyDeclinedJob: Generate email content
    VaNotifyDeclinedJob->>VaNotify Service: send_email(content)
Loading

Related issue(s)

API-34448

Testing done

  • New code is covered by unit tests
  • Manually sent emails to self to verify the Organization and Representative flows.

Screenshots

Organization (21-22)
organization-2122

Representative/Individual (21-22a)
representative-2122a

What areas of the site does it impact?

  • Manage Representative Service
  • /power-of-attorney-requests/decide endpoint (requests controller)
  • New sidekiq job and updated settings files

Acceptance criteria

  • I 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

Any better way to find a PowerOfAttorney record by POA code other than a full table scan? Using representative and representative id instead

@tycol7 tycol7 added the claimsApi modules/claims_api label Nov 8, 2024
@va-vfs-bot va-vfs-bot temporarily deployed to tdc/va-notify-poa-declined/main/main November 8, 2024 22:32 Inactive
@tycol7 tycol7 changed the title [API-34448] rename VANotifyJob → VANotifyAcceptedJob [API-34448] VA Notify - Send declined notification Nov 8, 2024
@va-vfs-bot va-vfs-bot temporarily deployed to tdc/va-notify-poa-declined/main/main November 8, 2024 22:57 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to tdc/va-notify-poa-declined/main/main November 9, 2024 00:38 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to tdc/va-notify-poa-declined/main/main November 12, 2024 23:39 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to tdc/va-notify-poa-declined/main/main November 13, 2024 04:34 Inactive
Copy link

github-actions bot commented Nov 13, 2024

1 Warning
⚠️ This PR changes 272 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

  • config/settings.yml (+4/-2)

  • config/settings/test.yml (+4/-2)

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

  • modules/claims_api/app/sidekiq/claims_api/poa_updater.rb (+1/-1)

  • modules/claims_api/app/sidekiq/claims_api/{va_notify_job.rb => va_notify_accepted_job.rb} (+5/-5)

  • modules/claims_api/app/sidekiq/claims_api/va_notify_declined_job.rb (+71/-0)

  • modules/claims_api/lib/bgs_service/manage_representative_service.rb (+8/-0)

  • modules/claims_api/spec/controllers/v2/veterans/power_of_attorney/request_controller_spec.rb (+33/-2)

  • modules/claims_api/spec/sidekiq/poa_updater_spec.rb (+4/-4)

  • modules/claims_api/spec/sidekiq/{va_notify_job_spec.rb => va_notify_accepted_job_spec.rb} (+4/-4)

  • modules/claims_api/spec/sidekiq/va_notify_declined_job_spec.rb (+56/-0)

  • modules/veteran/app/models/veteran/service/representative.rb (+3/-0)

    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

Copy link
Contributor

@rockwellwindsor-va rockwellwindsor-va left a comment

Choose a reason for hiding this comment

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

LGTM! , email sent out as expected.

Screenshot 2024-11-15 at 3 34 47 PM

@tycol7
Copy link
Contributor Author

tycol7 commented Nov 15, 2024

Hm, I wonder if we fall back to “representative” here:

representative_type: representative_type_text || '',
representative_type_abbreviated: representative_type_text || '',

So we donʼt get a dangling adjective “accredited” when the rep type canʼt be found.

accredited

Copy link
Contributor

@rockwellwindsor-va rockwellwindsor-va left a comment

Choose a reason for hiding this comment

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

Yep agreed, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants