Skip to content

LG-13577 Save Sponsor ID on new Enrollments#10859

Merged
gina-yamada merged 9 commits intomainfrom
yamada/LG-13577-Save-Sponsor-Id-On-New-Enrollments
Jul 1, 2024
Merged

LG-13577 Save Sponsor ID on new Enrollments#10859
gina-yamada merged 9 commits intomainfrom
yamada/LG-13577-Save-Sponsor-Id-On-New-Enrollments

Conversation

@gina-yamada
Copy link
Contributor

@gina-yamada gina-yamada commented Jun 24, 2024

🎫 Ticket

LG-13577 Save Sponsor ID on new enrollments

🛠 Summary of changes

  • Save usps_ipp_sponsor_id to sponsor_id on in_person_enrollments for In Person Proofing Enrollments
  • Save usps_eipp_sponsor_id to sponsor_id on in_person_enrollments for Enhanced In Person Proofing Enrollments
  • Added/updated specs to show both values get set depending on value of is_enhanced_ipp

📜 Testing Plan

Get set up

  • Step 1 In identity-oidc-sinatra, set eipp_allowed to true in .env. Start server.
  • Step 2 In identity-idp, set usps_ipp_sponsor_id to '123' and usps_eipp_sponsor_id to '987' in config/application.yml. Start server.

1. Confirm that sponsor_id on in_person_enrollments is getting set to usps_ipp_sponsor_id for In Person Enrollments:

  • Step 3 Go to http://localhost:9292/ and pick Biometric Comparison
  • Step 4 Set up account, and run through In Person Proofing to create an Enrollment.
  • Step 5 Once on the Ready to Verify view (verify/in_person/ready_to_verify), open a new terminal for identity-idp and open the rails console with rails c
  • Step 6 Type e1 = InPersonEnrollment.last and hit enter to get your enrollment.
  • Step 7 Then type e1.sponsor_id to get the sponsor id saved to that enrollment. Confirm it is the value you saved in step 2 for usps_ipp_sponsor_id (ie: 123)
  • Step 8 You can cancel the barcode and sign out.

2. Confirm that sponsor_id on in_person_enrollments is getting set to usps_eipp_sponsor_id for Enhanced In Person Enrollments:

  • Step 9 Go to http://localhost:9292/ and pick Enhanced In-person Proofing
  • Step 10 Either set up new account or sign back into the account you canceled the barcode for. Run through In Person Proofing to create an Enrollment
  • Step 11 Once on the Ready to Verify view (verify/in_person/ready_to_verify), open a new terminal for identity-idp and open the rails console with rails c
  • Step 12 Type e2 = InPersonEnrollment.last and hit enter to get your enrollment.
  • Step 13 Then type e2.sponsor_id to get the sponsor id saved to that enrollment. Confirm it is the value you saved in step 2 for usps_eipp_sponsor_id (ie: 987)
  • Step 14 You can cancel the barcode and sign out.

@gina-yamada gina-yamada requested a review from eileen-nava June 24, 2024 21:12
…lments (Internal) and on EIPP Enhanced Enrollments (Upcoming Features)
it 'sets enrollment status to pending and sets established at date and unique id' do
it <<~STR.squish do
sets enrollment status to pending, sponsor_id to usps_ipp_sponsor_id,
and sets established at date and unique id
Copy link
Contributor

Choose a reason for hiding this comment

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

What if to clean this up instead of having a multi-line description you break it out into multiple it blocks by wrapping this into a context. Maybe something like this?

      context 'when the in person enrollment is not enhanced ipp' do
        before do
          subject.schedule_in_person_enrollment(user:, pii:, is_enhanced_ipp:)
        end

        it 'sets enrollment status to pending' do
          expect(user.in_person_enrollments.first.status).to eq(InPersonEnrollment::STATUS_PENDING)
        end

        it 'sets sponsor_id to usps_ipp_sponsor_id' do
          expect(user.in_person_enrollments.first.sponsor_id).to eq(usps_ipp_sponsor_id)
        end

        it 'sets established at date' do
          expect(user.in_person_enrollments.first.enrollment_established_at).to_not be_nil
        end

        it 'sets unique id' do
          expect(user.in_person_enrollments.first.unique_id).to_not be_nil
        end
      end

This does however slightly increases the speed of the tests by 0.25 seconds, but I do think it helps with readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shanechesnutt-ft this is good suggestion. I think I will keep the existing pattern and thus speed over readability. If others have strong opinions in preference over readability, we can rework at a later time. I appreciate your feedback though. 🙏

Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to agree with leaning towards the single test. I think the intent of each test is reflected well enough in the expect statements.

Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

Good work. Approved.

enrollment_code = create_usps_enrollment(enrollment, pii, is_enhanced_ipp)
return unless enrollment_code

if is_enhanced_ipp
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

it 'saves sponsor_id on the enrollment to the usps_eipp_sponsor_id' do
subject.schedule_in_person_enrollment(user:, pii:, is_enhanced_ipp:)

expect(user.in_person_enrollments.first.sponsor_id).to eq(usps_eipp_sponsor_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

👏🏻

@gina-yamada gina-yamada merged commit cf7861f into main Jul 1, 2024
@gina-yamada gina-yamada deleted the yamada/LG-13577-Save-Sponsor-Id-On-New-Enrollments branch July 1, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants