Skip to content

Commit

Permalink
cleanup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxdesmarais committed Dec 18, 2024
1 parent fcebabb commit 573a07a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/BraintreeVenmo/BTVenmoAppSwitchReturnURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/"))
}
}
2 changes: 2 additions & 0 deletions Sources/BraintreeVenmo/BTVenmoClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 573a07a

Please sign in to comment.