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

Merge PayPal App Switch feature branch #1335

Merged
merged 49 commits into from
Jun 12, 2024
Merged

Conversation

scannillo
Copy link
Contributor

Summary of changes

  • These changes were already reviewed as sub-PRs
  • This PR is to trigger CI checks

Checklist

  • Added a changelog entry

Authors

@scannillo @jaxdesmarais @stechiu

jaxdesmarais and others added 30 commits March 5, 2024 13:11
* Add "Universal Link Flow" button to PayPal Web demo app - this button with open a page that will allow us to return to the app on tapping "open"
* This PR is a proof of concept that our demo app can be set up for universal linking, follow up PRs to this feature branch will build on this work
* Add BTAppContextSwitcher.sharedInstance.universalLink property
* Parse path in return URL SceneDelegate method
…1218)

* Conform BTPayPalClient to BTAppContextSwitchClient
* Add BTPayPalAppSwitchReturnURL struct
* Add Unit Tests
* Add BTPayPalVault.enablePayPalAppSwitch property
* Add new BTPayPalVaultBaseRequest - this allows us to only use the new property in the PayPal Web flow and cannot be accessed in the PayPal Native Checkout module
…L Type (#1232)

* Replace BTAppContextSwitcher.sharedInstance.universalLink with init: BTPayPalVaultRequest(userAuthenticationEmail:enablePayPalAppSwitch:universalLink:offerCredit:)
* Add implementation to BTPayPalAppSwitchReturnURL
* Rename BTPayPalClient.handleBrowserSwitchReturn to handleReturn since it will be used for both app switch and ASWeb returns
* Add implementation for handleReturnURL for App Switch flows
* Add new BTPayPalError.unknownAppSwitchError and update typo on invalidURL error
* Add BTPayPalAppSwitchReturnURL_Tests
* Add new BTPayPalClient_Tests for new code
* Handle Success or Failure of application.open via invokedOpenURLSuccessfully
* Add TODOs for future analytics PR
* Add new BTPayPalError.appSwitchFailed
* Add appInstalled check if enablePayPalAppSwitch=true, fallback to existing tokenize() flow if not

Co-authored-by: Jax DesMarais-Leder <[email protected]>
…l` Parsing (#1250)

* Our demo app URL for universal linking of https://braintree-ios-demo.fly.dev/braintree-payments has been allowlisted so we can update PayPalWebCheckoutViewController with this
* In BTPayPalApprovalURLParser we were parsing paypalAppApprovalUrl from paymentResource (Checkout) when it should be parsed from agreementSetup (Vault) - verified via breakpoints and our contracts that this nesting should be updated
* Updated tests with this correction
* Updated tokenization key

* Added `payPalClient` to `universalLinkFlow` method
* Send link_type and paypal_installed in event_params when available to FPTI for the PayPal flow
# Conflicts:
#	CHANGELOG.md
#	Sources/BraintreePayPal/BTPayPalAnalytics.swift
#	UnitTests/BraintreePayPalTests/BTPayPalAnalytics_Tests.swift
* add missing BA token to query parameters for app switch flow
* update test
* Update Braintree-Demo-Info.plist with proper scheme name - currently our check for isPayPalAppInstalled was always returning false because we need the scheme added to the plist for the demo app
* If we got a paypalAppApprovalUrl back we were always app switching, this would cause issues if the isPayPalAppInstalled check returned false and the app truly wasn't installed, I tested this by removing the app and ensuring we fell back to web with the new logic - it can also be tested by updating the BTPayPalClient.payPalInAppScheme to something like "badscheme"
* updates to move ReturnURL logic to one place
* update fallback logic to handle properly
* update plist for app installed check
* add webBrowser based BTPayPalReturnURL tests
* PR feedback: update docstrings and enum name
* print nonce to status bar and allow to be copied for E2E testing
* clear nonce between sessions after copied
scannillo and others added 19 commits April 15, 2024 10:46
* Previous PR comment: https://github.com/braintree/braintree_ios/pull/1265/files#r1562730080
* For the PayPal App Switch flow we only ever want a BA token currently, separate out logic to check only for BA token in this flow
* Check that BA Token is present before attempting to start the App Switch flow, if not throw an error
* Add new BTPayPalError.missingBAToken
* Add unit test for this updated logic
# Conflicts:
#	Braintree.xcodeproj/project.pbxproj
#	CHANGELOG.md
#	Demo/Demo.entitlements
#	Sources/BraintreeCore/Analytics/BTAnalyticsService.swift
#	Sources/BraintreeCore/Analytics/FPTIBatchData.swift
#	Sources/BraintreePayPal/BTPayPalClient.swift
#	UnitTests/BraintreeCoreTests/Analytics/FPTIBatchData_Tests.swift
#	UnitTests/BraintreeCoreTests/Analytics/FakeAnalyticsService.swift
* replace universal link URL with heroku URL
* remove old URL from Demo.entitlements
* Add ability to test app switch in stage, production, and sandbox
* Add "App Switch Staging Env" toggle for testing in the staging environment
* Sandbox and Production are being rolled out today/tomorrow and we want the ability to continue to test stage as well as Sandbox/Production concurrently
* update logic for payPalInstalled to align with venmo; update tests
* move app installed checks into a UIApplication extension
* remove stage logic from PayPalWebCheckoutViewController
# Conflicts:
#	Braintree.xcodeproj/project.pbxproj
#	CHANGELOG.md
#	Sources/BraintreePayPal/BTPayPalClient.swift
#	UnitTests/BraintreePayPalTests/BTPayPalClient_Tests.swift
# Conflicts:
#	CHANGELOG.md
#	Sources/BraintreePayPal/BTPayPalClient.swift
* move universalLink into BTPayPalClient init
* update PayPalWebCheckoutViewController
* update UnitTests
* update CHANGELOG
@scannillo scannillo marked this pull request as ready for review June 12, 2024 19:35
@scannillo scannillo requested a review from a team as a code owner June 12, 2024 19:35
@scannillo scannillo merged commit 666fa3b into main Jun 12, 2024
6 of 7 checks passed
@scannillo scannillo deleted the paypal-app-switch-feature branch June 12, 2024 20:06
@scannillo
Copy link
Contributor Author

Verified UI tests passed locally

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.

3 participants