//void LoadOwnedConsumables() //{ // CreateOwnedPerchaseRequest(HuaweiConstants.IAP.IapType.CONSUMABLE, LoadOwnedNonConsumables); //} //void LoadOwnedNonConsumables() //{ // CreateOwnedPerchaseRequest(HuaweiConstants.IAP.IapType.NON_CONSUMABLE, LoadOwnedSubscribes); //} //void LoadOwnedSubscribes() //{ // CreateOwnedPerchaseRequest(HuaweiConstants.IAP.IapType.SUBSCRIPTION, ProductsLoaded); //} void CreateOwnedPerchaseRequest(HuaweiConstants.IAP.IapType type, System.Action onSuccess) { var ownedPurchasesReq = new OwnedPurchasesReq(); ownedPurchasesReq.PriceType = (int)type; var task = iapClient.ObtainOwnedPurchases(ownedPurchasesReq); task.AddOnSuccessListener((result) => { ParseOwned(result); onSuccess(); }); }
private void CreateProductRequest(List <string> consumablesIDs, HuaweiConstants.IAP.IapType type, System.Action onSuccess) { var productsDataRequest = new ProductInfoReq(); productsDataRequest.PriceType = (int)type; productsDataRequest.ProductIds = consumablesIDs; var task = iapClient.ObtainProductInfo(productsDataRequest); task.AddOnFailureListener(GetProductsFailure); task.AddOnSuccessListener((result) => { ParseProducts(result, type.ToString()); onSuccess(); }); }