Skip to content

Commit

Permalink
Merge pull request #28 from checkout/PRISM-11139-accept-correlation-i…
Browse files Browse the repository at this point in the history
…d-on-frames-mode-on-risk-i-os

PRISM-11139 - Log correlationId on frames mode
  • Loading branch information
precious-ossai-cko authored Mar 26, 2024
2 parents f28b137 + d958f7c commit a5df46e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/partial-readmes/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ We've done our best to support the most common distribution methods on iOS. We a
let package = Package(
...
dependencies: [
.package(url: "https://github.com/checkout/checkout-risk-sdk-ios", from: "2.0.2")
.package(url: "https://github.com/checkout/checkout-risk-sdk-ios", from: "<latest_version>")
]
...
)
Expand All @@ -34,7 +34,7 @@ platform :ios, '12.0'
use_frameworks!

target '<Your Target Name>' do
pod 'Risk', '~> 2.0.2'
pod 'Risk', '~> <latest_version>'
end
```

Expand Down
2 changes: 1 addition & 1 deletion Risk.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Risk"
s.version = "2.0.2"
s.version = "2.0.3"
s.summary = "Checkout Risk package in Swift"
s.description = <<-DESC
Checkout Risk package in Swift.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Risk/Logging/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

enum Constants {
static let productName = "risk-ios-sdk"
static let riskSdkVersion = "2.0.2"
static let riskSdkVersion = "2.0.3"
static let userAgent = "checkout-sdk-risk-ios/\(riskSdkVersion)"
static let loggerTypeIdentifier = "com.checkout.risk-mobile-sdk"
}
2 changes: 2 additions & 0 deletions Sources/Risk/Logging/LoggerService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ extension LoggerServiceProtocol {
case .published, .collected:
properties = [
"Block": AnyCodable(latencyMetric.block),
"CorrelationId": AnyCodable(internalConfig.correlationId),
"DeviceDataPersist": AnyCodable(latencyMetric.deviceDataPersist),
"FpLoad": AnyCodable(latencyMetric.fpload),
"FpPublish": AnyCodable(latencyMetric.fppublish),
Expand All @@ -85,6 +86,7 @@ extension LoggerServiceProtocol {
case .publishFailure, .loadFailure, .publishDisabled:
properties = [
"Block": AnyCodable(latencyMetric.block),
"CorrelationId": AnyCodable(internalConfig.correlationId),
"DeviceDataPersist": AnyCodable(latencyMetric.deviceDataPersist),
"FpLoad": AnyCodable(latencyMetric.fpload),
"FpPublish": AnyCodable(latencyMetric.fppublish),
Expand Down
2 changes: 2 additions & 0 deletions Sources/Risk/Models/RiskSDKInternalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ struct RiskSDKInternalConfig {
let sourceType: SourceType
let framesMode: Bool
let environment: RiskEnvironment
let correlationId: String

init(config: RiskConfig) {
merchantPublicKey = config.publicKey
environment = config.environment
framesMode = config.framesMode
correlationId = config.framesMode ? config.correlationId : ""
integrationType = framesMode ? .inFrames : .standalone
sourceType = framesMode ? .cardToken : .riskSDK

Expand Down
4 changes: 3 additions & 1 deletion Sources/Risk/RiskSDKConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public struct RiskConfig {
let publicKey: String
let environment: RiskEnvironment
let framesMode: Bool
let correlationId: String

public init(publicKey: String, environment: RiskEnvironment, framesMode: Bool = false) {
public init(publicKey: String, environment: RiskEnvironment, framesMode: Bool = false, correlationId: String = "") {
self.publicKey = publicKey
self.environment = environment
self.framesMode = framesMode
self.correlationId = correlationId
}
}

0 comments on commit a5df46e

Please sign in to comment.