diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2063a3ad..51c7b3a0cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Braintree iOS SDK Release Notes ## unreleased +* BraintreeThreeDSecure + * Add error code and error message for `exceededTimeoutLimit` * Prevent duplicate outbound `v1/configuration` requests ## 6.23.0 (2024-07-15) diff --git a/Sources/BraintreeThreeDSecure/BTThreeDSecureError.swift b/Sources/BraintreeThreeDSecure/BTThreeDSecureError.swift index b3d407c876..c445354151 100644 --- a/Sources/BraintreeThreeDSecure/BTThreeDSecureError.swift +++ b/Sources/BraintreeThreeDSecure/BTThreeDSecureError.swift @@ -29,6 +29,9 @@ public enum BTThreeDSecureError: Error, CustomNSError, LocalizedError, Equatable /// 8. Deallocated BTThreeDSecureClient case deallocated + /// 9. 3D Secure was idle and exceeded timout limit + case exceededTimeoutLimit + public static var errorDomain: String { "com.braintreepayments.BTThreeDSecureFlowErrorDomain" } @@ -53,6 +56,8 @@ public enum BTThreeDSecureError: Error, CustomNSError, LocalizedError, Equatable return 7 case .deallocated: return 8 + case .exceededTimeoutLimit: + return 9 } } @@ -76,6 +81,8 @@ public enum BTThreeDSecureError: Error, CustomNSError, LocalizedError, Equatable return [NSLocalizedDescriptionKey: "The request could not be serialized."] case .deallocated: return [NSLocalizedDescriptionKey: "BTThreeDSecureClient has been deallocated."] + case .exceededTimeoutLimit: + return [NSLocalizedDescriptionKey: "User exceeded timeout limit."] } } diff --git a/Sources/BraintreeThreeDSecure/BTThreeDSecureV2Provider.swift b/Sources/BraintreeThreeDSecure/BTThreeDSecureV2Provider.swift index 476bdbf1eb..cf07d8ad28 100644 --- a/Sources/BraintreeThreeDSecure/BTThreeDSecureV2Provider.swift +++ b/Sources/BraintreeThreeDSecure/BTThreeDSecureV2Provider.swift @@ -121,15 +121,17 @@ extension BTThreeDSecureV2Provider: CardinalValidationDelegate { forResult: lookupResult, completion: completionHandler ) - case .error, .timeout: - let userInfo = [NSLocalizedDescriptionKey: validateResponse.errorDescription] + case .error: + let errorUserInfo = [NSLocalizedDescriptionKey: validateResponse.errorDescription] var errorCode: Int = BTThreeDSecureError.unknown.errorCode if validateResponse.errorNumber == 1050 { errorCode = BTThreeDSecureError.failedAuthentication("").errorCode } apiClient.sendAnalyticsEvent(BTThreeDSecureAnalytics.challengeFailed) - completionHandler(nil, NSError(domain: BTThreeDSecureError.errorDomain, code: errorCode, userInfo: userInfo)) + completionHandler(nil, NSError(domain: BTThreeDSecureError.errorDomain, code: errorCode, userInfo: errorUserInfo)) + case .timeout: + completionHandler(nil, BTThreeDSecureError.exceededTimeoutLimit) case .cancel: completionHandler(nil, BTThreeDSecureError.canceled) default: