From 226c6d9ae708bf08037e3bd4af24c1cc014c634e Mon Sep 17 00:00:00 2001 From: Gio Date: Wed, 3 May 2023 14:04:10 -0500 Subject: [PATCH] make product non nil in send(receipt) method --- .../PremiumUpgrade/Model/ReceiptService.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PocketKit/Sources/PocketKit/PremiumUpgrade/Model/ReceiptService.swift b/PocketKit/Sources/PocketKit/PremiumUpgrade/Model/ReceiptService.swift index e2bb9c1eb..361221bb2 100644 --- a/PocketKit/Sources/PocketKit/PremiumUpgrade/Model/ReceiptService.swift +++ b/PocketKit/Sources/PocketKit/PremiumUpgrade/Model/ReceiptService.swift @@ -5,7 +5,7 @@ import SharedPocketKit /// Generic type to send subscription receipt to a server public protocol ReceiptService { - func send(_ product: Product?) async throws + func send(_ product: Product) async throws } public enum ReceiptError: LoggableError { @@ -36,7 +36,7 @@ class AppStoreReceiptService: NSObject, ReceiptService { super.init() } - func send(_ product: Product?) async throws { + func send(_ product: Product) async throws { // on simulators, we typically use a local test environment, and don't want // to send the receipt to the backend #if targetEnvironment(simulator) @@ -52,10 +52,10 @@ class AppStoreReceiptService: NSObject, ReceiptService { let transactionInfo = try getReceipt() let source = "itunes" - let productId = product?.id ?? "" - let amount = product?.price != nil ? "\(product!.price)" : "" - let transactionType = product != nil ? "purchase" : "restore" - let currency = product?.priceFormatStyle.currencyCode ?? "" + let productId = product.id + let amount = "\(product.price)" + let transactionType = "purchase" + let currency = product.priceFormatStyle.currencyCode try await client.sendAppstoreReceipt( source: source,