Skip to content

Commit

Permalink
chore: update review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erenbesel committed Feb 9, 2024
1 parent 7e1a7f3 commit 63016fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 11 additions & 11 deletions Adyen/Analytics/AnalyticsProvider/AnalyticsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ internal final class AnalyticsProvider: AnalyticsProviderProtocol {
additionalFields: additionalFields,
context: configuration.context)

fetchCheckoutAttemptId(with: analyticsData)
}

private func fetchCheckoutAttemptId(with initialAnalyticsData: AnalyticsData) {
let initialAnalyticsRequest = InitialAnalyticsRequest(data: initialAnalyticsData)
let initialAnalyticsRequest = InitialAnalyticsRequest(data: analyticsData)

uniqueAssetAPIClient.perform(initialAnalyticsRequest) { [weak self] result in
switch result {
case let .success(response):
self?.checkoutAttemptId = response.checkoutAttemptId
case .failure:
self?.checkoutAttemptId = nil
}
self?.saveCheckoutAttemptId(from: result)
}
}

private func saveCheckoutAttemptId(from result: Result<InitialAnalyticsResponse, Error>) {
switch result {
case let .success(response):
checkoutAttemptId = response.checkoutAttemptId
case .failure:
checkoutAttemptId = nil
}
}
}
2 changes: 0 additions & 2 deletions Adyen/Analytics/Models/AnalyticsData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ internal struct AnalyticsData: Encodable {
self.component = type
case let .components(type):
self.component = type.rawValue
default:
self.component = ""
}
}
}

0 comments on commit 63016fd

Please sign in to comment.