Skip to content

Commit

Permalink
address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
agedd committed Jan 22, 2025
1 parent 8e8275b commit 6017caa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
8 changes: 1 addition & 7 deletions Sources/BraintreePayPal/BTPayPalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,6 @@ import BraintreeDataCollector

switch approvalURL.redirectType {
case .payPalApp(let url):
guard let token = self.isVaultRequest ? approvalURL.baToken : approvalURL.ecToken else {
self.notifyFailure(
with: self.isVaultRequest ? BTPayPalError.missingBAToken : BTPayPalError.missingECToken,
completion: completion
)
return
}
self.launchPayPalApp(with: url, completion: completion)
case .webBrowser(let url):
self.handlePayPalRequest(with: url, paymentType: request.paymentType, completion: completion)
Expand All @@ -397,6 +390,7 @@ import BraintreeDataCollector
URLQueryItem(name: "source", value: "braintree_sdk"),
URLQueryItem(name: "switch_initiated_time", value: String(Int(round(Date().timeIntervalSince1970 * 1000))))
]

urlComponents?.queryItems?.append(contentsOf: additionalQueryItems)

guard let redirectURL = urlComponents?.url else {
Expand Down
14 changes: 7 additions & 7 deletions Sources/BraintreePayPal/BTPayPalError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public enum BTPayPalError: Error, CustomNSError, LocalizedError, Equatable {
/// 12. Missing BA Token for App Switch
case missingBAToken

/// 13. Missing EC Token for App Switch
case missingECToken

/// 13. Missing PayPal Request
case missingPayPalRequest

/// 14. Missing EC Token for App Switch
case missingECToken

public static var errorDomain: String {
"com.braintreepayments.BTPayPalErrorDomain"
Expand Down Expand Up @@ -80,9 +80,9 @@ public enum BTPayPalError: Error, CustomNSError, LocalizedError, Equatable {
return 11
case .missingBAToken:
return 12
case .missingECToken:
return 13
case .missingPayPalRequest:
return 13
case .missingECToken:
return 14
}
}
Expand Down Expand Up @@ -117,10 +117,10 @@ public enum BTPayPalError: Error, CustomNSError, LocalizedError, Equatable {
return "UIApplication failed to perform app switch to PayPal."
case .missingBAToken:
return "Missing BA Token for PayPal App Switch."
case .missingECToken:
return "Missing EC Token for PayPal App Switch."
case .missingPayPalRequest:
return "The PayPal Request was missing or invalid."
case .missingECToken:
return "Missing EC Token for PayPal App Switch."
}
}

Expand Down

0 comments on commit 6017caa

Please sign in to comment.