changelog: Bug Fixes, Document Authentication, Fix exception when DoS…#12299
changelog: Bug Fixes, Document Authentication, Fix exception when DoS…#12299
Conversation
solipet
left a comment
There was a problem hiding this comment.
A couple of non-blocking suggestions on the specs, but LGTM!
There was a problem hiding this comment.
This spec seems redundant with the spec above. Maybe have 'Authentication denied.' be the error for the simple string case?
There was a problem hiding this comment.
Good catch! I'll merge this into one test case.
There was a problem hiding this comment.
Again since we're not actually looking at the string returned, I think it's fair to have just one spec, maybe 'when the request fails with a simple string error'
There was a problem hiding this comment.
I would update these tests to be a similar structure as the tests you added to spec/services/doc_auth/dos/request_spec.rb
context 'when the request fails' do
context 'when the response error is a hash' do
end
context 'when the response error is a string' do
end
context 'when the response error is empty' do
end
endThere was a problem hiding this comment.
Makes sense, I'll update these tests to match that structure. Thanks!
37eb3d7 to
3bba89b
Compare
🎫 Ticket
Link to the relevant ticket:
LG-16143
🛠 Summary of changes
Fixed an issue where the DoS MRZ API client was throwing exceptions when receiving error responses in a simple string format. The client was originally built expecting errors to be nested objects like
{"error": {"code": "...", "message": "..."}}, but we discovered the API sometimes returns errors as simple strings like{"error": "Invalid Client"}or{"error": "Authentication denied."}.Updated the error handling to support both formats, preventing crashes and ensuring error messages are properly logged for debugging
📜 Testing Plan
spec/services/doc_auth/dos/request_spec.rbbundle exec rspec spec/services/doc_auth/dos/request_spec.rbspec/services/doc_auth/dos/requests/mrz_request_spec.rbbundle exec rspec spec/services/doc_auth/dos/requests/mrz_request_spec.rb