Changes for toggling app switch for checkout
Reason for changes
- Implement app switch if opted in, eligible or no errors in app launch
Summary of changes
- Create appSwitchIfEligible property in PayPalWebCheckoutRequest
- Toggle existing paypal web checkout with app switch if eligible flow
- If not app switch launched, fallback to web checkout flow
TODO: unit tests
Checklist
- [ ] Added a changelog entry
Authors
List GitHub usernames for everyone who contributed to this pull request.
- @KunJeongPark
I pushed this as a working draft of app switch for paypal web checkout. I have working version of app switch for both web checkout and vaulting locally that I did as a POC. I kept the singleton class for routing incoming universal links back to the merchant app (similar to Braintree's BTAppContextSwitcher) lightweight since we have pending testing for different flows.
I want to separate out the PRs for readability and so reviews are not overwhelming and so unit tests don't have to be duplicated, rewritten for vault vs web checkout functionalities.
I will keep this PR as a draft and open other PRs in this order:
- further demo app changes to support vault without purchase app switch => I just finished testing out payload for app switch for this flow.
- demo app changes to enable toggling for app switch with request objects that toggle app switch
- handleURLRequest function in PayPalWebCheckoutClient that handles incoming universal links from vault and checkout, unit tests
- PayPalWebCheckoutClient changes to implement logic of toggling ASWebSession flow and app switch flow for both start and vault functions.
- lightweight singleton class to route the incoming URLs from app switch (allow future extensions to support Venmo app switch).
- New analytic events and errors
I may change order of #4 and #5 depending on what is the best path for unit testing. There may be changes after further discussions with checkout team members. I've posted questions about some scenarios and technical details on backend implementations based on behavior I observed during testing on my POC.