private async void LoadTraps() { try { var response = await PurchaseApiService.ListAvailableTraps(); if (response != null) { availableTraps = response; LoadGooglePrices(); } else { progressDialog.Cancel(); HomeActivity homeActivity = (HomeActivity)Activity; homeActivity.OnSectionAttached(HomeActivity.HOME_MENU_INDEX, true); } if (!AppStatus.UserLogged.ContainsTraps()) { lbl_title_my_traps.Visibility = ViewStates.Gone; } } catch (Exception exception) { InsightsUtils.LogException(exception); } }
public async Task <BuyIntentApiRequest> InsertIntent(string productId) { BuyIntentApiRequest intent = new BuyIntentApiRequest() { StoreKey = productId }; await PurchaseApiService.InsertBuyIntent(intent); return(intent); }
private async void LoadAvailableTraps() { var response = await PurchaseApiService.ListAvailableTraps(); if (response != null) { availableTraps = response; LoadWindowsPrices(); } }
public async Task <bool> RegisterPurchase(BuyIntentApiRequest intent) { bool result = false; try { result = await PurchaseApiService.RegisterPurchase(intent); } catch (Exception exception) { InsightsUtils.LogException(exception); } return(result); }
public async void TryBuy(AvailableTrapApiResult availableTrap) { progressDialog = ProgressDialog.Show(Activity, Resources.GetString(MyTrap.Droid.Resource.String.loading), Resources.GetString(MyTrap.Droid.Resource.String.registering_purchase)); try { BuyIntentApiRequest intent = new BuyIntentApiRequest() { AvailableTrapId = availableTrap.Id, StoreKey = availableTrap.KeyGoogle }; await PurchaseApiService.InsertBuyIntent(intent); pendingBuyIntent = intent; Product product = null; foreach (var itemGoogle in products) { if (itemGoogle.ProductId == availableTrap.KeyGoogle) { product = itemGoogle; break; } } if (product != null) { //product.ProductId = "android.test.purchased"; //product.ProductId = "android.test.canceled"; //product.ProductId = "android.test.refunded"; //await RegisterPurchase(intent); _serviceConnection.BillingHandler.BuyProduct(product); } } catch (Exception exception) { InsightsUtils.LogException(exception); } progressDialog.Cancel(); }
public async void InvalidateBuyIntent(BuyIntentApiRequest intent) { await PurchaseApiService.InvalidateBuyIntent(intent); }