-
Notifications
You must be signed in to change notification settings - Fork 294
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
[QL] Parse App Switch Return URL #1237
Conversation
# Conflicts: # Sources/BraintreePayPal/BTPayPalVaultRequest.swift
@@ -73,7 +78,7 @@ public enum BTPayPalError: Error, CustomNSError, LocalizedError, Equatable { | |||
case .httpPostRequestError(let error): | |||
return "HTTP POST request failed with \(error)." | |||
case .invalidURL(let error): | |||
return "An error occured with retrieving a PayPal authentication URL: \(error)" | |||
return "An error occurred with retrieving a PayPal URL: \(error)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a typo here and also are using this error for URLs outside of authentication so updated this string.
Were you able to test with any stubbed redirect URL (using our demo apps fly.io site)? I'm curious if |
…valid; update docstring; update localizedDescription
I was able to test this and there were no issues with the HTTPS path, since we are mainly parsing the data from that path to send into
We can really only test pieces of this so far until we actually start getting the expected data back, but working off of our mocks this should work as expected 🤞. Let me know if I misunderstood what you were thinking we'd test here, did a lot of very hacky workarounds based on mocks to test different pieces. 😅 |
@@ -368,7 +382,7 @@ import BraintreeDataCollector | |||
hostAndPath.append("/") | |||
} | |||
|
|||
if hostAndPath != BTPayPalRequest.callbackURLHostAndPath { | |||
if hostAndPath != BTPayPalRequest.callbackURLHostAndPath && (payPalRequest as? BTPayPalVaultRequest)?.universalLink == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why we add the check for universalLink
being nil
here 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, we only care about (and want to return false here for isValidURLAction
) if the hostAndPath
is not the callbackURLHostAndPath
and if the universalLink
is nil. That combination would mean that we aren't using the UL flow and the hostAndPath
is invalid we wouldn't have a valid URL action. If we are using the UL flow we can essentially skip this check since it's not relevant to that flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is a little confusing to read IMO. I think it will clear up in DTBTSDK-3751
@@ -368,7 +382,7 @@ import BraintreeDataCollector | |||
hostAndPath.append("/") | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have some return URL parsing happening in BTPayPalClient
and some happening in BTPayPalAppSwitchReturnURL
. Maybe for another PR, we can repurpose BTPayPalAppSwitchReturnURL
to do URL parsing for both the web flow & app switch flows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created DTBTSDK-3751 for this
UnitTests/BraintreePayPalTests/BTPayPalAppSwitchReturnURL_Tests.swift
Outdated
Show resolved
Hide resolved
UnitTests/BraintreePayPalTests/BTPayPalAppSwitchReturnURL_Tests.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few minor comments, looks good to me!
/// The timestamp from the return URL. | ||
var timestamp: String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment here, we aren't using this.
This surfaces that we need to ask the analytics folks what they want us to do with this number, let's ask them! They may want us including it in an additional analytic event send
Co-authored-by: scannillo <[email protected]>
…s.swift Co-authored-by: agedd <[email protected]>
…s.swift Co-authored-by: agedd <[email protected]>
Summary of changes
BTPayPalAppSwitchReturnURL
BTPayPalClient.handleBrowserSwitchReturn
tohandleReturn
since it will be used for both app switch and ASWeb returnshandleReturnURL
for App Switch flowsBTPayPalError.unknownAppSwitchError
and update typo oninvalidURL
errorBTPayPalAppSwitchReturnURL_Tests
BTPayPalClient_Tests
for new codeChecklist
[ ] Added a changelog entryAuthors