Skip to content

Commit

Permalink
Add PayPalConstanst enum
Browse files Browse the repository at this point in the history
  • Loading branch information
richherrera committed Jan 9, 2025
1 parent b903ba2 commit 44d61f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Sources/BraintreePayPal/BTPayPalRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ protocol PayPalRequest {
var userPhoneNumber: BTPayPalPhoneNumber? { get }
}

enum PayPalRequestConstants {
static let callbackURLHostAndPath = "onetouch/v1/"
}
2 changes: 1 addition & 1 deletion Sources/BraintreePayPal/BTPayPalReturnURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct BTPayPalReturnURL {

/// If we are using the deeplink/ASWeb based PayPal flow we want to check that the host and path matches
/// the static callbackURLHostAndPath. For the universal link flow we do not care about this check.
if hostAndPath != BTPayPalRequest.callbackURLHostAndPath && linkType == .deeplink {
if hostAndPath != PayPalRequestConstants.callbackURLHostAndPath && linkType == .deeplink {
return false
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/BraintreePayPal/Models/PayPalCheckoutPOSTBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ struct PayPalCheckoutPOSTBody: Encodable {
}

self.userPhoneNumber = payPalRequest.userPhoneNumber
self.returnURL = BTCoreConstants.callbackURLScheme + "://\(BTPayPalRequest.callbackURLHostAndPath)success"
self.cancelURL = BTCoreConstants.callbackURLScheme + "://\(BTPayPalRequest.callbackURLHostAndPath)cancel"
self.returnURL = BTCoreConstants.callbackURLScheme + "://\(PayPalRequestConstants.callbackURLHostAndPath)success"
self.cancelURL = BTCoreConstants.callbackURLScheme + "://\(PayPalRequestConstants.callbackURLHostAndPath)cancel"
self.experienceProfile = PayPalExperienceProfile(payPalRequest: payPalRequest, configuration: configuration)
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/BraintreePayPal/Models/PayPalVaultPOSTBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct PayPalVaultPOSTBody: Encodable {
}

self.userPhoneNumber = payPalRequest.userPhoneNumber
self.returnURL = BTCoreConstants.callbackURLScheme + "://\(BTPayPalRequest.callbackURLHostAndPath)success"
self.cancelURL = BTCoreConstants.callbackURLScheme + "://\(BTPayPalRequest.callbackURLHostAndPath)cancel"
self.returnURL = BTCoreConstants.callbackURLScheme + "://\(PayPalRequestConstants.callbackURLHostAndPath)success"
self.cancelURL = BTCoreConstants.callbackURLScheme + "://\(PayPalRequestConstants.callbackURLHostAndPath)cancel"
self.experienceProfile = PayPalExperienceProfile(payPalRequest: payPalRequest, configuration: configuration)

if let universalLink, payPalRequest.enablePayPalAppSwitch, isPayPalAppInstalled {
Expand Down

0 comments on commit 44d61f4

Please sign in to comment.