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 saved payment method support for SEPA. #7449

Merged
merged 11 commits into from
Oct 18, 2023

Conversation

jaynewstrom-stripe
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe commented Oct 17, 2023

Summary

Add saved payment method support for SEPA debit.

  • Added a new activity to show the sepa mandate when flow controller hasn't been presented.
  • Added logic to display the mandate above and below the primary button (since US Bank and sepa are different)

Motivation

https://docs.google.com/document/d/19RVShmZqOQDfShWY3731UBTTRP7INqQXqlAcmy4BY30/edit?pli=1#heading=h.htnywx28hw7v

stripe/stripe-ios#2908

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Payment Sheet Flow Controller Flow Controller without launching
Screenshot 2023-10-17 at 9 01 04 AM Screenshot 2023-10-17 at 9 02 39 AM Screenshot 2023-10-17 at 9 02 39 AM

Updated stripe bank icon:
Screenshot 2023-10-17 at 9 02 39 AM

Changelog

  • [ADDED]7449 Added saved payment method support for SEPA family payment methods.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2023

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │          uncompressed           
          ├───────────┬───────────┬──────────┼───────────┬──────────┬──────────
 APK      │ old       │ new       │ diff     │ old       │ new      │ diff     
──────────┼───────────┼───────────┼──────────┼───────────┼──────────┼──────────
      dex │   3.5 MiB │   3.5 MiB │ +2.9 KiB │   7.7 MiB │  7.7 MiB │ +6.5 KiB 
     arsc │   2.2 MiB │   2.2 MiB │   +128 B │   2.2 MiB │  2.2 MiB │   +128 B 
 manifest │     5 KiB │   5.1 KiB │    +26 B │  25.2 KiB │ 25.4 KiB │   +236 B 
      res │ 900.9 KiB │ 900.4 KiB │   -527 B │   1.3 MiB │  1.3 MiB │ -1.7 KiB 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │    6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │    +22 B │     3 MiB │    3 MiB │    +22 B 
    other │ 203.6 KiB │ 203.7 KiB │    +96 B │ 458.8 KiB │  459 KiB │   +164 B 
──────────┼───────────┼───────────┼──────────┼───────────┼──────────┼──────────
    total │  12.4 MiB │  12.4 MiB │ +2.7 KiB │  20.7 MiB │ 20.7 MiB │ +5.3 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 38159 │ 38171 │ +12 (+122 -110)   
   types │ 12547 │ 12561 │ +14 (+107 -93)    
 classes │ 10544 │ 10555 │ +11 (+70 -59)     
 methods │ 55069 │ 55105 │ +36 (+3967 -3931) 
  fields │ 35204 │ 35225 │ +21 (+2756 -2735) 

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  292 │  292 │  0         
 entries │ 6922 │ 6923 │ +1 (+1 -0)
APK
     compressed      │     uncompressed     │                               
──────────┬──────────┼───────────┬──────────┤                               
 size     │ diff     │ size      │ diff     │ path                          
──────────┼──────────┼───────────┼──────────┼───────────────────────────────
  3.5 MiB │ +2.9 KiB │   7.7 MiB │ +6.5 KiB │ ∆ classes.dex                 
  1.8 KiB │ -1.3 KiB │   3.9 KiB │ -3.2 KiB │ ∆ res/tC.xml                  
    763 B │   +763 B │   1.3 KiB │ +1.3 KiB │ + res/vE.xml                  
  2.2 MiB │   +128 B │   2.2 MiB │   +128 B │ ∆ resources.arsc              
 65.3 KiB │    +51 B │ 146.5 KiB │    +82 B │ ∆ META-INF/CERT.SF            
    762 B │    +48 B │   1.3 KiB │   +100 B │ ∆ res/1K.xml                  
 49.6 KiB │    +48 B │ 146.4 KiB │    +82 B │ ∆ META-INF/MANIFEST.MF        
  5.1 KiB │    +26 B │  25.4 KiB │   +236 B │ ∆ AndroidManifest.xml         
  6.4 KiB │    +22 B │   6.3 KiB │    +22 B │ ∆ assets/dexopt/baseline.prof 
  1.2 KiB │     -3 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA           
    810 B │     +1 B │   2.3 KiB │      0 B │ ∆ res/1w.xml                  
  1.1 KiB │     +1 B │   3.4 KiB │      0 B │ ∆ res/B4.xml                  
    707 B │     -1 B │   1.3 KiB │      0 B │ ∆ res/UK.xml                  
    760 B │     +1 B │   1.7 KiB │      0 B │ ∆ res/cZ.xml                  
──────────┼──────────┼───────────┼──────────┼───────────────────────────────
  5.9 MiB │ +2.7 KiB │  10.2 MiB │ +5.3 KiB │ (total)
MANIFEST
@@ -198,2 +198,7 @@
     <activity
+        android:exported=false
+        android:name=com.stripe.android.paymentsheet.ui.SepaMandateActivity
+        android:theme=@style/StripePaymentSheetDefaultTheme
+        />
+    <activity
         android:autoRemoveFromRecents=true
DEX
STRINGS:

   old   │ new   │ diff            
  ───────┼───────┼─────────────────
   38159 │ 38171 │ +12 (+122 -110) 
  + , showAbovePrimaryButton=
  + Args(merchantName=
  + Intent().putExtra(
       …                        )
  + Intent(context, SepaMand…tExtra(EXTRA_ARGS, input)
  + Laj/b;
  + Laj/c;
  + Laj/d;
  + Lbj/d;
  + Lbj/e;
  + Lbj/f;
  + Lbj/g;
  + Lbj/h;
  + Lbj/i;
  + Lbj/j;
  + Lbj/k;
  + Lbj/l;
  + Lbj/m;
  + Lbj/n;
  + Lbj/o;
  + Lbj/p;
  + Lbj/q;
  + Lbj/r;
  + Lbj/s;
  + Lbj/t;
  + Lbj/u;
  + Lbj/v;
  + Lbj/w;
  + Lbj/x;
  + Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_5;
  + Lcom/stripe/android/paymentsheet/ui/SepaMandateActivity;
  + Ldj/c;
  + Le1/j8;
  + Lej/c;
  + Lej/d;
  + Lid/x;
  + Lif/n0;
  + Lje/f0;
  + Lje/g0;
  + Lkd/s0;
  + Llj/c;
  + Llj/d;
  + Llj/e;
  + Llj/f;
  + Lmj/a;
  + Lmj/b;
  + Lmj/c;
  + Lmj/d;
  + Lmj/e;
  + Lmj/f;
  + Lpj/a;
  + Lpj/b;
  + Lse/a1;
  + Lse/b1;
  + Lse/c1;
  + Lse/d1;
  + Lse/e1;
  + Lse/f1;
  + Lse/g1;
  + Lse/h1;
  + Lsi/m;
  + Lsi/n;
  + Lt2/v;
  + Lti/f;
  + Lti/g;
  + Lti/h;
  + Lti/i;
  + Lti/j;
  + Lti/k;
  + Lti/l;
  + Lui/c;
  + Lui/d;
  + Lui/e;
  + Lvf/u;
  + Lwi/b;
  + MandateText(text=
  + SEPA_MANDATE_CLOSE_BUTTON
  + SEPA_MANDATE_CONTINUE_BUTTON
  + SepaMandateActivity was started without arguments.
  + [Lbj/s;
  + [Ldf/j;
  + [Ldf/p;
  + [Le1/a8;
  + [Le1/g2;
  + [Le1/g3;
  + [Le1/i5;
  + [Le1/k4;
  + [Le1/v2;
  + [Lid/u;
  + [Lif/f0;
  + [Ljd/c3;
  + [Lje/d0;
  + [Lje/f;
  + [Lje/g0;
  + [Lje/r;
  + [Lje/v;
  + [Lkd/s;
  + [Llf/p;
  + [Llj/e;
  + [Lpj/a;
  + [Lse/d1;
  + [Lse/f1;
  + [Lse/g1;
  + [Lt9/b0;
  + [Lt9/k0;
  + [Lt9/m;
  + [Lt9/n0;
  + [Lt9/o;
  + [Lt9/s;
  + [Lt9/t0;
  + [Lt9/z;
  + [Ltf/e;
  + [Lti/h;
  + [Lvf/u;
  + [Lw6/a;
  + [Lxi/a;
  + acknowledgedCallback
  + closeCallback
  + onSepaMandateResult
  + onSepaMandateResult_paymentsheet_release(Lcom/stripe/android/paymentsheet/ui/SepaMandateResult;)V
  + updateMandateText
  + updateMandateText(Ljava/lang/String;Z)V
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:fdfea47,r8-mode:full,version:8.1.65}
  
  - Lcj/b;
  - Lcj/c;
  - Lcj/d;
  - Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_4;
  - Le2/q0;
  - Lgd/i;
  - Lhj/c;
  - Lhj/d;
  - Ljd/y3;
  - Ljj/e;
  - Ljj/f;
  - Lkj/c;
  - Lkj/d;
  - Lkj/e;
  - Lkj/f;
  - Llf/x;
  - Lri/a;
  - Lri/b;
  - Lri/c;
  - Lri/d;
  - Lri/e;
  - Lri/f;
  - Lri/g;
  - Lri/h;
  - Lri/i;
  - Lri/j;
  - Lri/k;
  - Lri/l;
  - Lri/m;
  - Lri/n;
  - Lt9/e1;
  - Lwa/w0;
  - Lxi/b;
  - Lyi/a;
  - Lyi/b;
  - Lyi/c;
  - Lyi/d;
  - Lzi/c;
  - Lzi/d;
  - Lzi/e;
  - Lzi/f;
  - Lzi/g;
  - Lzi/h;
  - Lzi/i;
  - Lzi/j;
  - Lzi/k;
  - Lzi/l;
  - Lzi/m;
  - Lzi/n;
  - Lzi/o;
  - Lzi/p;
  - Lzi/q;
  - Lzi/r;
  - Lzi/s;
  - Lzi/t;
  - Lzi/u;
  - Lzi/v;
  - Lzi/w;
  - Lzi/x;
  - P2
  - Q2
  - R2
  - S2
  - T2
  - U2
  - V2
  - W2
  - X2
  - Y2
  - Z2
  - [Ldf/i;
  - [Ldf/o;
  - [Le1/f2;
  - [Le1/f3;
  - [Le1/h5;
  - [Le1/j4;
  - [Le1/u2;
  - [Le1/z7;
  - [Lid/r;
  - [Lif/d0;
  - [Ljd/a3;
  - [Ljd/f3;
  - [Lje/a0;
  - [Lje/e;
  - [Lje/j;
  - [Lje/s;
  - [Lje/z;
  - [Ljj/e;
  - [Lkd/q;
  - [Llf/s;
  - [Lnj/a;
  - [Lsi/h;
  - [Lt9/a0;
  - [Lt9/g0;
  - [Lt9/m0;
  - [Lt9/n;
  - [Lt9/o0;
  - [Lt9/r;
  - [Lt9/u0;
  - [Lt9/u;
  - [Ltf/d;
  - [Lvf/t;
  - [Lwi/a;
  - [Lzi/s;
  - a3
  - b3
  - c3
  - updateBelowButtonText
  - updateBelowButtonText(Ljava/lang/String;)V
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:aa2f0c7,r8-mode:full,version:8.1.65}
  

TYPES:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   12547 │ 12561 │ +14 (+107 -93) 
  + Laj/b;
  + Laj/c;
  + Laj/d;
  + Lbj/d;
  + Lbj/e;
  + Lbj/f;
  + Lbj/g;
  + Lbj/h;
  + Lbj/i;
  + Lbj/j;
  + Lbj/k;
  + Lbj/l;
  + Lbj/m;
  + Lbj/n;
  + Lbj/o;
  + Lbj/p;
  + Lbj/q;
  + Lbj/r;
  + Lbj/s;
  + Lbj/t;
  + Lbj/u;
  + Lbj/v;
  + Lbj/w;
  + Lbj/x;
  + Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_5;
  + Lcom/stripe/android/paymentsheet/ui/SepaMandateActivity;
  + Ldj/c;
  + Le1/j8;
  + Lej/c;
  + Lej/d;
  + Lid/x;
  + Lif/n0;
  + Lje/f0;
  + Lje/g0;
  + Lkd/s0;
  + Llj/c;
  + Llj/d;
  + Llj/e;
  + Llj/f;
  + Lmj/a;
  + Lmj/b;
  + Lmj/c;
  + Lmj/d;
  + Lmj/e;
  + Lmj/f;
  + Lpj/a;
  + Lpj/b;
  + Lse/a1;
  + Lse/b1;
  + Lse/c1;
  + Lse/d1;
  + Lse/e1;
  + Lse/f1;
  + Lse/g1;
  + Lse/h1;
  + Lsi/m;
  + Lsi/
...✂
ARSC
ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   6922 │ 6923 │ +1 (+1 -0) 
  + drawable/stripe

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this not centered text compared to other mandate texts?

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.

}.getOrNull()?.merchantName

if (merchantName == null) {
finish()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log a message for easier debugging for integrators?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only time this could happen is if you don't supply args. I can log a message, but this shouldn't ever happen. This is just a safety to prevent the app from crashing when attackers try to launch our activity illegally.

// we present the mandate directly.
sepaMandateActivityLauncher.launch(
SepaMandateContract.Args(
merchantName = state.config?.merchantDisplayName ?: ""
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right, the activity is expecting a non null merchant name, what makes an empty string better here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only time this could be null is when the config is null, which isn't possible in practice. So the empty string should never happen.


internal sealed class PaymentSelection : Parcelable {

var hasAcknowledgedSepaMandate: Boolean = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right place to have sepa mandate check? Would it make sense to make this more generic? Maybe even nullable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sepa is kinda like US Bank, very one off. I talked with Yuki about this too, while a generic solution seems reasonable, sepa is pretty unique in all of this.

This felt like the best place to put this when I was developing it, but if there's a better place, I'm more than happy to move it.

@jaynewstrom-stripe
Copy link
Collaborator Author

I ran E2E tests locally to verify

@jaynewstrom-stripe jaynewstrom-stripe enabled auto-merge (squash) October 18, 2023 17:27
@jaynewstrom-stripe jaynewstrom-stripe merged commit 34c396e into master Oct 18, 2023
9 checks passed
@jaynewstrom-stripe jaynewstrom-stripe deleted the jaynewstrom/sepa-spm branch October 18, 2023 17:33
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.

None yet

3 participants