-
Notifications
You must be signed in to change notification settings - Fork 696
Fix analytics event status values for payment confirmation #11750
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
Conversation
Changes: - Update PaymentLauncherViewModel to send 'succeeded', 'canceled', or 'failed' status values based on InternalPaymentResult instead of intent status codes - Add tests to verify correct status values in analytics events This ensures the paymenthandler.confirm.finished analytics event includes the correct status corresponding to the result vended to the merchant, fixing the issue where no 'failed' status events were being reported. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Committed-By-Agent: claude
|
Diffuse output: APKDEX |
| val intentParams = mapOf( | ||
| "intent_id" to intent?.clientSecret?.toStripeId(), | ||
| "status" to intent?.status?.code, | ||
| "status" to resultStatus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would affect handle_next_action.finished events, right? Is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would map to what iOS is doing - https://hubble.corp.stripe.com/saved-queries/42d7a3b5-313b-4fe8-a550-121557b7c1da
@yuki-stripe Should this change affect handle_next_action.finished as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100%
These bindings have two basically APIs - confirm and handleNextAction.
Our analytics should report when the APIs are called and when they return with the result we return to the merchant (reported as "status").
| PaymentAnalyticsEvent.PaymentLauncherNextActionFinished | ||
| } | ||
|
|
||
| val resultStatus = when (stripeInternalResult) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would those requires_capture, requires_payment_method be mapped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires_capture will map to success and requires_payment_method will map to failed
| fun `verify confirm finished analytics includes succeeded status for completed result`() = runTest { | ||
| verifyConfirmFinishedAnalyticsStatus( | ||
| expectedStatus = "succeeded", | ||
| setup = { whenever(paymentIntent.requiresAction()).thenReturn(false) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if requiresAction is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal here is to test that the analytics event's status is succeeded when stripeInternalResult is succeeded. Setting requiresAction to true could yield a success, canceled or failed state based on its configuration. So setting requiresAction to false gives us a simpler test configuration for StripeInternalResult.Success
Summary
Send correct
statusforstripe_android.paymenthandler.confirm.finishedevent.The status field should only be 'succeeded', 'canceled', or 'failed'. That is not the case on android today (see query)
Motivation
android event status types
ios event statuses
https://jira.corp.stripe.com/browse/RUN_MOBILESDK-4730
Testing
Changelog