From f2867da61fb76f0fcd47b4897712fe9cdd5bf36a Mon Sep 17 00:00:00 2001 From: Andrii Vysotskyi Date: Wed, 18 Sep 2024 17:57:56 +0200 Subject: [PATCH] Simplify fingerprint handling --- .../DefaultCustomerActionsService.swift | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Sources/ProcessOut/Sources/Services/CustomerActions/DefaultCustomerActionsService.swift b/Sources/ProcessOut/Sources/Services/CustomerActions/DefaultCustomerActionsService.swift index b86324cb..fa9006b9 100644 --- a/Sources/ProcessOut/Sources/Services/CustomerActions/DefaultCustomerActionsService.swift +++ b/Sources/ProcessOut/Sources/Services/CustomerActions/DefaultCustomerActionsService.swift @@ -95,15 +95,10 @@ final class DefaultCustomerActionsService: CustomerActionsService { throw POFailure(message: message, code: .internal(.mobile), underlyingError: nil) } do { - let returnUrl = try await withTimeout( - Constants.webFingerprintTimeout, - error: POFailure(code: .timeout(.mobile)), - perform: { - try await self.webSession.authenticate(using: url) - } - ) - let queryItems = URLComponents(string: returnUrl.absoluteString)?.queryItems - return queryItems?.first { $0.name == "token" }?.value ?? "" + let timeoutError = POFailure(code: .timeout(.mobile)) + return try await withTimeout(Constants.webFingerprintTimeout, error: timeoutError) { + try await self.redirect(url: url.absoluteString) + } } catch let failure as POFailure where failure.code == .timeout(.mobile) { // Fingerprinting timeout is treated differently from other errors. let response = AuthenticationResponse(url: url, body: Constants.fingerprintTimeoutResponseBody)