Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-14905: socure webhook analytics event updates #11490

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/controllers/socure_webhook_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ def log_webhook_receipt
analytics.idv_doc_auth_socure_webhook_received(
created_at: event[:created],
customer_user_id: event[:customerUserId],
docv_transaction_token: event[:docvTransactionToken],
event_type: event[:eventType],
reference_id: event[:referenceId],
user_id: event[:customerUserId],
user_id: user&.uuid,
)
end

Expand All @@ -94,9 +95,8 @@ def increment_rate_limiter
end

def document_capture_session
token = event[:docvTransactionToken] || event[:docVTransactionToken]
@document_capture_session ||= DocumentCaptureSession.find_by(
socure_docv_transaction_token: token,
socure_docv_transaction_token: docv_transaction_token,
)
end

Expand All @@ -117,4 +117,12 @@ def socure_params
:docvTransactionToken, :docVTransactionToken],
)
end

def user
@user ||= document_capture_session&.user
end

def docv_transaction_token
@docv_transaction_token ||= event[:docvTransactionToken] || event[:docVTransactionToken]
end
end
5 changes: 4 additions & 1 deletion app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1566,13 +1566,15 @@ def idv_doc_auth_redo_ssn_submitted(

# @param [String] created_at The created timestamp received from Socure
# @param [String] customer_user_id The customerUserId received from Socure
# @param [String] docv_transaction_token The docvTransactionToken received from Socure
# @param [String] event_type The eventType received from Socure
# @param [String] reference_id The referenceId received from Socure
# @param [String] user_id The customerUserId, repackaged as user_id
# @param [String] user_id The uuid of the user using Socure
def idv_doc_auth_socure_webhook_received(
created_at:,
customer_user_id:,
event_type:,
docv_transaction_token:,
reference_id:,
user_id:,
**extra
Expand All @@ -1581,6 +1583,7 @@ def idv_doc_auth_socure_webhook_received(
:idv_doc_auth_socure_webhook_received,
created_at:,
customer_user_id:,
docv_transaction_token:,
event_type:,
reference_id:,
user_id:,
Expand Down
Loading