diff --git a/Sources/Purchasing/StoreKitAbstractions/PromotionalOffer.swift b/Sources/Purchasing/StoreKitAbstractions/PromotionalOffer.swift index 5ec1ae2ef5..b71a2761e1 100644 --- a/Sources/Purchasing/StoreKitAbstractions/PromotionalOffer.swift +++ b/Sources/Purchasing/StoreKitAbstractions/PromotionalOffer.swift @@ -122,11 +122,20 @@ extension PromotionalOffer.SignedData { @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) var sk2PurchaseOption: Product.PurchaseOption { + let signature: Data + + if let decoded = Data(base64Encoded: self.signature) { + signature = decoded + } else { + // TODO: log warning + signature = .init() + } + return .promotionalOffer( offerID: self.identifier, keyID: self.keyIdentifier, nonce: self.nonce, - signature: self.signature.asData, + signature: signature, timestamp: self.timestamp ) } diff --git a/Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift b/Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift index 6fedc13517..718589face 100644 --- a/Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift +++ b/Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift @@ -377,8 +377,6 @@ class StoreKit1IntegrationTests: BaseBackendIntegrationTests { @available(iOS 15.2, tvOS 15.2, macOS 12.1, watchOS 8.3, *) func testPurchaseWithPromotionalOffer() async throws { try AvailabilityChecks.iOS15APIAvailableOrSkipTest() - try XCTSkipIf(Self.storeKit2Setting == .enabledForCompatibleDevices, - "This test is not currently passing on SK2") let user = UUID().uuidString