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

Restore selected payment method when user returns to Link #5148

Merged
merged 7 commits into from Jun 21, 2022

Conversation

brnunes-stripe
Copy link
Contributor

@brnunes-stripe brnunes-stripe commented Jun 15, 2022

Summary

  • LinkPaymentLauncher.setup takes as argument the previously selected LinkPaymentDetails, and properly shows it as selected when the user returns to Link in the custom flow.
  • Make the PaymentMethod screen receive a parameter determining if it should show the previously selected payment method, fetched from the arguments.
  • Create two subclasses of LinkPaymentDetails, representing saved and new payment methods. A new payment method must hold the data entered by the user so the form can be pre-filled with those values when the user returns.
  • Refactor the logic that converts the PaymentMethodCreateParams into a Map that can be used to pre-fill the forms. Move into payments-ui-core so that Link also can use it.

Motivation

Load previously selected payment method when user returns to Link in the custom flow.
https://jira.corp.stripe.com/browse/MOBILESDK-863

Testing

  • Added tests
  • Modified tests
  • Manually verified

@github-actions
Copy link
Contributor

github-actions bot commented Jun 15, 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 MiB │   14 MiB │ +2.3 KiB │  46.7 MiB │  46.7 MiB │ +6.8 KiB 
     arsc │  1.7 MiB │  1.7 MiB │      0 B │   1.7 MiB │   1.7 MiB │      0 B 
 manifest │  3.5 KiB │  3.5 KiB │      0 B │  16.2 KiB │  16.2 KiB │      0 B 
      res │  821 KiB │  821 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 │     +6 B │     3 MiB │     3 MiB │     +6 B 
    other │ 79.9 KiB │ 79.9 KiB │      0 B │ 154.8 KiB │ 154.8 KiB │      0 B 
──────────┼──────────┼──────────┼──────────┼───────────┼───────────┼──────────
    total │ 22.1 MiB │ 22.1 MiB │ +2.3 KiB │  58.7 MiB │  58.7 MiB │ +6.8 KiB 

         │          raw           │              unique              
         ├────────┬────────┬──────┼────────┬────────┬────────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff           
─────────┼────────┼────────┼──────┼────────┼────────┼────────────────
   files │      4 │      4 │    0 │        │        │                
 strings │ 227193 │ 227236 │  +43 │ 197683 │ 197722 │ +39 (+105 -66) 
   types │  39655 │  39664 │   +9 │  36159 │  36165 │  +6 (+13 -7)   
 classes │  33521 │  33526 │   +5 │  33521 │  33526 │  +5 (+11 -6)   
 methods │ 203700 │ 203723 │  +23 │ 195696 │ 195716 │ +20 (+110 -90) 
  fields │ 152431 │ 152457 │  +26 │ 151404 │ 151430 │ +26 (+64 -38)  

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  293 │  293 │  0   
 entries │ 5794 │ 5794 │  0
APK
     compressed     │    uncompressed     │                               
─────────┬──────────┼──────────┬──────────┤                               
 size    │ diff     │ size     │ diff     │ path                          
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 3.3 MiB │ +1.7 KiB │    9 MiB │ +5.6 KiB │ ∆ classes2.dex                
 3.8 MiB │   +576 B │ 11.3 MiB │ +1.1 KiB │ ∆ classes3.dex                
 7.3 KiB │     +6 B │  7.2 KiB │     +6 B │ ∆ assets/dexopt/baseline.prof 
─────────┼──────────┼──────────┼──────────┼───────────────────────────────
 7.1 MiB │ +2.3 KiB │ 20.3 MiB │ +6.8 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff           
  ────────┼────────┼────────────────
   197683 │ 197722 │ +39 (+105 -66) 
  + �
  ���
  ���
  
  ���
  ���
  ���
  ������ 
  2�0�:�
  B���������0�¢����R�����0�X��¢�
  
  ��	������¨��
  + 
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  �7�2�0�:��B���������0�������0�¢����R�����0�X��¢��
  ������R�����0�X��¢��
  ���	�
  ���
  �¨��
  + ,
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  ������2�0�B�������0�������0�¢����J	����0HÖ�J��
  ��0�2�����0�2�����0HÖ�R�����0�X��¢��
  ������R�����0�X��¢��
  ���	�
  ¨��
  + :
  ���
  ���
  
  ���
  
  ���
  ���
  ��_
  ���
  ���
  
  ���
  
  ���
  
  ���
  ������2�0�B�������0�������0�������0�¢����J��������0�������0�0
  J	����0�HÖ�J�����0�2�����0�2�����0�HÖ�R�����0�X��¢��
  R�����0�X��¢��
  �����	R�����0�X��¢��
  ���
  ��¨��
  + <
  ���
  ���
  ���
  ���
  
  ���
  
  ���
  
  ���
  
  ��_
  ��
  
  ���
  
  ���
  ����Ç��2�0�B���¢����J�����0�2�����0�2�����0�H�J	�	��0
  H�J,��������0���������0�������0
  0��02�����0�H�J�����0�2�����0�2�����0
  HÖ�¨��
  + <
  ���
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  �����2�0�2�0�B�������0�������0�������0�¢���	J%����H�����*�0�2��������H�0�H�¢����R�����0�X��¢��
  R�����0�X��¢��
  R�����0�X��¢��
  R_�
  ������00�8�@�X�.¢��
  ���
  �������¨��
  + F
  
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ����%���0�2�����0�2�����0�2�����0�H�¢�����q���0�2��	��0�2��
  ��0�2����0�2��
  ��0�2�������0�2��������0�0�2��������0�0�2���������0�����0�0�¢����¢����H�¢�����
  ����0�H�¢����¨��
  + J
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ��
  ���
  ���
  
  ���
  ������� 62�0�:�67BO�������0�������0�������0��
  ��������0��
  ���	����0��
  ���
  ����0��
  �������0
  ¢����J�����0�HÀ�¢����J�����0�HÀ�¢����J�����0�HÀ�¢��� J��!����0�HÀ�¢���J��#����0�HÀ�¢���_J��%����0�HÀ�¢���&J��'����0
  HÀ�¢���(JW�)��02�������0�2�������0�2�������0�2
  ��������0�2
  ���	����0�2
  ���
  ����0�2
  �������0
  HÆ�J	�*��0+HÖ�J��,��0�2��-����0.HÖ�J	�/��0+HÖ�J	�0��0�HÖ�J��1��022��3��042��5��0+HÖ�R�����0�X��¢��
  ������R�������0�X��¢��
  ������R��	����0�X��¢��
  ������R������0
  X��¢��
  ������R�����0�X��¢��
  ������R��
  ����0�X��¢��
  ������R�����0�X��¢��
  ������¨�8
  + X
  ���
  ��
  
  ���
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  �����2�0�JF��������0�0�2�����0�2�����0�2�������0�2��	����0�H¦@ø�ø�ø��ø��¢���
  ��JD�������0�0�2��
  ��0�2�����0�2�����0�2��	����0�H¦@ø�ø�ø��ø��¢������JT��������0�0�2�����0�2�����0�2�����0�2�����0�2�����0�2�������0�H¦@ø�ø�ø��ø��¢������J<��������0�0�2�����0�2�����0�2�������0�H¦@ø�ø�ø��ø��¢����� J4�!������00�2�����0�2�������0�H¦@ø�ø�ø��ø��¢���#�_J>�%������0�0�2�����0�2�������0�2��	����0�H¦@ø�ø�ø��ø��¢���&� J6�'������0(0�2��
  ����0�2��	����0�H¦@ø�ø�ø��ø��¢���)�_J>�*������0�0�2�����0�2�������0�2��	����0�H¦@ø�ø�ø��ø��¢���+� J<�,������00�2��-��0.2�����0�2�������0�H¦@ø�ø�ø��ø��¢���/�0���
  ���
  ��!
  ��¡�0�¨�1
  + x
  ���
  ���
  
  ���
  ���
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ��
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ������2�0�BM��������������0�0��������
  ������0�0�������0�������0	�����
  ��0��������0
  ¢����JF��������0�0�2�����0�2�����0�2�������0�2�������0�H�@ø�ø�ø��ø��¢������JD��������0�0�2�����0�2�����0�2�����0�2�������0�H�@ø�ø�ø��ø��¢������JT��������0�0�2�����0 2��!��02��#��0�2��_��0%2�����0�2�������0�H�@ø�ø�ø��ø��¢���&�'J<�(������0)0�2��*��0�2�����0�2�������0�H�@ø�ø�ø��ø��¢���+�,J4�-������0.0�2�����0�2�������0�H�@ø�ø�ø��ø��¢���/�0J>�1������0�0�2�����0�2�������0�2�������0�H�@ø�ø�ø��ø��¢���2�,J6�3������040�2�������0�2�������0�H�@ø�ø�ø��ø��¢���5�0J>�6������0�0�2�����0�2�������0�2�������0�H�@ø�ø�ø��ø��¢���7�,J<�8������0.0�2��9��0:2�����0�2�������0�H�@ø�ø�ø��ø��¢���;�<R������0
  X��¢��
  R�����0	X��¢��
  R���������0�0�X��¢��
  R����
  ������0�0�X��¢��
  R�����0�X��¢��
  R��
  ��0�X��¢��
  ���
  ���
  ��!
  ��¡�0�¨�=
  + ¢�
  ���
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ��_
  ���
  ���
  �����2�0�:�CBE��������0�������0�����
...✂

# Conflicts:
#	link/src/main/java/com/stripe/android/link/ui/paymentmethod/PaymentMethodViewModel.kt
Copy link
Contributor

@skyler-stripe skyler-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

@brnunes-stripe brnunes-stripe merged commit b2dafb2 into master Jun 21, 2022
@brnunes-stripe brnunes-stripe deleted the brnunes/return branch June 21, 2022 18:17
@brnunes-stripe brnunes-stripe mentioned this pull request Jun 21, 2022
3 tasks
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