LG-7925 Backend pings USPS API for IPP locations#7386
Conversation
| get '/in_person' => 'in_person#index' | ||
| get '/in_person/ready_to_verify' => 'in_person/ready_to_verify#show', | ||
| as: :in_person_ready_to_verify | ||
| get '/in_person/usps_locations' => 'in_person/usps_locations#index' |
There was a problem hiding this comment.
Now that this switch from post to get has been deployed, it should be safe to remove this
| if IdentityConfig.store.arcgis_search_enabled | ||
| usps_response = Proofer.new.request_facilities(candidate) | ||
| else | ||
| usps_response = Proofer.new.request_pilot_facilities | ||
| end |
There was a problem hiding this comment.
Great.
Since I'm also hiding the frontend behavior behind feature flag, it should be aligned.
There was a problem hiding this comment.
As far as I understand, there's no additional work needed to make request_facilities ready to go...
There was a problem hiding this comment.
That’s my understanding, too. FYSA, when I logged into dev, I was able to successfully use the request_facilities(location) method.
| allow(proofer).to receive(:request_pilot_facilities).and_return(locations) | ||
| allow(proofer).to receive(:request_facilities).with(address).and_return(locations) |
There was a problem hiding this comment.
So, is coverage of request_pilot_facilities something we really want to remove during this transitional period? It'll still be needed for production until we flip the switch on.
There was a problem hiding this comment.
Good point! I can add the test coverage for request_pilot_facilities back into this PR. 🙏🏻
| context 'with arcgis search enabled' do | ||
| context 'with successful fetch' do | ||
| before do | ||
| allow(proofer).to receive(:request_facilities).with(address).and_return(locations) |
There was a problem hiding this comment.
non-blocking observation:
one pattern I've learned about from zach is to wrap an "external" class like this in a method and stub that method instead: https://github.com/18F/identity-idp/blob/main/app/controllers/idv/in_person/address_search_controller.rb#L22-L24.
So, you could have a proofer method, and you'd simply mock that instead of needed to mock UspsInPersonProofing::Proofer directly.
There was a problem hiding this comment.
I implemented this change in the controller. I haven't changed the test setup, but can do so tomorrow. I'm logging off for the day, but I am also considering mocking the proofer. Sheldon suggested this refactor, and noted this method in the enrollment_helper.rb as potential inspiration.
def usps_proofer
if IdentityConfig.store.usps_mock_fallback
UspsInPersonProofing::Mock::Proofer.new
else
UspsInPersonProofing::Proofer.new
end
end
There was a problem hiding this comment.
zach also likes mocking the proofer, esp useful for lower envs
that said, I'm wondering if it would be ok to use "real" arcgis in a lower env, like we use real SMS and real voice so people can acually use the app
There was a problem hiding this comment.
Good question. I'll bring this up during the next PO search check-in meeting.
There was a problem hiding this comment.
i think it's probably fine. i suspect voice and SMS billing is done on a credit system? we're using GSA's hosted service, and it isn't constrained in that way. open to other angles, though!
There was a problem hiding this comment.
Another thought: if the idea is to have addresses that are close to PO locations... and in mock world the PO locations are fake, maybe it does make sense to have a fake here? So that it can return things that the mock USPS service recognizes? I could go either way on this
There was a problem hiding this comment.
I misunderstood! I think that makes sense, for the local environment.
allthesignals
left a comment
There was a problem hiding this comment.
Approving now with understanding that we should stub the new proofer method in tests rather than stubbing Proofer class directly
🎫 Ticket
LG-7925: Results - controller search USPS endpoint
🛠 Summary of changes
GetIppFacilityListroute, via theUspsInPersonProofing'srequest_facilitiesmethodarcgis_search_enabledfeature flag📜 Testing Plan