Skip to content

Conversation

@cttsai-stripe
Copy link
Contributor

Summary

Block Konbini and Blik payment methods when using confirmation tokens in test mode. These payment methods are not yet fully supported with confirmation tokens. By blocking them early in test mode, we help developers catch this issue during development rather than encountering errors in production.

Motivation

MOBILESDK-4092

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

cttsai-stripe and others added 3 commits October 16, 2025 14:52
Following TDD approach, add failing tests that verify:
- Konbini and Blik payment methods throw IllegalStateException in test mode
- Konbini and Blik payment methods succeed in live mode

These tests currently fail as the blocking logic has not been implemented yet.

Related to MOBILESDK-4092

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Committed-By-Agent: claude
…t mode

Add failIfUnsupportedPaymentMethod() function that throws IllegalStateException
for Konbini and Blik payment methods when using test mode API keys. The block
is enforced in both new and saved payment method flows.

Live mode usage is allowed to enable production functionality while preventing
test mode usage of payment methods not yet supported with confirmation tokens.

Related to MOBILESDK-4092

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Committed-By-Agent: claude
Simplify Konbini and Blik blocking tests by using the existing helper function
instead of manually creating interceptors. This reduces code duplication and
improves maintainability.

- Add isLiveMode parameter to helper that controls publishableKeyProvider
- Use helper for all four test cases (test/live mode × Konbini/Blik)
- Reduce each test by ~50% while maintaining the same test coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Committed-By-Agent: claude
@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │   2.1 MiB │   2.1 MiB │  0 B │   4.3 MiB │   4.3 MiB │  0 B 
     arsc │   1.1 MiB │   1.1 MiB │  0 B │   1.1 MiB │   1.1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │ 302.7 KiB │ 302.7 KiB │  0 B │ 456.5 KiB │ 456.5 KiB │  0 B 
   native │   7.9 MiB │   7.9 MiB │  0 B │  19.3 MiB │  19.3 MiB │  0 B 
    asset │   7.7 KiB │   7.7 KiB │  0 B │   7.4 KiB │   7.4 KiB │  0 B 
    other │  95.7 KiB │  95.7 KiB │ +2 B │ 183.5 KiB │ 183.5 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │  11.5 MiB │  11.5 MiB │ +2 B │  25.4 MiB │  25.4 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 20706 │ 20706 │ 0 (+0 -0) 
   types │  6514 │  6514 │ 0 (+0 -0) 
 classes │  5278 │  5278 │ 0 (+0 -0) 
 methods │ 31549 │ 31549 │ 0 (+0 -0) 
  fields │ 18271 │ 18271 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  163 │  163 │  0   
 entries │ 3665 │ 3665 │  0
APK
   compressed    │   uncompressed   │                        
──────────┬──────┼───────────┬──────┤                        
 size     │ diff │ size      │ diff │ path                   
──────────┼──────┼───────────┼──────┼────────────────────────
 29.2 KiB │ +2 B │  64.6 KiB │  0 B │ ∆ META-INF/CERT.SF     
  1.2 KiB │ -1 B │   1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA    
 25.9 KiB │ +1 B │  64.5 KiB │  0 B │ ∆ META-INF/MANIFEST.MF 
──────────┼──────┼───────────┼──────┼────────────────────────
 56.2 KiB │ +2 B │ 130.4 KiB │  0 B │ (total)

@cttsai-stripe cttsai-stripe marked this pull request as ready for review October 16, 2025 22:22
@cttsai-stripe cttsai-stripe requested review from a team as code owners October 16, 2025 22:22
private fun failIfUnsupportedPaymentMethod(paymentMethodCode: String?) {
val unsupportedPaymentMethods = setOf("konbini", "blik")

if (paymentMethodCode in unsupportedPaymentMethods && !requestOptions.apiKeyIsLiveMode) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the behavior in live mode? ie what is the user experience if they are trying to check out with Konbini + CTs in live mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the best way to test that? If I simply remove the assertion and try in playground, it would look like this:

Screen_recording_20251016_221319.mp4

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow up on this on slack

amk-stripe
amk-stripe previously approved these changes Oct 17, 2025
private fun failIfUnsupportedPaymentMethod(paymentMethodCode: String?) {
val unsupportedPaymentMethods = setOf("konbini", "blik")

if (paymentMethodCode in unsupportedPaymentMethods && !requestOptions.apiKeyIsLiveMode) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow up on this on slack

# Conflicts:
#	paymentsheet/src/test/java/com/stripe/android/paymentelement/confirmation/interceptor/ConfirmationTokenConfirmationInterceptorTest.kt
@cttsai-stripe cttsai-stripe enabled auto-merge (squash) October 17, 2025 18:07
@cttsai-stripe cttsai-stripe merged commit 3a3e2e1 into master Oct 17, 2025
19 checks passed
@cttsai-stripe cttsai-stripe deleted the cttsai/ct-block-konbini-and-blik branch October 17, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants