Conversation
Broken -- tries to call the real USPS which we don't have configured
…eate-usps-enrollment-in-ipp-flow
…eate-usps-enrollment-in-ipp-flow
…llments in USPS api when user completes flow
| first_name: pii.first_name, | ||
| last_name: pii.last_name, | ||
| address: pii.address1, | ||
| # do we need address2? |
There was a problem hiding this comment.
We do, I just didn't have time to add it in this PR. Will add in a follow-up
| response = proofer.request_enroll(applicant) | ||
| response['enrollmentCode'] |
There was a problem hiding this comment.
I'm planning on adding error handling in a follow-up PR
There was a problem hiding this comment.
WDYT of creating a Struct-like object to repesent the response here so we could do a direct property access response.enrollment_code rather than digging into a hash? Makes mocking responses easier as well
| # Returns the value to use for the USPS enrollment ID | ||
| def usps_unique_id | ||
| user_id.to_s | ||
| user.uuid.delete('-').slice(0, 18) |
There was a problem hiding this comment.
This is just a temporary solution. There's a separate ticket to think through the best way to generate unique IDs
| @@ -0,0 +1,182 @@ | |||
| module UspsInPersonProofing | |||
There was a problem hiding this comment.
I just moved this file and moved the class into a module. The namespace and class name have changed but otherwise this is unchanged
There was a problem hiding this comment.
Should move & rename the test file as well, from
spec/services/usps_in_person_proofer_spec.rb
to
spec/services/usps_in_person_proofing/proofer_spec.rb
| response = proofer.request_enroll(applicant) | ||
| response['enrollmentCode'] |
There was a problem hiding this comment.
WDYT of creating a Struct-like object to repesent the response here so we could do a direct property access response.enrollment_code rather than digging into a hash? Makes mocking responses easier as well
| enrollment = InPersonEnrollment.create!( | ||
| profile: profile, | ||
| user: user, | ||
| ) |
There was a problem hiding this comment.
so I had a thought I dropped in slack this morning about maybe we flip the order of these.. could be a future PR if needed!
| @@ -59,6 +60,52 @@ def in_person_enrollment?(user) | |||
| # WILLFIX: After LG-6872 and we have enrollment saved, reference enrollment instead. | |||
There was a problem hiding this comment.
Anything we need to think about here? I think the assumption at the time this was written was that we might create an enrollment earlier in the process.
There was a problem hiding this comment.
I think it's fine as-is. This method gets used twice: once before the enrollment is created and once after. The enrollment is only a useful indicator of this being an in-person flow after it is created
I'm going to leave it as-is in this file and will begin using the enrollment on the next page, in the personal key controller
| # update the enrollment to status pending | ||
| enrollment.enrollment_code = enrollment_code | ||
| enrollment.status = :pending | ||
| enrollment.save! |
There was a problem hiding this comment.
Will need error handling here too, in case there's an existing pending enrollment.
| @@ -0,0 +1,182 @@ | |||
| module UspsInPersonProofing | |||
There was a problem hiding this comment.
Should move & rename the test file as well, from
spec/services/usps_in_person_proofer_spec.rb
to
spec/services/usps_in_person_proofing/proofer_spec.rb
|
Thanks for the reviews! I'm going to merge this so we can use it in bug bash and I'll address all of the comments in a separate PR |
Begins creating USPS enrollments for user who complete the in-person proofing flow
mock_usps_fallbackfeature flag which, when active (which is the default), causes the application not to make real requests to the USPS APIUspsInPersonProofingmodule with a mock proofer. Moves the existing proofer into this module📋 Future work
There are several chunks of work that I didn't have time to complete in this first PR. I'm hoping that we can merge this PR the morning of 7/21/2022 so that we can use it to bug bash and then continue to flesh this work out in a future PR.
address2information to USPS