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

Incorporate the Activity result APIs to resolve loadPaymentData calls #8381

Merged
merged 17 commits into from
May 1, 2024

Conversation

jaynewstrom-stripe
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe commented Apr 30, 2024

Summary

Finishing the work started in #7895

Motivation

Upgrade to the latest playServicesWallet version.

Testing

  • Modified tests
  • Manually verified

Copy link
Contributor

github-actions bot commented Apr 30, 2024

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.9 MiB │   3.9 MiB │ -957 B │   8.6 MiB │   8.6 MiB │ -1.1 KiB 
     arsc │   2.2 MiB │   2.2 MiB │  +84 B │   2.2 MiB │   2.2 MiB │    +84 B 
 manifest │     5 KiB │     5 KiB │    0 B │  25.2 KiB │  25.2 KiB │      0 B 
      res │ 907.5 KiB │ 907.5 KiB │    0 B │   1.4 MiB │   1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │      0 B 
    asset │   2.9 MiB │   2.9 MiB │   +7 B │   2.9 MiB │   2.9 MiB │     +7 B 
    other │   194 KiB │   194 KiB │   -4 B │ 423.6 KiB │ 423.6 KiB │      0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼──────────
    total │  12.7 MiB │  12.7 MiB │ -870 B │  21.6 MiB │  21.6 MiB │   -1 KiB 

 DEX     │ old   │ new   │ diff                
─────────┼───────┼───────┼─────────────────────
   files │     1 │     1 │   0                 
 strings │ 43006 │ 43019 │ +13 (+4144 -4131)   
   types │ 14793 │ 14794 │  +1 (+4106 -4105)   
 classes │ 12497 │ 12499 │  +2 (+3414 -3412)   
 methods │ 61102 │ 61099 │  -3 (+25073 -25076) 
  fields │ 40398 │ 40408 │ +10 (+18623 -18613) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6028 │ 6028 │  0
APK
    compressed     │     uncompressed     │                                           
──────────┬────────┼───────────┬──────────┤                                           
 size     │ diff   │ size      │ diff     │ path                                      
──────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
  3.9 MiB │ -957 B │   8.6 MiB │ -1.1 KiB │ ∆ classes.dex                             
    127 B │ +127 B │       5 B │     +5 B │ + META-INF/services/M8.z                  
    127 B │ +127 B │       5 B │     +5 B │ + META-INF/services/R8.m                  
          │ -127 B │           │     -5 B │ - META-INF/services/L8.z                  
          │ -127 B │           │     -5 B │ - META-INF/services/Q8.m                  
  2.2 MiB │  +84 B │   2.2 MiB │    +84 B │ ∆ resources.arsc                          
 52.7 KiB │  -14 B │ 116.7 KiB │      0 B │ ∆ META-INF/CERT.SF                        
    892 B │  +10 B │     760 B │    +10 B │ ∆ assets/dexopt/baseline.profm            
 49.4 KiB │   +8 B │ 116.6 KiB │      0 B │ ∆ META-INF/MANIFEST.MF                    
  7.4 KiB │   -3 B │   7.3 KiB │     -3 B │ ∆ assets/dexopt/baseline.prof             
    272 B │   +1 B │     120 B │      0 B │ ∆ META-INF/version-control-info.textproto 
  1.2 KiB │   +1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA                       
──────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
  6.3 MiB │ -870 B │  11.1 MiB │   -1 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff              
  ───────┼───────┼───────────────────
   43006 │ 43019 │ +13 (+4144 -4131) 
  
  + Duplicate binding with the same ServiceConnection: %s, %s, %s.
  + Google Pay failed with missing data.
  + Google Pay missing result data.
  + ILZZ
  + Invalid GmsCore APK, remote loading disabled.
  + LA4/d;
  + LA4/e;
  + LA4/f;
  + LA4/g;
  + LA4/h;
  + LA4/i;
  + LA4/j;
  + LA4/k;
  + LA4/l;
  + LA5/y;
  + LA5/z;
  + LA6/g;
  + LA6/h;
  + LA6/i;
  + LA6/j;
  + LA6/k;
  + LA6/l;
  + LA6/m;
  + LA6/n;
  + LA6/o;
  + LA6/p;
  + LA6/q;
  + LA6/r;
  + LA6/s;
  + LA6/t;
  + LA6/u;
  + LA6/v;
  + LA6/w;
  + LA6/x;
  + LA6/y;
  + LA6/z;
  + LA7/A;
  + LA7/B;
  + LA7/C;
  + LA7/D;
  + LA7/E;
  + LA7/F;
  + LA7/G;
  + LA7/H;
  + LA7/I;
  + LA7/J;
  + LA7/K;
  + LA7/L;
  + LA7/c;
  + LA7/d;
  + LA7/e;
  + LA7/f;
  + LA7/g;
  + LA7/h;
  + LA7/i;
  + LA7/j;
  + LA7/k;
  + LA7/l;
  + LA7/m;
  + LA7/n;
  + LA7/o;
  + LA7/p;
  + LA7/q;
  + LA7/r;
  + LA7/s;
  + LA7/t;
  + LA7/u;
  + LA7/v;
  + LA7/w;
  + LA7/x;
  + LA7/y;
  + LA7/z;
  + LB3/c;
  + LB3/d;
  + LB3/e;
  + LB3/f;
  + LB5/q;
  + LB5/r;
  + LB5/s;
  + LB5/t;
  + LB5/u;
  + LB5/v;
  + LB5/w;
  + LB5/x;
  + LB8/f;
  + LB8/g;
  + LB8/h;
  + LB8/i;
  + LB8/j;
  + LB8/k;
  + LB8/l;
  + LB8/m;
  + LB8/n;
  + LB8/o;
  + LB8/p;
  + LB8/q;
  + LB8/r;
  + LB8/s;
  + LB8/t;
  + LB8/u;
  + LB8/v;
  + LB8/w;
  + LB8/x;
  + LC7/A;
  + LC7/B;
  + LC7/C;
  + LC7/D;
  + LC7/E;
  + LC7/F;
  + LC7/G;
  + LC7/H;
  + LC7/I;
  + LC7/J;
  + LC7/K;
  + LC7/L;
  + LC7/M;
  + LC7/N;
  + LC7/O;
  + LC7/g;
  + LC7/h;
  + LC7/i;
  + LC7/j;
  + LC7/k;
  + LC7/l;
  + LC7/m;
  + LC7/n;
  + LC7/o;
  + LC7/p;
  + LC7/q;
  + LC7/r;
  + LC7/s;
  + LC7/t;
  + LC7/u;
  + LC7/v;
  + LC7/w;
  + LC7/x;
  + LC7/y;
  + LC7/z;
  + LC8/c;
  + LC8/d;
  + LC8/e;
  + LD3/b;
  + LD3/c;
  + LD3/d;
  + LD3/e;
  + LD3/f;
  + LD4/A;
  + LD4/B;
  + LD4/C;
  + LD4/D;
  + LD4/E;
  + LD4/F;
  + LD4/G;
  + LD4/H;
  + LD4/I;
  + LD4/J;
  + LD4/K;
  + LD4/L;
  + LD4/a;
  + LD4/b;
  + LD4/c;
  + LD4/d;
  + LD4/e;
  + LD4/f;
  + LD4/g;
  + LD4/h;
  + LD4/i;
  + LD4/j;
  + LD4/k;
  + LD4/l;
  + LD4/m;
  + LD4/n;
  + LD4/o;
  + LD4/p;
  + LD4/q;
  + LD4/r;
  + LD4/s;
  + LD4/t;
  + LD4/u;
  + LD4/v;
  + LD4/w;
  + LD4/x;
  + LD4/y;
  + LD4/z;
  + LD5/A;
  + LD5/B;
  + LD5/C;
  + LD5/D;
  + LD5/E;
  + LD5/F;
  + LD5/G;
  + LD5/j;
  + LD5/k;
  + LD5/l;
  + LD5/m;
  + LD5/n;
  + LD5/o;
  + LD5/p;
  + LD5/q;
  + LD5/r;
  + LD5/s;
  + LD5/t;
  + LD5/u;
  + LD5/v;
  + LD5/w;
  + LD5/x;
  + LD5/y;
  + LD5/z;
  + LD8/b;
  + LD9/b;
  + LD9/c;
  + LD9/d;
  + LD9/e;
  + LD9/f;
  + LD9/g;
  + LD9/h;
  + LD9/i;
  + LD9/j;
  + LD9/k;
  + LD9/l;
  + LD9/m;
  + LD9/n;
  + LD9/o;
  + LD9/p;
  + LD9/q;
  + LD9/r;
  + LD9/s;
  + LD9/t;
  + LD9/u;
  + LD9/v;
  + LD9/w;
  + LD9/x;
  + LD9/y;
  + LE3/a;
  + LE6/A0;
  + LE6/A1;
  + LE6/B0;
  + LE6/B1;
  + LE6/C0;
  + LE6/C1;
  + LE6/D0;
  + LE6/D1;
  + LE6/E0;
  + LE6/E1;
  + LE6/F0;
  + LE6/F1;
  + LE6/G0;
  + LE6/G1;
  + LE6/H0;
  + LE6/H1;
  + LE6/I0;
  + LE6/I1;
  + LE6/J0;
  + LE6/J1;
  + LE6/K0;
  + LE6/K1;
  + LE6/L0;
  + LE6/L1;
  + LE6/M0;
  + LE6/M1;
  + LE6/N0;
  + LE6/N1;
  + LE6/O0;
  + LE6/O1;
  + LE6/P0;
  + LE6/P1;
  + LE6/Q0;
  + LE6/Q1;
  + LE6/R0;
  + LE6/R1;
  + LE6/S0;
  + LE6/S1;
  + LE6/T0;
  + LE6/T1;
  + LE6/U0;
  + LE6/U1;
  + LE6/V0;
  + LE6/V1;
  + LE6/W0;
  + LE6/W1;
  + LE6/X0;
  + LE6/X1;
  + LE6/Y0;
  + LE6/Y1;
  + LE6/Z0;
  + LE6/Z1;
  + LE6/a1;
  + LE6/a2;
  + LE6/b1;
  + LE6/b2;
  + LE6/c1;
  + LE6/c2;
  + LE6/d1;
  + LE6/d2;
  + LE6/e0;
  + LE6/e1;
  + LE6/e2;
  + LE6/f0;
  + LE6/f1;
  + LE6/f2;
  + LE6/g0;
  + LE6/g1;
  + LE6/g2;
  + LE6/h0;
  + LE6/h1;
  + LE6/h2;
  + LE6/i0;
  + LE6/i1;
  + LE6/i2;
  + LE6/j0;
  + LE6/j1;
  + LE6/j2;
  + LE6/k0;
  + LE6/k1;
  + LE6/k2;
  + LE6/l0;
  + LE6/l1;
  + LE6/l2;
  + LE6/m0;
  + LE6/m1;
  + LE6/m2;
  + LE6/n0;
  + LE6/n1;
  + LE6/n2;
  + LE6/o0;
  + LE6/o1;
  + LE6/o2;
  + LE6/p0;
  + LE6/p1;
  + LE6/q0;
  + LE6/q1;
  + LE6/r0;
  + LE6/r1;
  + LE6/s0;
  + LE6/s1;
  + LE6/t0;
  + LE6/t1;
  + LE6/u0;
  + LE6/u1;
  + LE6/v0;
  + LE6/v1;
  + LE6/w0;
  + LE6/w1;
  + LE6/x0;
  + LE6/x1;
  + LE6/y0;
  + LE6/y1;
  + LE6/z0;
  + LE6/z1;
  + LF6/A;
  + LF6/B;
  + LF6/C;
  + LF6/D;
  + LF6/E;
  + LF6/F;
  + LF6/G;
  + LF6/H;
  + LF6/I;
  + LF6/J;
  + LF6/K;
  + LF6/L;
  + LF6/M;
  + LF6/N;
  + LF6/O;
  + LF6/P;
  + LF6/Q;
  + LF6/S;
  + LF6/T;
  + LF6/U;
  + LF6/V;
  + LF6/W;
  + LF6/X;
  + LF6/Y;
  + LF6
...✂

@jaynewstrom-stripe jaynewstrom-stripe changed the title Jaynewstrom/public pr 7895 Incorporate the Activity result APIs to resolve loadPaymentData calls Apr 30, 2024
example/dependencies/dependencies.txt Outdated Show resolved Hide resolved
@@ -39,10 +40,6 @@ internal class GooglePayLauncherActivity : AppCompatActivity() {
GooglePayLauncherViewModel.Factory(args)
}

private val errorReporter: ErrorReporter by lazy {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think as part of fixing the merge conflicts, the actual error reporting for some of these errors was removed. Can we fix that? Or if there are error cases that no longer exist, can we remove those cases from the ErrorReporter ErrorEvent enum?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(could be fixed by sharing more code with GooglePayPaymentMethodLauncherActivity, see my comment there)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I thought I fixed these, but looks like I missed some. Good callout. I'll follow up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't realize we had two classes that were so similar. So when I saw this missing after the rebase, I thought I fixed it. But I just added it to the other one 🤦.

I think it's probably worth having in both. And it's also probably worth consolidating these.

private fun onGooglePayResult(taskResult: ApiTaskResult<PaymentData>) {
when (taskResult.status.statusCode) {
CommonStatusCodes.SUCCESS -> {
val paymentDataJson = JSONObject(taskResult.result!!.toJson())
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 impact of result being null? Will we crash?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(could be fixed by sharing more code with GooglePayPaymentMethodLauncherActivity, see my comment there)

when (taskResult.status.statusCode) {
CommonStatusCodes.SUCCESS -> {
val result = taskResult.result
if (result != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah it actually looks like this activity handles the taskResult.result being null and it reports errors, both of which are not present in GooglePayLauncherActivity. If that's not intentional, should we try to share more code between these two classes?

val statusMessage = status.statusMessage.orEmpty()
errorReporter.report(
ErrorReporter.ExpectedErrorEvent.GOOGLE_PAY_FAILED,
additionalNonPiiParams = mapOf("status_message" to statusMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we include the status code here too?

@jaynewstrom-stripe
Copy link
Collaborator Author

jaynewstrom-stripe commented May 1, 2024

After digging through this more, I think we need to rewrite quite a bit of our google pay integrations to work more seamlessly with the Android lifecycle. During that refactor, we could also attempt to reuse more of the google pay integration logic between the two.

Created a backlog task to do this: https://jira.corp.stripe.com/browse/MOBILESDK-2011

Copy link
Collaborator

@samer-stripe samer-stripe left a comment

Choose a reason for hiding this comment

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

🚀 LGTM!

}
}
}
}
Copy link
Collaborator

@samer-stripe samer-stripe May 1, 2024

Choose a reason for hiding this comment

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

Not necessary for this PR, but I added kotlinx-coroutines-play-services for GooglePayRepository in my refactor for that class. Should we align and use that instead or vice versa by moving this extension to a core lib?

@jaynewstrom-stripe jaynewstrom-stripe merged commit d3a5e19 into master May 1, 2024
16 checks passed
@jaynewstrom-stripe jaynewstrom-stripe deleted the jaynewstrom/public-pr-7895 branch May 1, 2024 20:37
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.

4 participants