public static async Task <ListingInformation> LoadListingInformationByProductIdsAsync(string[] ProductIds) { MockIAP.CheckIfInitialized(); ListingInformation listingInformation; if (!MockIAP.MockMode) { Windows.ApplicationModel.Store.ListingInformation li = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationByProductIdsAsync(ProductIds); listingInformation = new ListingInformation(li); } else { listingInformation = MockIAP.GetListingInformation(); listingInformation.ProductListings = new Dictionary <string, ProductListing>(); IEnumerable <string> result = from key in MockIAP.allProducts.Keys join pId in ProductIds on MockIAP.allProducts[key].ProductId equals pId select key; result.ToList().ForEach(k => listingInformation.ProductListings.Add(k, MockIAP.allProducts[k])); } return(listingInformation); }
public static void ReportProductFulfillment(string selectedProductId) { MockIAP.CheckIfInitialized(); if (!MockIAP.MockMode) { Windows.ApplicationModel.Store.CurrentApp.ReportProductFulfillment(selectedProductId); } else { MockIAP.ReportFulfillment(selectedProductId); } }
public static async Task <string> RequestProductPurchaseAsync(string ProductId, bool includeReceipt) { MockIAP.CheckIfInitialized(); string receipt; if (!MockIAP.MockMode) { receipt = await Windows.ApplicationModel.Store.CurrentApp.RequestProductPurchaseAsync(ProductId, includeReceipt); // Now we refresh the license information post purchase. LicenseInformation = new LicenseInformation(Windows.ApplicationModel.Store.CurrentApp.LicenseInformation); } else { receipt = MockIAP.SimulatePurchase(ProductId, includeReceipt); } return(receipt); }
public static async Task <ListingInformation> LoadListingInformationAsync() { MockIAP.CheckIfInitialized(); ListingInformation listingInformation; if (!MockIAP.MockMode) { Windows.ApplicationModel.Store.ListingInformation li = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationAsync(); listingInformation = new ListingInformation(li); LicenseInformation = new LicenseInformation(Windows.ApplicationModel.Store.CurrentApp.LicenseInformation); } else { listingInformation = MockIAP.GetListingInformation(); listingInformation.ProductListings = MockIAP.allProducts; } return(listingInformation); }
public static async Task <string> GetProductReceiptAsync(string selectedProductId) { MockIAP.CheckIfInitialized(); string receipt = null; if (!MockIAP.MockMode) { receipt = await Windows.ApplicationModel.Store.CurrentApp.GetProductReceiptAsync(selectedProductId); } else { var rs = new MockReceiptStore(); Dictionary <string, string> receipts = rs.EnumerateReceipts(); if (receipts.ContainsKey(selectedProductId)) { receipt = receipts[selectedProductId]; } } return(receipt); }