Skip to content

Commit

Permalink
add warning if using custom with a client token
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxdesmarais committed Oct 4, 2024
1 parent 41b8315 commit 9e1a72e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Demo/Application/Base/ContainmentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class ContainmentViewController: UIViewController {
case .production:
tokenizationKey = "production_t2wns2y2_dfy45jdj3dxkmz5m"
case .custom:
// swiftlint:disable:next force_unwrapping
tokenizationKey = UserDefaults.standard.string(forKey: "BraintreeDemoSettingsCustomAuthorizationKey")!
}

Expand All @@ -171,6 +172,11 @@ class ContainmentViewController: UIViewController {
case .clientToken:
updateStatus("Fetching Client Token...")

if BraintreeDemoSettings.currentEnvironment == .custom {
updateStatus("Switch the Authorization Type in settings to Tokenization Key to use the custom environment")
return
}

BraintreeDemoMerchantAPIClient.shared.createCustomerAndFetchClientToken { clientToken, error in
if let error {
self.updateStatus(error.localizedDescription)
Expand Down

0 comments on commit 9e1a72e

Please sign in to comment.