diff --git a/Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift b/Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift index ab2702224..558b8fbf0 100644 --- a/Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift +++ b/Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift @@ -43,12 +43,11 @@ struct BTVenmoAppSwitchRedirectURL { "braintree_environment": environment, "resource_id": paymentContextID, "braintree_sdk_data": base64EncodedBraintreeData ?? "", - "customerClient": "MOBILE_APP" + "customerClient": "MOBILE_APP", + "x-success": universalLink.appendingPathComponent("success").absoluteString, + "x-error": universalLink.appendingPathComponent("error").absoluteString, + "x-cancel": universalLink.appendingPathComponent("cancel").absoluteString ] - - queryParameters["x-success"] = universalLink.appendingPathComponent("success").absoluteString - queryParameters["x-error"] = universalLink.appendingPathComponent("error").absoluteString - queryParameters["x-cancel"] = universalLink.appendingPathComponent("cancel").absoluteString } // MARK: - Internal Methods diff --git a/Sources/BraintreeVenmo/BTVenmoAppSwitchReturnURL.swift b/Sources/BraintreeVenmo/BTVenmoAppSwitchReturnURL.swift index 569054b53..dded4671b 100644 --- a/Sources/BraintreeVenmo/BTVenmoAppSwitchReturnURL.swift +++ b/Sources/BraintreeVenmo/BTVenmoAppSwitchReturnURL.swift @@ -69,6 +69,5 @@ struct BTVenmoAppSwitchReturnURL { /// - Returns: `true` if the url represents a Venmo Touch app switch return static func isValid(url: URL) -> Bool { (url.scheme == "https" && (url.path.contains("cancel") || url.path.contains("success") || url.path.contains("error"))) - || (url.host == "x-callback-url" && url.path.hasPrefix("/vzero/auth/venmo/")) } } diff --git a/Sources/BraintreeVenmo/BTVenmoClient.swift b/Sources/BraintreeVenmo/BTVenmoClient.swift index 0eceba7ba..92eccb24e 100644 --- a/Sources/BraintreeVenmo/BTVenmoClient.swift +++ b/Sources/BraintreeVenmo/BTVenmoClient.swift @@ -56,6 +56,8 @@ import BraintreeCore /// - universalLink: The URL for the Venmo app to redirect to after user authentication completes. Must be a valid HTTPS URL dedicated to Braintree app switch returns. @objc(initWithAPIClient:universalLink:) public init(apiClient: BTAPIClient, universalLink: URL) { + BTAppContextSwitcher.sharedInstance.register(BTVenmoClient.self) + self.apiClient = apiClient self.universalLink = universalLink }