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 Alipay integration #5554

Merged
merged 6 commits into from
Sep 19, 2022
Merged

Fix Alipay integration #5554

merged 6 commits into from
Sep 19, 2022

Conversation

brnunes-stripe
Copy link
Contributor

@brnunes-stripe brnunes-stripe commented Sep 14, 2022

Summary

Fix Alipay integration when using the Alipay SDK.
We were trying to parse the response of the call to nextActionData.authCompleteUrl to a JSON object, when the response is not necessarily in JSON format.
Add example activities to test the native and web integrations.

Motivation

RUN_APAC_PAYMENT_METHODS-6838

Testing

  • Added tests
  • Modified tests
  • Manually verified
alipay.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 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.8 MiB │ 15.8 MiB │ +85 B │  53.4 MiB │  53.4 MiB │ -28 B 
     arsc │  1.8 MiB │  1.8 MiB │   0 B │   1.8 MiB │   1.8 MiB │   0 B 
 manifest │  4.1 KiB │  4.1 KiB │   0 B │  18.9 KiB │  18.9 KiB │   0 B 
      res │    1 MiB │    1 MiB │   0 B │   1.8 MiB │   1.8 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 │  +4 B │     3 MiB │     3 MiB │  +4 B 
    other │ 81.8 KiB │ 81.8 KiB │   0 B │ 155.7 KiB │ 155.7 KiB │   0 B 
──────────┼──────────┼──────────┼───────┼───────────┼───────────┼───────
    total │ 24.2 MiB │ 24.2 MiB │ +89 B │    66 MiB │    66 MiB │ -24 B 

         │          raw           │           unique            
         ├────────┬────────┬──────┼────────┬────────┬───────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff      
─────────┼────────┼────────┼──────┼────────┼────────┼───────────
   files │      4 │      4 │    0 │        │        │           
 strings │ 256009 │ 256009 │    0 │ 219027 │ 219027 │ 0 (+4 -4) 
   types │  45047 │  45047 │    0 │  41440 │  41440 │ 0 (+0 -0) 
 classes │  38623 │  38623 │    0 │  38623 │  38623 │ 0 (+0 -0) 
 methods │ 224993 │ 224993 │    0 │ 217254 │ 217254 │ 0 (+0 -0) 
  fields │ 164383 │ 164383 │    0 │ 163429 │ 163429 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  334 │  334 │  0   
 entries │ 6242 │ 6242 │  0
APK
   compressed    │  uncompressed   │                                
─────────┬───────┼─────────┬───────┤                                
 size    │ diff  │ size    │ diff  │ path                           
─────────┼───────┼─────────┼───────┼────────────────────────────────
 2.4 MiB │ +85 B │ 7.4 MiB │ -28 B │ ∆ classes3.dex                 
   667 B │  +4 B │   535 B │  +4 B │ ∆ assets/dexopt/baseline.profm 
─────────┼───────┼─────────┼───────┼────────────────────────────────
 2.4 MiB │ +89 B │ 7.4 MiB │ -24 B │ (total)
DEX
STRINGS:

   old    │ new    │ diff      
  ────────┼────────┼───────────
   219027 │ 219027 │ 0 (+4 -4) 
  + ´�
  ���
  ��
  ���
  ���
  
  ���
  ���
  ��
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��	
  ���
  ���
  ���
  ���
  ���
  
  �� 
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��
  
  ���
  ���
  ���
  ����'�2�0�B�¢����JK������0�2�����0�2�����0�2��������0�0	2��
  ��0�2�����0�2����0
  H @ø�¢������J3������0�2�����0�2�����0�2�����0�2����0
  H§@ø�¢����J3������0�2�����0�2�����0�2�����0�2����0
  H§@ø�¢����JA������0�2�����0�2�����0�2��������0�0	2�����0�2����0
  H§@ø�¢����J-������0�2�����0�2��
  ��0�2�����0
  H @ø�¢����� J-�!����0�2�����0�2��
  ��0�2�����0
  H @ø�¢���� J%�#����0_2��
  ��0�2����0
  H @ø�¢���%�&J5�'����0(2��)��0�2��*��0�2��+����0�2����0
  H§@ø�¢����J5�,����0�2��-��0.2�����0
  2����/������0�00H @ø�¢���1�2J5�3����0�2��4��052�����0
  2����/������0�00H @ø�¢���6�7JY�8����0(2��9��0�2��:��0�2��;��0�2��<����0�2��=����0>2��+����0�2��?��0@2����0
  H§@ø�¢���AJ#�B��0C2��D��0E2����0
  H @ø�¢���F�GJ#�H����0I2��)��0�2����0
  H§@ø�¢���&J+�J����0K2��)��0�2��L��0M2����0
  H§@ø�¢���NJ+�J����0K2��)��0�2��O��0�2����0
  H§@ø�¢��� J-�P����0I2�����0�2��Q��0R2����0
  H @ø�¢���S�TJ#�U����0�2��V��0W2�����0
  H§@ø�¢���XJ��Y����0Z2����0
  H @ø�¢���[�\J-�]����0I2�����0�2��Q��0R2����0
  H @ø�¢���^�TJ%�_����0�2����0a2�����0
  H @ø�¢���b�cJ%�d����0e2��f��0g2�����0
  H @ø�¢���h�iJC�j����0�2�����0�2�����0�2��������0�0	2��
  ��0�2����0
  H @ø�¢���k��J)�l��0m2��)��0�2��n��0�2����0
  H§@ø�¢��� J9�o����0�2�����0�2��������0�0	2�����0�2����0
  H§@ø�¢���pJ%�q����0r2��s��0t2�����0
  H @ø�¢���u�vJ��w��0x2�����0
  H @ø�¢���y�\J=�z������0�002��{��0|2�����0�2��������0�0	2����0
  H§@ø�¢���}J2�~����0K2��)��0�2��������0�0	2����0
  H§@ø�¢�����J.�������0(2��)��0�2��+����0�2����0
  H§@ø�¢��� J1�������0��2��9����0�2��+����0�2����0
  H§@ø�¢��� J'�������0�2�����0�2�����0
  H¡@ø�¢������&J7�������0��2�����0�2��������0�0	2����0
  H @ø�¢��������J:�������0�2������0�2������0�2������0�2����0
  H @ø�¢�������J-����	����0�0��2������0�2����0
  H @ø�¢������&J5�������0�2�����0�2�����0
  2����/������0�00H§@ø�¢�����J.�������0��2�����0�2�����0
  2��=��0>H§@ø�¢�����J5�������0�2�����0�2�����0
  2����/������0�00H§@ø�¢�����J.�������0��2�����0�2�����0
  2��=��0>H§@ø�¢�����J/�������0�2��
  ��0�2�����0�2�����0
  H @ø�¢������ J7�����0��2�����0�2�����0
  2����/������0�00H @ø�¢��������JI�������0��2�����0�2�����0�2��������0�0	2������0 �2����0
  H @ø�¢���¡��¢�JN�£�����0��2�����0�2�����0�2��������0�0	2��
  ��0�2�����0�2����0
  H @ø�¢���¤���J*�¥�����0_2��¦���0§�2����0
  H @ø�¢���¨��©�J7�ª�����0(2��)��0�2��=��0>2��+����0�2����0
  H§@ø�¢���«�JB�¬���0m2������0�2��­���0�2������0�2������0�2����0
  H @ø�¢���®��¯�J/�°�����0K2��)��0�2��±���0²�2����0
  H§@ø�¢���³�J9�´�����0�2�����0�2��µ���0¶�2��·���0¶�2����0
  H§@ø�¢���¸�J-�´�����0�2�����0�2��¹���0�2����0
  H§@ø�¢��� J9�º�����0�2�����0�2��µ���0¶�2��·���0¶�2����0
  H§@ø�¢���¸�J-�º�����0�2�����0�2��¹���0�2����0
  H§@ø�¢��� ���
  ���¨�»�
  + �
  ���
  ���
  
  ���
  
  ���
  ���
  
  ���
  
  ��
  
  ���
  
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  
  ���
  
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  �� 
  ���
  ���
  ���
  ���
  
  ���
  ���
  ��_
  ��
  
  ���
  
  ���
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ���
  ��
  
  ���
  ���
  ���
  ��	��� ��2�0�:�����BQ��������0�������������0�0���������0������	������0�0
  ������0���
  ��0�������0�¢����B£���������0����������0�0��
  ��������0���������0���������0������	������0�0
  ��������0������
  ��0���������0���������0��������0�������������0�0
  ��������0���������0�¢����JK�&����0'2��(��0�2��)��0�2�	������0�0
  2��*��0�2��+��0�2��,��0-H�@ø�¢���.�/J3�0����012��2��0�2��3��0�2��4��0�2��,��0-H�@ø�¢���5J3�6����072��2��0�2��8��0�
...✂

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.

LGTM

# Conflicts:
#	CHANGELOG.md
tillh-stripe
tillh-stripe previously approved these changes Sep 14, 2022
updateStatus("\n\nUser canceled confirmation")
else ->
updateStatus(
"\n\nPayment failed or canceled." +
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems last time I checked, an in-app web browser would be opened if we cancel the native flow, seems that's no longer happening with the recording, could you elaborate a bit why that happened?

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 removed line 32 here, and have a PR updating the documentation.
When the user completes the payment in the Alipay app, the PI status will be Suceeded. If they cancel, it will be RequiresAction.
Calling Stripe.handleNextActionForPayment would try to confirm again, using a webview. That's not what we want, since the user just canceled. The docs are also not showing how to handle the result of that call, which is handled in onActivityResult.

@brnunes-stripe brnunes-stripe merged commit 974fbaf into master Sep 19, 2022
@brnunes-stripe brnunes-stripe deleted the brnunes/alipay branch September 19, 2022 17:33
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