Skip to content

Conversation

@cttsai-stripe
Copy link
Contributor

@cttsai-stripe cttsai-stripe commented Oct 17, 2025

Summary

  • Adds fallback to intent setupFutureUsage when user checkbox and payment method options (PMO) SFU are not set
  • Applies fallback logic to both confirmation token params and clientContext
  • Updates tests with comprehensive coverage for the complete SFU priority chain

Motivation

#11746

Testing

Screenshots

Before After
before screenshot after screenshot

Changelog

cttsai-stripe and others added 3 commits October 17, 2025 12:00
- Add test for checkbox > intent SFU priority
- Add test for PMO SFU > intent SFU priority
- Add test for intent SFU fallback when no checkbox/PMO
- Add test for clientContext intent SFU fallback
- Update test name for clarity when no SFU is set

These tests verify the complete SFU priority chain:
User checkbox > PMO SFU > Intent SFU > null

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude
- Add runSfuPriorityTest helper to reduce boilerplate
- Use boolean userCheckbox param instead of enum (more intuitive)
- Reduce test code by ~87% (from ~240 lines to ~30 lines)
- Tests now clearly show SFU priority: Checkbox > PMO > Intent > null

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude
@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 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 │ +4 B │ 183.5 KiB │ 183.5 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │  11.5 MiB │  11.5 MiB │ +4 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                                      
──────────┼──────┼──────────┼──────┼───────────────────────────────────────────
    271 B │ +2 B │    120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
 29.2 KiB │ +2 B │ 64.6 KiB │  0 B │ ∆ META-INF/CERT.SF                        
──────────┼──────┼──────────┼──────┼───────────────────────────────────────────
 29.5 KiB │ +4 B │ 64.7 KiB │  0 B │ (total)

@cttsai-stripe cttsai-stripe marked this pull request as ready for review October 17, 2025 19:33
@cttsai-stripe cttsai-stripe requested review from a team as code owners October 17, 2025 19:33
cttsai-stripe and others added 3 commits October 17, 2025 15:06
Implementation changes:
- Extract SFU resolution logic into resolveSetupFutureUsage() helper
- Use helper in both prepareConfirmationTokenParams and prepareConfirmationTokenClientContextParams
- Ensures both code paths stay in sync with single source of truth

Test changes:
- Remove standalone clientContext SFU test (redundant)
- Update runSfuPriorityTest to validate both setUpFutureUsage AND clientContext.setupFutureUsage
- All 6 SFU priority tests now verify both fields match

Benefits:
- Single source of truth for SFU resolution logic
- Tests ensure both code paths stay synchronized
- Net -40 lines of code

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude
# Conflicts:
#	paymentsheet/src/main/java/com/stripe/android/paymentelement/confirmation/intent/ConfirmationTokenConfirmationInterceptor.kt
@cttsai-stripe cttsai-stripe merged commit d6ade31 into master Oct 20, 2025
19 checks passed
@cttsai-stripe cttsai-stripe deleted the cttsai/ct-fix-intent-sfu branch October 20, 2025 17:40
cttsai-stripe added a commit that referenced this pull request Oct 21, 2025
…11760)

* Should honor intent sfu as fallback if checkbox and pmo sfu are not set

* Add tests for intent SFU fallback in confirmation token flow

- Add test for checkbox > intent SFU priority
- Add test for PMO SFU > intent SFU priority
- Add test for intent SFU fallback when no checkbox/PMO
- Add test for clientContext intent SFU fallback
- Update test name for clarity when no SFU is set

These tests verify the complete SFU priority chain:
User checkbox > PMO SFU > Intent SFU > null

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude

* Refactor SFU priority tests with cleaner helper function

- Add runSfuPriorityTest helper to reduce boilerplate
- Use boolean userCheckbox param instead of enum (more intuitive)
- Reduce test code by ~87% (from ~240 lines to ~30 lines)
- Tests now clearly show SFU priority: Checkbox > PMO > Intent > null

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude

* Address PR feedback: Extract SFU resolution into shared helper

Implementation changes:
- Extract SFU resolution logic into resolveSetupFutureUsage() helper
- Use helper in both prepareConfirmationTokenParams and prepareConfirmationTokenClientContextParams
- Ensures both code paths stay in sync with single source of truth

Test changes:
- Remove standalone clientContext SFU test (redundant)
- Update runSfuPriorityTest to validate both setUpFutureUsage AND clientContext.setupFutureUsage
- All 6 SFU priority tests now verify both fields match

Benefits:
- Single source of truth for SFU resolution logic
- Tests ensure both code paths stay synchronized
- Net -40 lines of code

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

Co-Authored-By: Claude <noreply@anthropic.com>
Committed-By-Agent: claude

* Fix publishable key

---------

Co-authored-by: Claude <noreply@anthropic.com>
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