Skip to content

Commit

Permalink
Merge pull request #66 from russell-archer/fix-transaction-finish
Browse files Browse the repository at this point in the history
fix-transaction-finish-all-cases
  • Loading branch information
russell-archer authored Feb 1, 2024
2 parents fce9ebe + 4fc07ba commit a7462f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/StoreHelper/Core/StoreHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,9 @@ public class StoreHelper: ObservableObject {
let transaction = checkResult.transaction
if let handler = transactionNotification { handler(.transactionReceived, transaction.productID, String(transaction.id)) }
StoreLog.transaction(.transactionReceived, productId: transaction.productID, transactionId: String(transaction.id))

// Finish the transaction for all cases, including access revoked, subscription expired, subscription upgraded and successful purchase
await transaction.finish()

if transaction.revocationDate != nil {
// The user's access to the product has been revoked by the App Store (e.g. a refund, etc.)
Expand Down Expand Up @@ -892,7 +895,6 @@ public class StoreHelper: ObservableObject {
StoreLog.transaction(.transactionSuccess, productId: transaction.productID, transactionId: String(transaction.id))
await self.updatePurchasedProducts(transaction: transaction, purchased: true)
if let handler = transactionNotification { handler(.transactionSuccess, transaction.productID, String(transaction.id)) }
await transaction.finish()
}
}
}
Expand Down

0 comments on commit a7462f1

Please sign in to comment.