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

Add Error to FormActivityUI #10127

Merged
merged 5 commits into from
Feb 11, 2025
Merged

Add Error to FormActivityUI #10127

merged 5 commits into from
Feb 11, 2025

Conversation

tjclawson-stripe
Copy link
Collaborator

Summary

Add error to FormActivityStateHolder.State
Add error returned from ConfirmationHandler.Result.Failed to state in FormActivityStateHelper.State.updateWithConfirmationState
Display error in FormActivityUI

Adds screenshot tests

Motivation

https://jira.corp.stripe.com/browse/MOBILESDK-2997

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshot_20250210_175638

Copy link
Contributor

github-actions bot commented Feb 10, 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 MiB │     2 MiB │  0 B │   4.1 MiB │   4.1 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │  0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │ 302.6 KiB │ 302.6 KiB │  0 B │ 456.7 KiB │ 456.7 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │  0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   7.2 KiB │   7.2 KiB │  0 B │   6.9 KiB │   6.9 KiB │  0 B 
    other │  90.8 KiB │  90.8 KiB │ -8 B │   171 KiB │   171 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │   9.6 MiB │   9.6 MiB │ -8 B │  21.5 MiB │  21.5 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 19978 │ 19978 │ 0 (+0 -0) 
   types │  6194 │  6194 │ 0 (+0 -0) 
 classes │  4985 │  4985 │ 0 (+0 -0) 
 methods │ 29821 │ 29821 │ 0 (+0 -0) 
  fields │ 17538 │ 17538 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3624 │ 3624 │  0
APK
   compressed    │   uncompressed   │                                           
──────────┬──────┼───────────┬──────┤                                           
 size     │ diff │ size      │ diff │ path                                      
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 28.6 KiB │ -4 B │  63.2 KiB │  0 B │ ∆ META-INF/CERT.SF                        
 25.4 KiB │ -3 B │  63.1 KiB │  0 B │ ∆ META-INF/MANIFEST.MF                    
    271 B │ -1 B │     120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 54.3 KiB │ -8 B │ 126.4 KiB │  0 B │ (total)

)
is ConfirmationHandler.Result.Canceled -> this
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Canceled indicates the confirmation was canceled by the user, meaning they closed FormActivity in this case, so I don't think we need to update anything here

Copy link
Collaborator

Choose a reason for hiding this comment

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

@samer-stripe can you confirm this is right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are internal events that might actually want to trigger based on cancelation. There's a cancellation action internally for None, InformCancellation, and ModifyDetails.

  • If None, do nothing
  • If InformCancellation, inform the user that they canceled the payment. Maybe through an internal method or through a result. Depends on the use case. FlowController I believe sends a result.
  • ModifyDetails should perform an action to show the form again if needed. FlowController uses this when the user clicks Modify details to re-open the form activity. We likely don't need for the default embedded case but will need it to use it for the Continue GA case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case I believe in this is right given the form activity here at the moment acts like PaymentSheet. We might actually want to clear any user error messages though on cancel. We do this in PaymentSheet today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated to clear errors on canceled result and added test

@tjclawson-stripe tjclawson-stripe marked this pull request as ready for review February 11, 2025 17:43
@tjclawson-stripe tjclawson-stripe requested review from a team as code owners February 11, 2025 17:43
)
is ConfirmationHandler.Result.Canceled -> this
Copy link
Collaborator

Choose a reason for hiding this comment

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

@samer-stripe can you confirm this is right?

@tjclawson-stripe tjclawson-stripe merged commit bffcba8 into master Feb 11, 2025
13 checks passed
@tjclawson-stripe tjclawson-stripe deleted the tyler/mobilesdk-2997 branch February 11, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants