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 reporting to GooglePayRepository #8218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

samer-stripe
Copy link
Collaborator

Summary

Add error reporting to GooglePayRepository.

Motivation

Adds visibility into potential issues with Google Pay.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@samer-stripe samer-stripe requested review from a team as code owners April 4, 2024 18:52
),
analyticsRequestExecutor = DefaultAnalyticsRequestExecutor(),
paymentAnalyticsRequestFactory = analyticsRequestFactory,
analyticsRequestExecutor = analyticsRequestExecutor,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created this constructor in order to avoid recreating PaymentAnalyticsRequestFactory and AnalyticsRequestExecutor. It also ended up moving all the logic for building DefaultGooglePayRepository into a single location.

fun providesErrorReporter(
analyticsRequestFactory: AnalyticsRequestFactory,
analyticsRequestExecutor: DefaultAnalyticsRequestExecutor,
): ErrorReporter = RealErrorReporter(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CustomerSheetViewModelModule provides a base AnalyticsRequestFactory and not the PaymentAnalyticsRequestFactory. Should we always defer to PaymentAnalyticsRequestFactory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I think we should defer to PaymentAnalyticsRequestFactory. There has been an issue with PaymentSheet and FlowController not properly attributing its product usage with a lot of its request and it looks like it's in relation to the usage of the base AnalyticsRequestFactory which doesn't send product usage by default.

Copy link
Contributor

github-actions bot commented Apr 4, 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 │ +900 B │   8.5 MiB │   8.5 MiB │ +1,020 B 
     arsc │   2.2 MiB │   2.2 MiB │    0 B │   2.2 MiB │   2.2 MiB │      0 B 
 manifest │     5 KiB │     5 KiB │    0 B │  24.9 KiB │  24.9 KiB │      0 B 
      res │ 911.1 KiB │ 911.1 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 │     3 MiB │     3 MiB │  +28 B │     3 MiB │     3 MiB │    +28 B 
    other │   204 KiB │   204 KiB │   -4 B │ 444.8 KiB │ 444.8 KiB │      0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼──────────
    total │  12.8 MiB │  12.8 MiB │ +924 B │  21.6 MiB │  21.6 MiB │   +1 KiB 

 DEX     │ old   │ new   │ diff            
─────────┼───────┼───────┼─────────────────
   files │     1 │     1 │   0             
 strings │ 42460 │ 42463 │  +3 (+14 -11)   
   types │ 14443 │ 14442 │  -1 (+8 -9)     
 classes │ 12172 │ 12171 │  -1 (+2 -3)     
 methods │ 60342 │ 60347 │  +5 (+434 -429) 
  fields │ 39853 │ 39842 │ -11 (+644 -655) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6029 │ 6029 │  0
APK
    compressed    │     uncompressed     │                                           
─────────┬────────┼───────────┬──────────┤                                           
 size    │ diff   │ size      │ diff     │ path                                      
─────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
 3.9 MiB │ +900 B │   8.5 MiB │ +1,020 B │ ∆ classes.dex                             
 7.4 KiB │  +21 B │   7.2 KiB │    +21 B │ ∆ assets/dexopt/baseline.prof             
   880 B │   +7 B │     748 B │     +7 B │ ∆ assets/dexopt/baseline.profm            
  62 KiB │   -2 B │ 139.7 KiB │      0 B │ ∆ META-INF/CERT.SF                        
   271 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                       
─────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
   4 MiB │ +924 B │   8.6 MiB │   +1 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   42460 │ 42463 │ +3 (+14 -11) 
  
  + GOOGLE_PAY_IS_READY_API_CALL
  + GOOGLE_PAY_JSON_REQUEST_PARSING
  + Lg7/J;
  + Lm8/g;
  + VLLLZZLLL
  + [Lg7/s;
  + [Ln7/J;
  + [Ln7/a1;
  + [Ln7/c0;
  + [Ln7/c1;
  + [Ln7/l0;
  + elements.google_pay_repository.is_ready_request_api_call_failure
  + google_pay_repository.is_ready_request_json_parsing_failure
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:dde651c,r8-mode:full,version:8.3.37}
  
  - LB6/e;
  - LW5/c;
  - Ln7/g1;
  - VLLLZZL
  - [Lg7/o;
  - [Ln7/L;
  - [Ln7/b1;
  - [Ln7/d0;
  - [Ln7/e1;
  - [Ln7/m0;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:e3f9f1a,r8-mode:full,version:8.3.37}
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   14443 │ 14442 │ -1 (+8 -9) 
  
  + Lg7/J;
  + Lm8/g;
  + [Lg7/s;
  + [Ln7/J;
  + [Ln7/a1;
  + [Ln7/c0;
  + [Ln7/c1;
  + [Ln7/l0;
  
  - LB6/e;
  - LW5/c;
  - Ln7/g1;
  - [Lg7/o;
  - [Ln7/L;
  - [Ln7/b1;
  - [Ln7/d0;
  - [Ln7/e1;
  - [Ln7/m0;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   60342 │ 60347 │ +5 (+434 -429) 
  
  + B4.d o(j)
  + B4.h o(j)
  + B4.w o(j)
  + B6.a <init>(l, l, Context, Boolean, a, Set, Boolean)
  + B6.b <init>(l, g, int)
  + B6.b get() → Object
  + B6.c <init>(l, g, g, g, g, g, g, g, g, g, e)
  + B6.d <clinit>()
  + C.i c(boolean, j, List, f, a, l, float, c, a, k, int)
  + C.i k(boolean, List, j, List, S, j, f, c, e, a, l, c, a, k, int, int, int)
  + C7.a D(y, l0, Integer, N, K, String, f, g, k, int)
  + C7.a E(y, l0, q, k, int, int)
  + C7.a F(y, l0, q, k, int, int)
  + C7.a F0(k) → J0
  + C7.a G(y, l0, k, int)
  + C7.a I0(k) → V0
  + D.f F(E, e, s0, d0, a) → x0
  + D6.y <init>(boolean, W, i, a, g, Map, a, a, t, f, j, o0, boolean)
  + E6.B0 <init>(W, c, d, j, j, Application, e, o0, L, j, S)
  + E6.X1 <init>(Application, r1, d, a, y, j, m, E, b, l, e, j, o0, L, j, j, S)
  + E6.e0 <init>(boolean, c0, k0, a, String, String)
  + E6.h0 <init>(float, boolean, c0, boolean, int, q, q, Integer, String, String, String, boolean, a, a, String, String, a, int, int, int)
  + E6.i0 b(float, boolean, c0, boolean, int, q, q, Integer, String, String, String, boolean, a, a, String, String, a, k, int, int, int)
  + E6.i0 e(boolean, c0, k0, a, String, String, k, int, int)
  + F6.j K(c, Object, j) → k
  + H6.M i(J, l, k, int)
  + I3.j i(Class, g)
  + O2.e <init>(l, g, e)
  + O2.e a(g, g, g) → e
  + O2.g a(g, g) → g
  + O2.g b(g, g) → g
  + O2.g c() → d
  + O2.g d() → m
  + O2.g e() → b
  + O2.g f() → c
  + O4.b <init>(Object, g, int)
  + O4.b a(l, g) → b
  + O6.S <init>(h, j, i, I, LinkedHashMap)
  + O8.C <init>(H, e)
  + O8.Q <init>(H, e)
  + P2.d <init>(l, g, g, g)
  + P2.d <init>(a, g, g, g, int)
  + Q2.g <init>(a, a, g, g, a, g, g, int)
  + Q2.g a(g, g, g, g, g, g, g) → g
  + R5.c <init>(D0, boolean, f, p, boolean, a, q, int, int)
  + S6.a F(a, l, q, k, int, int)
  + S6.a G(a, boolean, boolean, s, E1, E1, y0, a, c0, d1, a2, a, k, int, int)
  + S6.a r(a, boolean, boolean, q, E1, E1, y0, a, c0, d1, a2, a, k, int, int)
  + S6.a z(a, boolean, boolean, r, E1, E1, y0, a, c0, d1, a2, a, k, int, int)
  + V5.c <init>(Context, e, p, boolean, boolean, W, e, e)
  + V5.c <init>(Context, e, p, boolean, boolean, e, e)
  + W4.C0 <init>(Application, List, y, a, Resources, o, e, X, Integer, v, j, a, E, x, D, e, S)
  + W4.D0 <init>(g, g, g, g, g, g, g, g, g, g, g, g, i)
  + W4.E0 <init>(String, List, e, a, l, j, y, boolean, boolean, boolean, String, boolean, b, boolean, E0, String, boolean, boolean, l, c)
  + W4.E0 g(E0, String, e, a, j, u, boolean, boolean, String, a, boolean, E0, String, boolean, boolean, l, int) → E0
  + W4.F0 <init>(v, boolean, c, List, boolean)
  + W5.a <init>(l, l, l, Context, Boolean, a, a, Set, Boolean)
  + W5.a <init>(l, l, l, Context, Boolean, a, a, Set, Boolean, int)
  + W5.a <init>(l, l, Context, Boolean, a, a, Set, D, int)
  + W5.a a() → t
  + W5.a b() → f
  + W5.a c() → W
  + W5.b <init>(g)
  + W5.b a(B, D, A1, e, boolean) → J
  + X7.A0 <init>(H, e)
  + X7.C0 <init>(H, e)
  + X7.D0 <init>(H, e)
  + X7.E0 <init>(H, e)
  + X7.N0 <init>(H, e)
  + X7.P0 <init>(H, e)
  + X7.X1 <init>(H, e)
  + X7.g0 <init>(H, e)
  + X7.h0 <init>(H, e)
  + X7.i0 <init>(H, e)
  + X7.j0 <init>(H, e)
  + Z6.g <init>(boolean, a, int, int)
  + Z6.g G(Object, Object) → Object
  + 
...✂

@samer-stripe samer-stripe force-pushed the samer/add-error-reporting-to-google-pay-repo branch 2 times, most recently from 453de8a to 687d918 Compare April 5, 2024 23:29
@@ -57,6 +57,7 @@ internal class PaymentSheetAnalyticsTest {
validateAnalyticsRequest(eventName = "mc_load_started")
validateAnalyticsRequest(eventName = "mc_load_succeeded")
validateAnalyticsRequest(eventName = "mc_complete_sheet_newpm_show")
validateAnalyticsRequest(eventName = "elements.google_pay_repository.is_ready_request_api_call_failure")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could also turn off google pay for these tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We always run an operation to check if the device is supported by Google Pay irregardless of if Google Pay is enabled in the config which is why this failure happens. I could disable this check in debug 😬

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we check even if google pay is disabled coming from elements/sessions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup! iOS does this as well with Apple Pay

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we return a different mocked response so that we don't do this then?

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

2 participants