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

Fix issue where us_bank_account is present in payment sheet when financial connections sdk is not available #5215

Merged
merged 2 commits into from Jun 28, 2022

Conversation

jameswoo-stripe
Copy link
Contributor

Fix an issue where us_bank_account payment method is showing in payment sheet when the financial connections sdk is not available.

Summary

Added a check for IsFinancialConnectionsAvailable in LPM repository.

Motivation

Make sure that the payment method is not available in payment sheet.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Can test by removing the financial connections gradle dependency in paymentsheet-example

Changelog

  • [Fixed] Fixes an issue where us_bank_account is available in payment sheet when the financial connections sdk is not available

@jameswoo-stripe jameswoo-stripe force-pushed the jameswoo/us_bank_account_fix_no_import branch from 0c4951c to f6581fb Compare June 24, 2022 21:35
@github-actions
Copy link
Contributor

github-actions bot commented Jun 24, 2022

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: none)
NEW: paymentsheet-example-release-pr.apk (signature: none)

          │           compressed           │          uncompressed          
          ├───────────┬───────────┬────────┼──────────┬──────────┬──────────
 APK      │ old       │ new       │ diff   │ old      │ new      │ diff     
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
      dex │  14.8 MiB │  14.8 MiB │ +702 B │ 50.2 MiB │ 50.2 MiB │ +1.4 KiB 
     arsc │   1.7 MiB │   1.7 MiB │    0 B │  1.7 MiB │  1.7 MiB │      0 B 
 manifest │   3.6 KiB │   3.6 KiB │    0 B │ 16.4 KiB │ 16.4 KiB │      0 B 
      res │ 819.9 KiB │ 819.9 KiB │    0 B │  1.3 MiB │  1.3 MiB │      0 B 
   native │   2.5 MiB │   2.5 MiB │    0 B │  5.9 MiB │  5.9 MiB │      0 B 
    asset │     3 MiB │     3 MiB │  +16 B │    3 MiB │    3 MiB │    +16 B 
    other │  80.2 KiB │  80.2 KiB │    0 B │  155 KiB │  155 KiB │      0 B 
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
    total │  22.9 MiB │  22.9 MiB │ +718 B │ 62.2 MiB │ 62.2 MiB │ +1.4 KiB 

         │          raw           │            unique             
         ├────────┬────────┬──────┼────────┬────────┬─────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff        
─────────┼────────┼────────┼──────┼────────┼────────┼─────────────
   files │      4 │      4 │    0 │        │        │             
 strings │ 235337 │ 235345 │   +8 │ 207175 │ 207182 │ +7 (+9 -2)  
   types │  41530 │  41531 │   +1 │  38372 │  38373 │ +1 (+1 -0)  
 classes │  35704 │  35705 │   +1 │  35704 │  35705 │ +1 (+1 -0)  
 methods │ 210738 │ 210745 │   +7 │ 203495 │ 203501 │ +6 (+10 -4) 
  fields │ 155318 │ 155322 │   +4 │ 154320 │ 154324 │ +4 (+4 -0)  

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  292 │  292 │  0   
 entries │ 5795 │ 5795 │  0
APK
    compressed    │    uncompressed    │                               
─────────┬────────┼─────────┬──────────┤                               
 size    │ diff   │ size    │ diff     │ path                          
─────────┼────────┼─────────┼──────────┼───────────────────────────────
 2.7 MiB │ +702 B │ 8.5 MiB │ +1.4 KiB │ ∆ classes3.dex                
 7.1 KiB │  +16 B │   7 KiB │    +16 B │ ∆ assets/dexopt/baseline.prof 
─────────┼────────┼─────────┼──────────┼───────────────────────────────
 2.7 MiB │ +718 B │ 8.5 MiB │ +1.4 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff       
  ────────┼────────┼────────────
   207175 │ 207182 │ +7 (+9 -2) 
  + �
  ���
  ��
  
  ���
  �g�2�0�J	����0�H¦�¨��
  + �
  ���
  ���
  ���
  ���
  ���2�0�B�¢����J	����0�H��¨��
  + P
  ���
  ��
  
  ���
  
  ���
  ���
  ��_
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  
  �� 
  
  ���
  ������ �2�0�:���B�����������0���������0�¢����J��
  ����0
  2�����0�H�J�������0
  2�������0	J�������0	2�������0�H�J�����0�2�������0�H�J����
  ����0���0�2�������0�H�J��������0
  0�R���������0	����0
  0�X�.¢��
  R�����0�X��¢��
  R�����0X��¢��
  ¨��
  + (Landroid/content/res/Resources;Lcom/stripe/android/payments/financialconnections/IsFinancialConnectionsAvailable;)V
  + (Lcom/stripe/android/ui/core/forms/resources/LpmRepository_SupportedPaymentMethod;)Ljava/lang/Boolean;
  + Lcom/stripe/android/ui/core/forms/resources/LpmRepository_initialize_1;
  + SMAP
  LpmRepository.kt
  Kotlin
  *S Kotlin
  *F
  + 1 LpmRepository.kt
  com/stripe/android/ui/core/forms/resources/LpmRepository
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  + 3 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,312:1
  764#2:313
  855#2,2:314
  1601#2,9:316
  1849#2:325
  1850#2:327
  1610#2:328
  1192#2,2:329
  1220#2,4:331
  1#3:326
  1#3:335
  *S KotlinDebug
  *F
  + 1 LpmRepository.kt
  com/stripe/android/ui/core/forms/resources/LpmRepository
  *L
  70#1:313
  70#1:314,2
  71#1:316,9
  71#1:325
  71#1:327
  71#1:328
  81#1:329,2
  81#1:331,4
  71#1:326
  *E
  
  + access_isFinancialConnectionsAvailable_p
  + isFinancialConnectionsAvailableProvider
  
  - J
  ���
  ��
  
  ���
  ���
  ��_
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  
  �� 
  
  ���
  ������ �2�0�:���B�����������0�¢����J�������0�2����0
  H�J�������0�2�������0�J�������0�2�������0�H�J�����0�2�������0�H�J����
  ����0
  ��0�2�������0�H�J��������0�0�R���������0�����0�0�X�.¢��
  R��	��0
  X��¢��
  ¨��
  - SMAP
  LpmRepository.kt
  Kotlin
  *S Kotlin
  *F
  + 1 LpmRepository.kt
  com/stripe/android/ui/core/forms/resources/LpmRepository
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  + 3 fake.kt
  kotlin/jvm/internal/FakeKt
  *L
  1#1,302:1
  764#2:303
  855#2,2:304
  1601#2,9:306
  1849#2:315
  1850#2:317
  1610#2:318
  1192#2,2:319
  1220#2,4:321
  1#3:316
  1#3:325
  *S KotlinDebug
  *F
  + 1 LpmRepository.kt
  com/stripe/android/ui/core/forms/resources/LpmRepository
  *L
  66#1:303
  66#1:304,2
  67#1:306,9
  67#1:315
  67#1:317
  67#1:318
  71#1:319,2
  71#1:321,4
  67#1:316
  *E
  
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   38372 │ 38373 │ +1 (+1 -0) 
  + Lcom/stripe/android/ui/core/forms/resources/LpmRepository_initialize_1;
  

METHODS:

   old    │ new    │ diff        
  ────────┼────────┼─────────────
   203495 │ 203501 │ +6 (+10 -4) 
  + com.stripe.android.payments.financialconnections.DefaultIsFinancialConnectionsAvailable <clinit>()
  + com.stripe.android.ui.core.forms.resources.LpmRepository_initialize_1 <init>(LpmRepository)
  + com.stripe.android.ui.core.forms.resources.LpmRepository_initialize_1 invoke(LpmRepository_SupportedPaymentMethod) → Boolean
  + com.stripe.android.ui.core.forms.resources.LpmRepository_initialize_1 invoke(Object) → Object
  + com.stripe.android.ui.core.forms.resources.LpmRepository <init>(Resources, IsFinancialConnectionsAvailable)
  + com.stripe.android.ui.core.forms.resources.LpmRepository <init>(Resources, IsFinancialConnectionsAvailable, int, DefaultConstructorMarker)
  + com.stripe.android.ui.core.forms.resources.LpmRepository access_isFinancialConnectionsAvailable_p(LpmRepository) → IsFinancialConnectionsAvailable
  + com.stripe.android.ui.core.forms.resources.LpmRepository_Factory <init>(Provider, Provider)
  + com.stripe.android.ui.core.forms.resources.LpmRepository_Factory create(Provider, Provider) → LpmRepository_Factory
  + com.stripe.android.ui.core.forms.resources.LpmRepository_Factory newInstance(Resources, IsFinancialConnectionsAvailable) → LpmRepository
  
  - com.stripe.android.ui.core.forms.resources.LpmRepository <init>(Resources)
  - com.stripe.android.ui.core.forms.resources.LpmRepository_Factory <init>(Provider)
  - com.stripe.android.ui.core.forms.resources.LpmRepository_Factory create(Provider) → LpmRepository_Factory
  - com.stripe.android.ui.core.forms.resources.LpmRepository_Factory newInstance(Resources) → LpmRepository
  

FIELDS:

   old    │ new    │ diff
...✂

@@ -61,10 +63,20 @@ class LpmRepository @Inject constructor(
}

@VisibleForTesting
fun initialize(inputStream: InputStream?) {
fun initialize(
Copy link
Contributor

Choose a reason for hiding this comment

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

You will have to remind me to do this when we read the specs from the server as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the object to the constructor instead, let me know if that changes anything

@jameswoo-stripe jameswoo-stripe force-pushed the jameswoo/us_bank_account_fix_no_import branch from bb93b61 to 92e5745 Compare June 25, 2022 18:00
@jameswoo-stripe jameswoo-stripe merged commit 08f7aad into master Jun 28, 2022
@jameswoo-stripe jameswoo-stripe deleted the jameswoo/us_bank_account_fix_no_import branch June 28, 2022 16:56
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

4 participants