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 country code to PaymentIntent and SetupIntent #5472

Merged
merged 5 commits into from Aug 26, 2022

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Aug 26, 2022

Summary

This pull request adds the country code to StripeIntent.

Motivation

This will be needed for the name collection in Link.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

🙅

Changelog

Nothing to add.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 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 │  15.4 MiB │  15.4 MiB │ +271 B │    52 MiB │    52 MiB │ +860 B 
     arsc │   1.8 MiB │   1.8 MiB │    0 B │   1.8 MiB │   1.8 MiB │    0 B 
 manifest │     4 KiB │     4 KiB │    0 B │  18.5 KiB │  18.5 KiB │    0 B 
      res │ 873.3 KiB │ 873.3 KiB │    0 B │   1.4 MiB │   1.4 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 │  81.7 KiB │  81.7 KiB │    0 B │ 155.6 KiB │ 155.6 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  23.6 MiB │  23.6 MiB │ +265 B │  64.1 MiB │  64.1 MiB │ +854 B 

         │          raw           │             unique             
         ├────────┬────────┬──────┼────────┬────────┬──────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff         
─────────┼────────┼────────┼──────┼────────┼────────┼──────────────
   files │      4 │      4 │    0 │        │        │              
 strings │ 251154 │ 251155 │   +1 │ 214161 │ 214162 │ +1 (+27 -26) 
   types │  44341 │  44341 │    0 │  40703 │  40703 │  0 (+0 -0)   
 classes │  37900 │  37900 │    0 │  37900 │  37900 │  0 (+0 -0)   
 methods │ 221725 │ 221729 │   +4 │ 213721 │ 213725 │ +4 (+33 -29) 
  fields │ 162975 │ 162980 │   +5 │ 161933 │ 161938 │ +5 (+5 -0)   

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  292 │  292 │  0   
 entries │ 6232 │ 6232 │  0
APK
    compressed    │   uncompressed   │                               
─────────┬────────┼─────────┬────────┤                               
 size    │ diff   │ size    │ diff   │ path                          
─────────┼────────┼─────────┼────────┼───────────────────────────────
 2.2 MiB │ +271 B │ 6.9 MiB │ +860 B │ ∆ classes3.dex                
 8.7 KiB │   -6 B │ 8.6 KiB │   -6 B │ ∆ assets/dexopt/baseline.prof 
─────────┼────────┼─────────┼────────┼───────────────────────────────
 2.3 MiB │ +265 B │ 6.9 MiB │ +854 B │ (total)
DEX
STRINGS:

   old    │ new    │ diff         
  ────────┼────────┼──────────────
   214161 │ 214162 │ +1 (+27 -26) 
  + �
  ���
  ��
  ���
  ���
  ��	����2�0�B���¢����R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R��	��0�X�T¢��
  R��
  ��0�X�T¢��
  R�����0�X�T¢��
  R����0�X�T¢��
  ¨�
  + �
  ���
  ��
  ���
  ���
  �������2�0�B���¢����R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R��	��0�X�T¢��
  R��
  ��0�X�T¢��
  R�����0�X�T¢��
  R����0�X�T¢��
  R��
  ��0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  ¨��
  + �
  ���
  ��
  ���
  ���
  �������2�0�B���¢����R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R��	��0�X�T¢��
  R��
  ��0�X�T¢��
  R�����0�X�T¢��
  R����0�X�T¢��
  R��
  ��0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  R�����0�X�T¢��
  ¨��
  + t
  ���
  ���
  
  ���
  
  ���
  
  ��	
  ���
  ���
  
  ���
  ���
  �� 
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��
  ���
  ���
  
  ���
  ������� ^2�0�:�\]^_B³����������0���������0�������0���������0����	����0����
  ����0�������0�
  ���
  ����0���������0����������0�0���������0���������0��
  ��������0����������0�0����������0�0���������0�¢����J��=����0�HÆ�J��>������0�0�HÆ�J��?����0�HÆ�J��@����0�HÆ�J��A����0�HÆ�J��B������0�0�HÆ�J��C������0�0�HÆ�J��D����0�HÆ�J��E����0�HÆ�J	�F��0�HÆ�J��G����0�HÆ�J��H����0�HÆ�J��I����0�HÆ�J	�J��0HÆ�J��K����0�HÆ�J��L����0�HÆ�JÑ��M��02
  ��������0�2
  ��������0�2�������0�2
  ��������0�2
  ���	����0�2
  ���
  ����0�2�������02
  ���
  ����0�2
  ��������0�2�����������0�0�2
  ��������0�2
  ��������0�2
  ��������0�2�����������0�0�2�����������0�0�2
  ��������0�HÆ�J	�N��0OHÖ�J��P��02��Q����0RHÖ�J	�S��0OHÖ�J��T��0H�J��U��0H�J	�V��0�HÖ�J��W��0X2��Y��0Z2��[��0OHÖ�R�������0�¢��
  ������R��	����0�X��¢��
  ����� R�������0�8�¢��
  ���!� R�����0�X��¢��
  ����#R��
  ����0�X��¢��
  ���_� R�������0�X��¢��
  ���%� R��&��08VX��¢�����&�'R�����0X��¢��
  �����'R��(����0�8VX��¢�����)� R�������0�¢��
  ���*�+R���������0�0�X��¢��
  ���,�-R�������0�X��¢��
  ���.�/R��0����018VX��¢�����2�3R��
  ����0�X��¢��
  ���4�5R�������0�X��¢��
  ���6� R���������0�0�X��¢��
  ���7�-R�������0�X��¢��
  ���8�9R���������0�0�X��¢��
  ���:�-R�������0�¢��
  ���;�<¨�
  + ��
  ���
  ���
  
  ���
  
  �� 
  
  ��	
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ��)
  ���
  ���
  ��
  
  ��_
  ���
  ���
  ���
  ���
  
  ���
  ��	���� ��2�0�:���������������B�����������0����������0�0���������0���������0��
  ���	����0
  ��������0���
  ����0���������0���������0�������0���������0��
  ��������0�������0��
  ��������0��
  ��������0��
  ��������0��
  ��������0��
  ��������0��
  ��������0��
  ��� ����0!��������0�0������#������0�0��
  ���_����0%�
  ���&����0�¢���'J��T����0�HÆ�J	�U��0�HÆ�J��V����0�HÆ�J��W����0�HÆ�J	�X��0�HÆ�J��Y����0�HÆ�J��Z����0�HÆ�J��[����0�HÆ�J��\����0�HÆ�J��]����0�HÆ�J��^����0�HÆ�J��_������0�0�HÆ�J������0!HÆ�J��a������0�0�HÆ�J��b������0�0�HÆ�J��c����0%HÆ�J��d����0�HÂ�J��e����0�HÆ�¢���)J	�f��0�HÆ�J��g����0
  HÆ�J	�h��0HÆ�J��i����0�HÆ�J	�j��0�HÆ�J��k����0�HÆ�J°��l��02
  ��������0�2�����������0�0�2
  ��������0�2�������0�2
  ���	����0
  2�������02
  ���
  ����0�2�������0�2
  ��������0�2�������0�2
  ��������0�2
  ��������0�2�������0�2
  ��������0�2
  ��������0�2
  ��������0�2
  ��������0�2
  ��������0�2
  ��������0�2
  ��� ����0!2����������0�0�2����#������0�0�2
  ���_����0%2
  ���&����0�HÆ�¢���mJ	�n��0oHÖ�J��p��0�2��q����0rHÖ�J��s������0�������0r0tJ	�u��0oHÖ�J��v��0�2
  �w��0�j�xH�J��y��0�H�J��z��0�H�J��{��0�H�J	�|��0�HÖ�J��}��0~2�����0��2������0oHÖ�R�������0�¢�
  
  ��*���(�)R�����0�¢��
  ���+�,R��	����0
  ¢��
  ���-�.R�����0¢��
  ���/�0R��
  ����0�X��¢��
  ���1�2R�����0�¢��
  ���3�4R�������0�8�¢��
  ���5�2R�����0�X��¢��
  ���6�,R�������0�¢��
  ���7�2R�������0�X��¢��
  ���8�2R�������0�X��¢��
  ���9�2R��:��0�8VX��¢�����:�;R�����0�X��¢��
  �����;R��<����0�8VX��¢�����=�2R�������0�¢��
  ���>�?R��#������0�0�X��¢��
  ���@�AR��_����0%X��¢��
  ���B�CR��D����0E8VX��¢�����F�GR
...✂

Copy link
Contributor

@jameswoo-stripe jameswoo-stripe left a comment

Choose a reason for hiding this comment

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

Where is the country_code coming from? I don't see it in the public docs.

@tillh-stripe
Copy link
Collaborator Author

tillh-stripe commented Aug 26, 2022

@jameswoo-stripe You’re right — it’s not a public field, but something we fetch via paymentMethodPreference on the elements/sessions endpoint (see the logic in PaymentMethodPreferenceJsonParser).

Since it’s not a field in the public API of a payment/setup intent, should I make this an internal field?

@jameswoo-stripe
Copy link
Contributor

Yea, that makes more sense to be internal. Also, let's add some tests to test the parsing using fixtures.

Having the country code as a library-internal property in StripeIntent isn't easy right now. We're adding it as separate properties in SetupIntent and PaymentIntent for now, before we think about ways to refactor StripeIntent.
@tillh-stripe
Copy link
Collaborator Author

We chatted about this on Zoom.

TL;DR: Adding countryCode as a library-internal property on StripeIntent isn’t straightforward. We’ll add it as properties to SetupIntent and PaymentIntent (but not StripeIntent) for now, and will look to refactor this later.

@tillh-stripe tillh-stripe changed the title Add country code to StripeIntent Add country code to PaymentIntent and SetupIntent Aug 26, 2022
@tillh-stripe tillh-stripe merged commit 3966968 into master Aug 26, 2022
@tillh-stripe tillh-stripe deleted the tillh/stripe-intent-add-country-code branch August 26, 2022 19:59
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

3 participants