From 207b5b4abd2206e329a5a8fc28200298666b4a6c Mon Sep 17 00:00:00 2001 From: Precious OSSAI Date: Tue, 26 Mar 2024 17:19:07 +0000 Subject: [PATCH] Pass correlation ID to risk SDK --- .github/workflows/codeql-analysis.yml | 32 ++++++++-- .../xcschemes/CheckoutTests.xcscheme | 11 +++- .../xcschemes/FramesTests.xcscheme | 25 ++++++++ Checkout.podspec | 2 +- Checkout/Samples/CocoapodsSample/Podfile | 3 +- .../project.pbxproj | 4 +- .../xcshareddata/swiftpm/Package.resolved | 11 ++-- .../Tokenisation/CheckoutAPIService.swift | 2 +- .../CheckoutAPIServiceIntegrationTests.swift | 2 +- Package.resolved | 4 +- Package.swift | 2 +- .../project.pbxproj | 4 +- .../xcshareddata/swiftpm/Package.resolved | 59 ------------------- iOS Example Frame/Podfile | 5 +- 14 files changed, 82 insertions(+), 84 deletions(-) delete mode 100644 iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 236762a39..32e4e1aee 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,10 +19,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + destination: "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest" + configuration: "Debug" + noIndex: "COMPILER_INDEX_STORE_ENABLE=NO" + noSigning: "CODE_SIGNING_ALLOWED=NO" + versionXcode: "15.2" + jobs: analyze: name: Analyze - runs-on: [ macos-latest ] + runs-on: [ macos-13-large ] permissions: actions: read contents: read @@ -45,24 +52,37 @@ jobs: with: languages: ${{ matrix.language }} queries: security-and-quality - + + - name: Select Xcode + run: | + sudo xcode-select -switch /Applications/Xcode_${versionXcode}.app + + - name: Log xcodebuild Version + run: | + xcodebuild -version + + - name: Build Frames run: | - xcodebuild -scheme Frames -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest" + xcodebuild -scheme Frames -destination "${destination}" "${noIndex}" "${noSigning}" | xcpretty + + - name: Build CheckoutTests + run: | + xcodebuild build -scheme CheckoutTests -destination "${destination}" "${noIndex}" "${noSigning}" | xcpretty - name: Build FramesTests run: | - xcodebuild -scheme FramesTests -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest" test + xcodebuild build -scheme FramesTests -destination "${destination}" "${noIndex}" "${noSigning}" | xcpretty - name: Build iOS Example Frame SPM run: | cd iOS\ Example\ Frame\ SPM - xcodebuild build -scheme iOS\ Example\ Frame -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest" + xcodebuild build -scheme iOS\ Example\ Frame -destination "${destination}" "${noIndex}" "${noSigning}" | xcpretty - name: Build UITest run: | cd iOS\ Example\ Frame\ SPM - xcodebuild -scheme UITest -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest" + xcodebuild -scheme UITest -destination "${destination}" "${noIndex}" "${noSigning}" | xcpretty # Perform analysis on the code - name: Analyze code with CodeQL diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/CheckoutTests.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/CheckoutTests.xcscheme index 0b5f0da47..e94d9d260 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/CheckoutTests.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/CheckoutTests.xcscheme @@ -8,7 +8,7 @@ @@ -53,6 +53,15 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> + + + + diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/FramesTests.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/FramesTests.xcscheme index 7401b5223..52abafc31 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/FramesTests.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/FramesTests.xcscheme @@ -5,6 +5,22 @@ + + + + + + + + + + diff --git a/Checkout.podspec b/Checkout.podspec index 37700c0a9..46c376e75 100644 --- a/Checkout.podspec +++ b/Checkout.podspec @@ -20,6 +20,6 @@ Pod::Spec.new do |s| s.exclude_files = "Checkout/Samples/**" s.dependency 'CheckoutEventLoggerKit', '~> 1.2.4' - s.dependency 'Risk', '2.0.1' + s.dependency 'Risk', '2.0.3' end diff --git a/Checkout/Samples/CocoapodsSample/Podfile b/Checkout/Samples/CocoapodsSample/Podfile index 7f336fb18..12e61fca2 100644 --- a/Checkout/Samples/CocoapodsSample/Podfile +++ b/Checkout/Samples/CocoapodsSample/Podfile @@ -5,6 +5,7 @@ target 'CheckoutCocoapodsSample' do use_frameworks! # Pods for CheckoutSDKCocoapodsSample - pod 'Checkout', '4.3.2' + # pod 'Checkout', '4.3.2' + pod 'Frames', :git => 'https://github.com/checkout/frames-ios', :branch => 'feature/pass-correlation-id-to-risk-sdk' end diff --git a/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.pbxproj b/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.pbxproj index 7f0690cd5..13f3f1714 100644 --- a/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.pbxproj +++ b/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.pbxproj @@ -511,8 +511,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/checkout/frames-ios"; requirement = { - kind = exactVersion; - version = 4.3.2; + branch = "feature/pass-correlation-id-to-risk-sdk"; + kind = branch; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 09eb31bc7..816b7fb75 100644 --- a/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Checkout/Samples/SPMSample/CheckoutSPMSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "7798b3f49dc3db57f852eea46d1454b7808add05a95e8d76dd9047b1be391a6f", "pins" : [ { "identity" : "checkout-event-logger-ios-framework", @@ -14,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/checkout/checkout-risk-sdk-ios.git", "state" : { - "revision" : "4823f05166dca8392a41b56b975515c7e0f1a8da", - "version" : "2.0.1" + "revision" : "a5df46ecd4324661459faa9e9ac18d627b4d26aa", + "version" : "2.0.3" } }, { @@ -32,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/checkout/frames-ios", "state" : { - "revision" : "2dae4f877e3a1882172c749e3bf4c32228b9d6a3", - "version" : "4.3.2" + "branch" : "feature/pass-correlation-id-to-risk-sdk", + "revision" : "0a0df16b3494aedfc176be64f5c3aca0398ab468" } }, { @@ -46,5 +47,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Checkout/Source/Tokenisation/CheckoutAPIService.swift b/Checkout/Source/Tokenisation/CheckoutAPIService.swift index 93b33d473..f8bfa4897 100644 --- a/Checkout/Source/Tokenisation/CheckoutAPIService.swift +++ b/Checkout/Source/Tokenisation/CheckoutAPIService.swift @@ -59,7 +59,7 @@ final public class CheckoutAPIService: CheckoutAPIProtocol { riskEnvironment = .sandbox } - let riskConfig = RiskConfig(publicKey: publicKey, environment: riskEnvironment, framesMode: true) + let riskConfig = RiskConfig(publicKey: publicKey, environment: riskEnvironment, framesMode: true, correlationId: logManager.correlationID) let riskSDK = Risk.init(config: riskConfig) logManager.setup( diff --git a/CheckoutTests/Integration/CheckoutAPIServiceIntegrationTests.swift b/CheckoutTests/Integration/CheckoutAPIServiceIntegrationTests.swift index dbc820a6e..f57c7095a 100644 --- a/CheckoutTests/Integration/CheckoutAPIServiceIntegrationTests.swift +++ b/CheckoutTests/Integration/CheckoutAPIServiceIntegrationTests.swift @@ -66,7 +66,7 @@ final class CheckoutAPIServiceIntegrationTests: XCTestCase { // details associated with default apple pay token let expectedApplePayDetails = ApplePayDetails( - expiryDate: try! CardValidator(environment: .sandbox).validate(expiryMonth: 3, expiryYear: 24).get(), + expiryDate: .init(month: 3, year: 2024), bin: "537426", last4: "7789" ) diff --git a/Package.resolved b/Package.resolved index b692b452c..20d1d9091 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/checkout/checkout-risk-sdk-ios.git", "state" : { - "revision" : "4823f05166dca8392a41b56b975515c7e0f1a8da", - "version" : "2.0.1" + "revision" : "a5df46ecd4324661459faa9e9ac18d627b4d26aa", + "version" : "2.0.3" } }, { diff --git a/Package.swift b/Package.swift index 6644d9da0..e90e1e0b4 100644 --- a/Package.swift +++ b/Package.swift @@ -20,7 +20,7 @@ let package = Package( exact: "3.5.9"), .package( url: "https://github.com/checkout/checkout-risk-sdk-ios.git", - exact: "2.0.1"), + exact: "2.0.3"), .package( url: "https://github.com/checkout/checkout-event-logger-ios-framework.git", from: "1.2.4" diff --git a/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.pbxproj b/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.pbxproj index a2e7152f4..e0f82c2da 100644 --- a/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.pbxproj +++ b/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.pbxproj @@ -1238,8 +1238,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/checkout/frames-ios"; requirement = { - kind = exactVersion; - version = 4.3.2; + branch = "feature/pass-correlation-id-to-risk-sdk"; + kind = branch; }; }; 16C3F83E2A7927ED00690639 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = { diff --git a/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 94ee63983..000000000 --- a/iOS Example Frame SPM/iOS Example Frame SPM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,59 +0,0 @@ -{ - "pins" : [ - { - "identity" : "checkout-event-logger-ios-framework", - "kind" : "remoteSourceControl", - "location" : "https://github.com/checkout/checkout-event-logger-ios-framework.git", - "state" : { - "revision" : "a914d754b4ffb1843730e8e1f8e7e60c4bf81cf9", - "version" : "1.2.4" - } - }, - { - "identity" : "checkout-risk-sdk-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/checkout/checkout-risk-sdk-ios.git", - "state" : { - "revision" : "4823f05166dca8392a41b56b975515c7e0f1a8da", - "version" : "2.0.1" - } - }, - { - "identity" : "fingerprintjs-pro-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/fingerprintjs/fingerprintjs-pro-ios", - "state" : { - "revision" : "ceb8b845ec99727ee9f78869a51688c6daa16bd8", - "version" : "2.2.0" - } - }, - { - "identity" : "frames-ios", - "kind" : "remoteSourceControl", - "location" : "https://github.com/checkout/frames-ios", - "state" : { - "revision" : "2dae4f877e3a1882172c749e3bf4c32228b9d6a3", - "version" : "4.3.2" - } - }, - { - "identity" : "phonenumberkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/marmelroy/PhoneNumberKit.git", - "state" : { - "revision" : "6edd6e38a30aec087cb97f7377edf876c29a427e", - "version" : "3.5.9" - } - }, - { - "identity" : "swift-snapshot-testing", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-snapshot-testing", - "state" : { - "revision" : "26ed3a2b4a2df47917ca9b790a57f91285b923fb", - "version" : "1.12.0" - } - } - ], - "version" : 2 -} diff --git a/iOS Example Frame/Podfile b/iOS Example Frame/Podfile index 030c976d5..0fd7aef6f 100644 --- a/iOS Example Frame/Podfile +++ b/iOS Example Frame/Podfile @@ -6,8 +6,9 @@ target 'iOS Example Frame' do use_frameworks! # Pods for iOS Example Custom - pod 'Frames', '4.3.2' - + # pod 'Frames', '4.3.2' + pod 'Frames', :git => 'https://github.com/checkout/frames-ios', :branch => 'feature/pass-correlation-id-to-risk-sdk' + end post_install do |installer|