@@ -15,6 +15,8 @@ protocol WPComPlanProduct {
15
15
16
16
extension StoreKit . Product : WPComPlanProduct { }
17
17
18
+ typealias InAppPurchaseResult = StoreKit . Product . PurchaseResult
19
+
18
20
protocol InAppPurchasesForWPComPlansProtocol {
19
21
/// Retrieves asynchronously all WPCom plans In-App Purchases products.
20
22
///
@@ -33,7 +35,7 @@ protocol InAppPurchasesForWPComPlansProtocol {
33
35
/// id: the id of the product to be purchased
34
36
/// remoteSiteId: the id of the site linked to the purchasing plan
35
37
///
36
- func purchaseProduct( with id: String , for remoteSiteId: Int64 ) async throws
38
+ func purchaseProduct( with id: String , for remoteSiteId: Int64 ) async throws -> InAppPurchaseResult
37
39
38
40
/// Retries forwarding the product purchase to our backend, so the plan can be unlocked.
39
41
/// This can happen when the purchase was previously successful but unlocking the WPCom plan request
@@ -73,8 +75,8 @@ final class InAppPurchasesForWPComPlansManager: InAppPurchasesForWPComPlansProto
73
75
}
74
76
}
75
77
76
- func purchaseProduct( with id: String , for remoteSiteId: Int64 ) async throws {
77
- _ = try await withCheckedThrowingContinuation { continuation in
78
+ func purchaseProduct( with id: String , for remoteSiteId: Int64 ) async throws -> InAppPurchaseResult {
79
+ try await withCheckedThrowingContinuation { continuation in
78
80
stores. dispatch ( InAppPurchaseAction . purchaseProduct ( siteID: remoteSiteId, productID: id, completion: { result in
79
81
continuation. resume ( with: result)
80
82
} ) )
0 commit comments