public async Task <IHttpActionResult> InvalidateBuyIntent(BuyIntentApiRequest request)
        {
            BuyIntentRequest buyIntentRequest = Mapper.Map <BuyIntentRequest>(request);

            await AppBusiness.Purchase.DenyBuyIntent(buyIntentRequest);

            return(Ok(new BaseApiResult()));
        }
        public async Task <IHttpActionResult> RegisterPurchase(BuyIntentApiRequest request)
        {
            BuyIntentRequest buyIntentRequest = Mapper.Map <BuyIntentRequest>(request);

            UserResult userResult = await AppBusiness.Purchase.ConfirmBuyIntent(buyIntentRequest);

            UserApiResult response = Mapper.Map <UserApiResult>(userResult);

            return(Ok(response));
        }
Ejemplo n.º 3
0
        public async Task <BuyIntentApiRequest> InsertIntent(string productId)
        {
            BuyIntentApiRequest intent = new BuyIntentApiRequest()
            {
                StoreKey = productId
            };

            await PurchaseApiService.InsertBuyIntent(intent);

            return(intent);
        }
        public async Task <IHttpActionResult> InsertBuyIntent(BuyIntentApiRequest request)
        {
            request.UserId = (await GetUser()).Id;

            BuyIntentRequest buyIntentRequest = Mapper.Map <BuyIntentRequest>(request);

            BuyIntentResult buyIntentResult = await AppBusiness.Purchase.RegisterBuyIntent(buyIntentRequest);

            BuyIntentApiResult response = Mapper.Map <BuyIntentApiResult>(buyIntentResult);

            return(Ok(response));
        }
Ejemplo n.º 5
0
        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 static async Task <bool> RegisterPurchase(BuyIntentApiRequest request)
        {
            var result = false;

            var response = await HttpController.PostData <UserApiResult>(ApiMethods.RegisterPurchase(), request);

            if (ResponseValidator.Validate(response))
            {
                result = true;

                UserApiService.SaveUserLogged(response);

                result = true;
            }

            return(result);
        }
Ejemplo n.º 7
0
        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 static async Task <bool> InvalidateBuyIntent(BuyIntentApiRequest request)
        {
            bool result = false;

            try
            {
                var response = await HttpController.PostData <BaseApiResult>(ApiMethods.InvalidateBuyIntent(), request);

                if (ResponseValidator.Validate(response))
                {
                    result = true;
                }
            }
            catch (Exception)
            {
                result = false;
            }

            return(result);
        }
Ejemplo n.º 9
0
 public async void InvalidateBuyIntent(BuyIntentApiRequest intent)
 {
     await PurchaseApiService.InvalidateBuyIntent(intent);
 }