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

Allow Long as amount for Google Pay Launcher #6912

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Jun 22, 2023

Summary

This pull request makes it possible to launch GooglePayPaymentMethodLauncher with an amount as a Long instead of an Int. This is more consistent with the rest of our API.

We deprecate the present() method that uses an Int and also deprecate GooglePayLauncherContract and GooglePayPaymentMethodLauncherContract themselves, as we’d want to make them internal. Consumers of the SDK should use the launchers directly.

Motivation

Consistency and smaller API surface.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

  • [ADDED] GooglePayPaymentMethodLauncher can now be presented with an amount of type Long. The method to present with an Int has been deprecated.
  • [DEPRECATED] GooglePayLauncherContract and GooglePayPaymentMethodLauncherContract have been deprecated and will be removed in a future release. Use GooglePayLauncher and GooglePayPaymentMethodLauncher directly instead.

@tillh-stripe tillh-stripe force-pushed the tillh/allow-long-for-googlepaylauncher branch from 27ce17a to d60a838 Compare June 22, 2023 19:11
@github-actions
Copy link
Contributor

github-actions bot commented Jun 22, 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.4 MiB │   3.4 MiB │ +225 B │   7.4 MiB │   7.4 MiB │ +168 B 
     arsc │   2.1 MiB │   2.1 MiB │    0 B │   2.1 MiB │   2.1 MiB │    0 B 
 manifest │   4.9 KiB │   4.9 KiB │    0 B │  23.8 KiB │  23.8 KiB │    0 B 
      res │ 867.7 KiB │ 867.7 KiB │    0 B │   1.3 MiB │   1.3 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │    0 B 
    asset │     3 MiB │     3 MiB │  +12 B │     3 MiB │     3 MiB │  +12 B 
    other │ 199.6 KiB │ 199.6 KiB │  +11 B │ 446.7 KiB │ 446.7 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  12.1 MiB │  12.1 MiB │ +248 B │  20.3 MiB │  20.3 MiB │ +180 B 

 DEX     │ old   │ new   │ diff           
─────────┼───────┼───────┼────────────────
   files │     1 │     1 │  0             
 strings │ 36247 │ 36247 │  0 (+4 -4)     
   types │ 12085 │ 12085 │  0 (+3 -3)     
 classes │ 10189 │ 10189 │  0 (+1 -1)     
 methods │ 53531 │ 53530 │ -1 (+467 -468) 
  fields │ 33724 │ 33724 │  0 (+302 -302) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  291 │  291 │  0   
 entries │ 6921 │ 6921 │  0
APK
    compressed     │    uncompressed    │                               
──────────┬────────┼───────────┬────────┤                               
 size     │ diff   │ size      │ diff   │ path                          
──────────┼────────┼───────────┼────────┼───────────────────────────────
  3.4 MiB │ +225 B │   7.4 MiB │ +168 B │ ∆ classes.dex                 
  6.4 KiB │  +12 B │   6.3 KiB │  +12 B │ ∆ assets/dexopt/baseline.prof 
 62.6 KiB │   +8 B │ 140.8 KiB │    0 B │ ∆ META-INF/CERT.SF            
 48.4 KiB │   +3 B │ 140.7 KiB │    0 B │ ∆ META-INF/MANIFEST.MF        
──────────┼────────┼───────────┼────────┼───────────────────────────────
  3.5 MiB │ +248 B │   7.7 MiB │ +180 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   36247 │ 36247 │ 0 (+4 -4) 
  + Lm1/m1;
  + [Lsb/d;
  + [Lsb/p;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:311ebfb,r8-mode:full,version:8.0.46}
  
  - Lm0/n2;
  - [Lsb/i;
  - [Lsb/r;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:9b2c59e,r8-mode:full,version:8.0.46}
  

TYPES:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   12085 │ 12085 │ 0 (+3 -3) 
  + Lm1/m1;
  + [Lsb/d;
  + [Lsb/p;
  
  - Lm0/n2;
  - [Lsb/i;
  - [Lsb/r;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   53531 │ 53530 │ -1 (+467 -468) 
  + a0.w <init>(k1)
  + androidx.appcompat.widget.w <init>(x1, h0, d, m, b0, d3)
  + com.stripe.android.googlepaylauncher.GooglePayLauncherActivity i(i)
  + com.stripe.android.googlepaylauncher.GooglePayLauncherActivity j() → w
  + d8.m H(h1, Map, i, int, int)
  + d8.m c1(e, i) → l1
  + d8.m x0(y, m1, d) → Object
  + gi.c a(b) → i1
  + i1.z A()
  + i1.z w(String, int, String, int) → String
  + i1.z x(StringBuilder, String, String) → String
  + i1.z y() → Iterator
  + i1.z z(List, Parcel) → Iterator
  + k2.b h(y, long, v1) → long
  + kotlinx.coroutines.c0 f0(i1, x) → b
  + l9.p <init>(String, int, String, String, Long, String, int)
  + m0.a0 <init>(g2, j0, h0, n, u, x, b0, e)
  + m0.a1 <init>(y, m1, d)
  + m0.a2 <init>(b0, d1, m, t2, d)
  + m0.a2 A(Object, Object) → Object
  + m0.a2 f(Object, d) → d
  + m0.b0 <init>(g2, l, boolean, x, u)
  + m0.b0 <init>(g2, x, u, h0, boolean)
  + m0.b1 <init>(y, m1, d)
  + m0.b2 <init>(e2, int)
  + m0.b2 a() → Boolean
  + m0.b2 j() → Object
  + m0.c0 <init>(g2, x, u, h0, boolean)
  + m0.c1 <init>(y, m1, d)
  + m0.c2 <init>(z1, e2)
  + m0.c2 a() → boolean
  + m0.c2 b() → boolean
  + m0.c2 c(c2, e, d) → Object
  + m0.c2 d() → boolean
  + m0.c2 e(float) → float
  + m0.d1 <init>(m1, int)
  + m0.d2 <init>(e2, boolean, m)
  + m0.d2 y(Object, Object, Object) → Object
  + m0.e1 <init>(m1, int)
  + m0.e2 <clinit>()
  + m0.e2 <init>(b1, float)
  + m0.e2 a() → float
  + m0.e2 b() → float
  + m0.e2 c(b1, d, int, int)
  + m0.f0 <init>(n, r0, h0, boolean, boolean, g2, u, x, l)
  + m0.f1 <init>(m1, int)
  + m0.f2 <init>(j, b, r, a0, Object)
  + m0.g1 <init>(m1, d)
  + m0.g2 <init>(l1, q1)
  + m0.g2 a() → n0
  + m0.g2 b() → boolean
  + m0.g2 c() → h2
  + m0.h0 <init>(m1, d)
  + m0.h2 <init>(y)
  + m0.h2 a(long) → long
  + m0.h2 b(long, boolean) → int
  + m0.h2 c(long) → long
  + m0.i1 <clinit>()
  + m0.i1 <init>()
  + m0.i1 A(g) → c
  + m0.i1 A0(Map) → HashMap
  + m0.i1 A1(String, long, long, long) → long
  + m0.i1 B()
  + m0.i1 B0(s, String) → n
  + m0.i1 B1(String, int, int, int, int) → int
  + m0.i1 C(g, int) → float
  + m0.i1 C0(y, String, List, c, int)
  + m0.i1 C1(a0, Number)
  + m0.i1 D() → short
  + m0.i1 D0(i) → d
  + m0.i1 D1(c) → c
  + m0.i1 E() → String
  + m0.i1 E0(c[], byte[]) → byte[]
  + m0.i1 E1(c, String, boolean) → l
  + m0.i1 F() → float
  + m0.i1 F0(Drawable, ColorStateList, PorterDuff_Mode) → Drawable
  + m0.i1 F1(i, long, c, boolean)
  + m0.i1 G(g) → int
  + m0.i1 G0(String, String, Object)
  + m0.i1 G1(ByteArrayOutputStream, byte[], c[]) → boolean
  + m0.i1 H(w0, int) → short
  + m0.i1 H0(byte[]) → byte[]
  + m0.i1 H1(String) → String
  + m0.i1 I() → double
  + m0.i1 I0()
  + m0.i1 I1(Number, String, String) → String
  + m0.i1 J(AccountPickerState, c, a, a, a, a, a, a, a, c, i, int)
  + m0.i1 J0(byte[]) → byte[]
  + m0.i1 J1(int, int)
  + m0.i1 K(i, int)
  + m0.i1 K0(int, CharSequence) → int
  + m0.i1 K1(i, Object, Object, e, d) → Object
  + m0.i1 L(l, a, i, int, int)
  + m0.i1 L0(String, Map) → List
  + m0.i1 L1(ByteArrayOutputStream, c)
  + m0.i1 M(boolean, t0, Set, t0, i, int)
  + m0.i1 M0(Object, String) → List
  + m0.i1 M1(ByteArrayOutputStream, c, String)
  + m0.i1 N(a, l, f, m, boolean, boolean, f, i, int, int)
  + m0.i1 N0(String, String, byte[]) → String
  + m0.i1 N1(ByteArrayOutputStream, c)
  + m0.i1 O(byte[], int, int)
  + m0.i1 O0() → e
  + m0.i1 O1(ByteArrayOutputStream, c)
  + m0.i1 P(int, int) → long
  + m0.i1 P0(CompoundButton) → Drawable
  + m0.i1 Q(Number, String) → l
  + m0.i1 Q0(String) → o
  + m0.i1 R(g) → l
  + m0.i1 R0(String, g, b) → int
  + m0.i1 S(int, String) → l
  + m0.i1 S0(g, b, String, String) → int
  + m0.i1 T(int, String, String) → l
  + m0.i1 T0(int) → c
  + m0.i1 U(l, p0, e, s0, boolean, 
...✂

import kotlinx.parcelize.Parcelize

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
class GooglePayPaymentMethodLauncherContractV2 :
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sad that this is needed. Can we document these somehow to fix up in our next major revision?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. This and PaymentSheetContract are the two contracts that are unfortunately public, though this pull request deprecates the latter. Everything that’s deprecated can then be removed in the next major bump.

@tillh-stripe tillh-stripe force-pushed the tillh/allow-long-for-googlepaylauncher branch 6 times, most recently from a62fa44 to 9e501a5 Compare June 22, 2023 20:53
/**
* ISO 4217 alphabetic currency code.
*/
data class TransactionInfo internal constructor(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Keeping this constructor internal for now. We need to investigate if GooglePayJsonFactory and TransactionInfo actually need to be public or if we can make them internal and point to using GooglePayLauncher (see this note).

@JvmOverloads
fun present(
currencyCode: String,
amount: Int,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Making amount non-optional to avoid a conflicting methods error.

@tillh-stripe tillh-stripe force-pushed the tillh/allow-long-for-googlepaylauncher branch from 9e501a5 to 4a772c2 Compare June 26, 2023 14:11
@tillh-stripe tillh-stripe marked this pull request as ready for review June 26, 2023 14:15
@tillh-stripe tillh-stripe requested review from a team as code owners June 26, 2023 14:15
@tillh-stripe tillh-stripe merged commit 9dd5426 into master Jun 26, 2023
9 checks passed
@tillh-stripe tillh-stripe deleted the tillh/allow-long-for-googlepaylauncher branch June 26, 2023 20:53
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