diff --git a/Sources/BraintreeCore/BTJSON.swift b/Sources/BraintreeCore/BTJSON.swift index 5f7abbef48..fc15208f51 100644 --- a/Sources/BraintreeCore/BTJSON.swift +++ b/Sources/BraintreeCore/BTJSON.swift @@ -219,7 +219,7 @@ import Foundation /// The `BTJSON` as a `URL` /// - Returns: A `URL` representing the `BTJSON` instance public func asURL() -> URL? { - guard let urlString = value as? String, urlString.utf8.count == urlString.utf16.count else { + guard let urlString = value as? String else { return nil } return URL(string: urlString) diff --git a/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift b/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift index 76bb5d1060..d1fa0e53b2 100644 --- a/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift +++ b/UnitTests/BraintreeSEPADirectDebitTests/BTSEPADirectDebitClient_Tests.swift @@ -179,6 +179,12 @@ class BTSEPADirectDebitClient_Tests: XCTestCase { ] ) + mockWebAuthenticationSession.cannedErrorResponse = NSError( + domain: BTSEPADirectDebitError.errorDomain, + code: BTSEPADirectDebitError.approvalURLInvalid.errorCode, + userInfo: ["Description": "Mock approvalURLInvalid error description."] + ) + let sepaDirectDebitClient = BTSEPADirectDebitClient( apiClient: mockAPIClient, webAuthenticationSession: mockWebAuthenticationSession,