braintree_ios icon indicating copy to clipboard operation
braintree_ios copied to clipboard

[V7] Add fallbackURLScheme support to PayPal app switch flow

Open ndrsKloss opened this issue 2 months ago • 9 comments

Summary of changes

We will give merchants a field to add a uri scheme for paypal to use as a backup if deeplink to merchant fails. Changes made include

  1. Adding the new parameter
  2. Sending up the value
  3. Checking if uri scheme value in BT validation on return.

Original PR: https://github.com/braintree/braintree_ios/pull/1673

This code was initially a reopen of https://github.com/braintree/braintree_ios/pull/1673, but as the repo underwent massive architectural changes, the cost-benefit of resolving merge conflicts proved to be higher than manually cherry-picking the changes and applying them in a new branch

Checklist

  • [x] Added a changelog entry
  • [x] Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.

  • @ndrsKloss

ndrsKloss avatar Nov 10 '25 17:11 ndrsKloss

can we add a CHANGELOG entry for this change? also it looks like there are a few lint errors and unit tests failing

agedd avatar Nov 12 '25 21:11 agedd

Do we need a companion PR for the 6.x branch for this as well?

jaxdesmarais avatar Nov 13 '25 15:11 jaxdesmarais

@agedd I will provide one soon.

@jaxdesmarais We will need but for now we are still doing an E2E, this PR servers to track any early merge conflicts. It can be changed to draft if it makes more sense.

ndrsKloss avatar Nov 13 '25 15:11 ndrsKloss

Gotcha @ndrsKloss lets convert this to a draft and add the do not review tag. That will make it easier for our team to see what is higher priority to review.

jaxdesmarais avatar Nov 13 '25 15:11 jaxdesmarais

I just removed fallbackURLScheme from the Checkout flow. The only leftover is:

protocol BTPayPalRequest {
    // ...
    func encodedPostBodyWith(
        configuration: BTConfiguration,
        isPayPalAppInstalled: Bool,
        universalLink: URL?,
        fallbackURLScheme: String?  // Required by protocol
    ) -> Encodable
}

This is because BTPayPalCheckoutRequest conforms to BTPayPalRequest, and the encodedPostBodyWith function in BTPayPalRequest requires its implementation as it is shared between both Checkout and Vault

ndrsKloss avatar Dec 11 '25 16:12 ndrsKloss

@ndrsKloss we can just add it to the Vault request if that is the case. The PayPalRequest is only for things shared across both requests.

jaxdesmarais avatar Dec 11 '25 16:12 jaxdesmarais

@jaxdesmarais removing it from BTPayPalRequest would break polymorphism in:

private func tokenize(request: BTPayPalRequest, ...) { }

ndrsKloss avatar Dec 11 '25 17:12 ndrsKloss

@jaxdesmarais removing it from BTPayPalRequest would break polymorphism in:

private func tokenize(request: BTPayPalRequest, ...) { }

That is not correct. There are many properties such as requestBillingAgreement that is only passed in the BTPayPalCheckoutRequest and is not a part of the protocol.

jaxdesmarais avatar Dec 11 '25 17:12 jaxdesmarais

Please, @jaxdesmarais, check if the latest commit aligns with your idea

ndrsKloss avatar Dec 11 '25 18:12 ndrsKloss

To ensure assertiveness, this PR will only address new changes once its counterpart (https://github.com/braintree/braintree_ios/pull/1690) has been merged

ndrsKloss avatar Dec 17 '25 13:12 ndrsKloss