CL-8938 - fix idv_document_upload_submitted event#7918
Conversation
Vendor responses were not being captured due to where we were calling the tracker.
changelog: Internal, Attempts API, Bugfix for doc auth events
| ) | ||
|
|
||
| # This is the last upload which triggers the rate limit, apparently. | ||
| # I do find this moderately confusing. |
There was a problem hiding this comment.
Someone want to check my logic here? I wasn't expecting both events initially, but that seems to be what happens with analytics events.
Want to make sure I'm enshrining a new bug in tests.
There was a problem hiding this comment.
I think there's the attempt, and then that triggers the limit? I think that's fine
| document_issued: nil, | ||
| document_number: nil, | ||
| document_state: nil, | ||
| failure_reason: { front: ['The selection was not a valid file.'] }, |
There was a problem hiding this comment.
Opinion question: I think the academically-correct thing to do here would be to re-use the front: [I18n.t('doc_auth.errors.not_a_file')] that's set up above, maybe moving it to a little let(:error_msg) assignment.
I have a slight preference for using the actual English string here, though, to better highlight the unusual (compared to other events) behavior where we are sending the actual translated string across. I think this makes it clearer.
Anyone feel strongly one way or the other?
There was a problem hiding this comment.
i think it's fine to hardcode the string like this, makes it easiest to change if something else changes
| success: response.success?, | ||
| document_state: pii_from_doc[:state], | ||
| document_number: pii_from_doc[:state_id_number], | ||
| document_issued: pii_from_doc[:state_id_issued], | ||
| document_expiration: pii_from_doc[:state_id_expiration], | ||
| document_front_image_filename: stored_image_result&.front_filename, | ||
| document_back_image_filename: stored_image_result&.back_filename, | ||
| document_image_encryption_key: stored_image_result&.encryption_key, | ||
| first_name: pii_from_doc[:first_name], | ||
| last_name: pii_from_doc[:last_name], | ||
| date_of_birth: pii_from_doc[:dob], | ||
| address: pii_from_doc[:address1], | ||
| failure_reason: response.errors&.except(:hints)&.presence, | ||
| ) |
There was a problem hiding this comment.
ditto here (also the last closing paren needs to move)
| success: response.success?, | |
| document_state: pii_from_doc[:state], | |
| document_number: pii_from_doc[:state_id_number], | |
| document_issued: pii_from_doc[:state_id_issued], | |
| document_expiration: pii_from_doc[:state_id_expiration], | |
| document_front_image_filename: stored_image_result&.front_filename, | |
| document_back_image_filename: stored_image_result&.back_filename, | |
| document_image_encryption_key: stored_image_result&.encryption_key, | |
| first_name: pii_from_doc[:first_name], | |
| last_name: pii_from_doc[:last_name], | |
| date_of_birth: pii_from_doc[:dob], | |
| address: pii_from_doc[:address1], | |
| failure_reason: response.errors&.except(:hints)&.presence, | |
| ) | |
| success: response.success?, | |
| document_state: pii_from_doc[:state], | |
| document_number: pii_from_doc[:state_id_number], | |
| document_issued: pii_from_doc[:state_id_issued], | |
| document_expiration: pii_from_doc[:state_id_expiration], | |
| document_front_image_filename: stored_image_result&.front_filename, | |
| document_back_image_filename: stored_image_result&.back_filename, | |
| document_image_encryption_key: stored_image_result&.encryption_key, | |
| first_name: pii_from_doc[:first_name], | |
| last_name: pii_from_doc[:last_name], | |
| date_of_birth: pii_from_doc[:dob], | |
| address: pii_from_doc[:address1], | |
| failure_reason: response.errors&.except(:hints)&.presence, | |
| ) |
There was a problem hiding this comment.
I'm actually not sure how this happened—I don't do that either! 😆 I think my editor tried to get fancy when I let it automatically "refactor" this block into a method (really just a cut-and-paste).
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
🎫 Ticket
Found while working on LG-8938.
🛠 Summary of changes
Currently, these events are only logging events that are the results of a form validation failures, but not to vendor errors.
There are actually multiple forms so we missed some events.