public static void Init() { if (initalized) { return; } _appLicenseInformation = new LicenseInformation { ExpirationDate = DateTimeOffset.Now, IsActive = true, IsTrial = false, ProductLicenses = new Dictionary <string, ProductLicense>() }; StateInformation = new MockReceiptState(); initalized = true; string mocklist_url = "http://iap.azurewebsites.net/GetProductsByAppID.php?id=" + CurrentApp.AppId; WebClient client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(LoadListComplete); client.DownloadStringAsync(new Uri(mocklist_url)); }
public void Initialize() { if (Initialized == false) { if (StoreConfig.STORE_TEST_MODE) { SoomlaUtils.LogDebug(TAG, "WARNING You are running in Store Test Mode! Don't forget to disable the test mode before you publish the app."); SetupMockIAP(); licInfosMock = MockCurApp.LicenseInformation; } else { licInfos = CurApp.LicenseInformation; } marketProductInfos = new Dictionary <string, MarketProductInfos>(); //LoadListingInfo(); Initialized = true; } }
public static void Init() { if (initalized) { return; } _appLicenseInformation = new LicenseInformation { ExpirationDate = DateTimeOffset.Now, IsActive = true, IsTrial = false, ProductLicenses = new Dictionary <string, ProductLicense>() }; StateInformation = new MockReceiptState(); initalized = true; }
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 void Initialize() { if(Initialized==false) { if (StoreConfig.STORE_TEST_MODE) { SoomlaUtils.LogDebug(TAG, "WARNING You are running in Store Test Mode! Don't forget to disable the test mode before you publish the app."); SetupMockIAP(); licInfosMock = MockCurApp.LicenseInformation; } else { licInfos = CurApp.LicenseInformation; } marketProductInfos = new Dictionary<string, MarketProductInfos>(); //LoadListingInfo(); Initialized = true; } }
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 <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); }
private async void DoPurchase(string productId) { try { bool licenceActiv = false; if (StoreConfig.STORE_TEST_MODE) { // Kick off purchase; don't ask for a receipt when it returns await MockCurApp.RequestProductPurchaseAsync(productId, false); licInfosMock = MockCurApp.LicenseInformation; licenceActiv = licInfosMock.ProductLicenses[productId].IsActive; } else { // Kick off purchase; don't ask for a receipt when it returns await CurApp.RequestProductPurchaseAsync(productId, false); licInfos = CurApp.LicenseInformation; licenceActiv = licInfos.ProductLicenses[productId].IsActive; } if (licenceActiv) { OnItemPurchasedCB(productId); } else { SoomlaUtils.LogDebug(TAG, "Purchase cancelled " + productId); OnItemPurchaseCancelCB(productId, false); } } catch (Exception ex) { // When the user does not complete the purchase (e.g. cancels or navigates back from the Purchase Page), an exception with an HRESULT of E_FAIL is expected. SoomlaUtils.LogDebug(TAG, ex.Message); OnItemPurchaseCancelCB(productId, true); } }
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; }
private async void DoPurchase(string productId) { try { bool licenceActiv = false; if (StoreConfig.STORE_TEST_MODE) { // Kick off purchase; don't ask for a receipt when it returns await MockCurApp.RequestProductPurchaseAsync(productId, false); licInfosMock = MockCurApp.LicenseInformation; licenceActiv = licInfosMock.ProductLicenses[productId].IsActive; } else { // Kick off purchase; don't ask for a receipt when it returns await CurApp.RequestProductPurchaseAsync(productId, false); licInfos = CurApp.LicenseInformation; licenceActiv = licInfos.ProductLicenses[productId].IsActive; } if (licenceActiv) { OnItemPurchasedCB(productId); } else { SoomlaUtils.LogDebug(TAG,"Purchase cancelled " + productId); OnItemPurchaseCancelCB(productId, false); } } catch (Exception ex) { // When the user does not complete the purchase (e.g. cancels or navigates back from the Purchase Page), an exception with an HRESULT of E_FAIL is expected. SoomlaUtils.LogDebug(TAG,ex.Message); OnItemPurchaseCancelCB(productId, true); } }