Skip to content

Commit e00bb00

Browse files
cttsai-stripeclaude
andcommitted
Thread payment method type through polling args and use in analytics
Replaces time_limit_seconds with payment_method_type for easier slicing in incident investigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Committed-By-Agent: claude
1 parent 3a9f4de commit e00bb00

6 files changed

Lines changed: 17 additions & 8 deletions

File tree

paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ internal class PollingActivity : AppCompatActivity() {
3535
ctaText = args.ctaText,
3636
stripeAccountId = args.stripeAccountId,
3737
qrCodeUrl = args.qrCodeUrl,
38+
paymentMethodType = args.paymentMethodType,
3839
)
3940
}
4041

paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingContract.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal class PollingContract :
3333
@StringRes val ctaText: Int,
3434
val stripeAccountId: String?,
3535
val qrCodeUrl: String?,
36+
val paymentMethodType: String,
3637
) : Parcelable {
3738

3839
internal companion object {

paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingNextActionHandler.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ internal class PollingNextActionHandler : PaymentNextActionHandler<StripeIntent>
6161
ctaText = R.string.stripe_blik_confirm_payment,
6262
stripeAccountId = requestOptions.stripeAccount,
6363
qrCodeUrl = null,
64+
paymentMethodType = PaymentMethod.Type.Blik.code,
6465
)
6566
PaymentMethod.Type.PayNow ->
6667
PollingContract.Args(
@@ -71,6 +72,7 @@ internal class PollingNextActionHandler : PaymentNextActionHandler<StripeIntent>
7172
ctaText = R.string.stripe_qrcode_lpm_confirm_payment,
7273
stripeAccountId = requestOptions.stripeAccount,
7374
qrCodeUrl = getQrCodeForPayNow(actionable),
75+
paymentMethodType = PaymentMethod.Type.PayNow.code,
7476
)
7577
PaymentMethod.Type.PromptPay ->
7678
PollingContract.Args(
@@ -81,6 +83,7 @@ internal class PollingNextActionHandler : PaymentNextActionHandler<StripeIntent>
8183
ctaText = R.string.stripe_qrcode_lpm_confirm_payment,
8284
stripeAccountId = requestOptions.stripeAccount,
8385
qrCodeUrl = getQrCodeForPromptPay(actionable),
86+
paymentMethodType = PaymentMethod.Type.PromptPay.code,
8487
)
8588
else ->
8689
error(

paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ internal class PollingViewModel @Inject constructor(
136136
errorReporter.report(
137137
errorEvent = ErrorReporter.ExpectedErrorEvent.POLLING_TIMEOUT_CANCELLATION,
138138
additionalNonPiiParams = mapOf(
139-
"time_limit_seconds" to args.timeLimit.inWholeSeconds.toString(),
139+
"payment_method_type" to args.paymentMethodType,
140140
"last_known_status" to (intentStatus?.name ?: "unknown"),
141141
),
142142
)
@@ -256,6 +256,7 @@ internal class PollingViewModel @Inject constructor(
256256
@StringRes val ctaText: Int,
257257
val stripeAccountId: String?,
258258
val qrCodeUrl: String?,
259+
val paymentMethodType: String,
259260
)
260261
}
261262

paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivityTest.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,13 @@ internal class PollingActivityTest {
250250

251251
val viewModel = createViewModel(
252252
args = PollingViewModel.Args(
253-
args.clientSecret,
254-
args.timeLimitInSeconds.seconds,
255-
args.initialDelayInSeconds.seconds,
256-
args.ctaText,
257-
args.stripeAccountId,
258-
args.qrCodeUrl,
253+
clientSecret = args.clientSecret,
254+
timeLimit = args.timeLimitInSeconds.seconds,
255+
initialDelay = args.initialDelayInSeconds.seconds,
256+
ctaText = args.ctaText,
257+
stripeAccountId = args.stripeAccountId,
258+
qrCodeUrl = args.qrCodeUrl,
259+
paymentMethodType = args.paymentMethodType,
259260
),
260261
poller = poller,
261262
timeProvider = timeProvider,
@@ -315,6 +316,7 @@ internal class PollingActivityTest {
315316
ctaText = R.string.stripe_blik_confirm_payment,
316317
stripeAccountId = null,
317318
qrCodeUrl = null,
319+
paymentMethodType = "blik",
318320
)
319321
}
320322
}

paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingViewModelTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class PollingViewModelTest {
224224
val call = errorReporter.awaitCall()
225225
assertThat(call.errorEvent)
226226
.isEqualTo(ErrorReporter.ExpectedErrorEvent.POLLING_TIMEOUT_CANCELLATION)
227-
assertThat(call.additionalNonPiiParams["time_limit_seconds"]).isEqualTo("10")
227+
assertThat(call.additionalNonPiiParams["payment_method_type"]).isEqualTo("blik")
228228
assertThat(call.additionalNonPiiParams["last_known_status"]).isEqualTo("RequiresAction")
229229
}
230230

@@ -350,6 +350,7 @@ private fun createPollingViewModel(
350350
ctaText = R.string.stripe_blik_confirm_payment,
351351
stripeAccountId = null,
352352
qrCodeUrl = qrCodeUrl,
353+
paymentMethodType = "blik",
353354
),
354355
poller = poller,
355356
timeProvider = timeProvider,

0 commit comments

Comments
 (0)