public IEnumerable <PlanView> GetPlans()
        {
            SetStripeKey();
            var planService = new StripePlanService();
            StripeList <StripePlan> planItems = planService.List(
                new StripePlanListOptions()
            {
                Limit = _maximumItemsToReturn
            }
                );
            var jsonPlans = planItems
                            .Select(p => new PlanView {
                Id = p.Id, Name = p.Nickname, Currency = p.Currency, Amount = p.Amount, Interval = p.Interval, ProductId = p.ProductId
            })
                            .ToList();

            return(jsonPlans);
        }
        public IEnumerable <SkuView> GetSkus()
        {
            SetStripeKey();
            var skuService = new StripeSkuService();
            StripeList <StripeSku> skuItems = skuService.List(
                new StripeSkuListOptions
            {
                Limit = _maximumItemsToReturn
            }
                );

            var jsonProducts = skuItems
                               .Select(p => new SkuView {
                Id = p.Id, Price = p.Price, ProductId = p.ProductId, Currency = p.Currency
            });

            return(jsonProducts);
        }
        public IEnumerable <ProductView> GetProducts()
        {
            SetStripeKey();
            var productService = new StripeProductService();
            StripeList <StripeProduct> productItems = productService.List(
                new StripeProductListOptions()
            {
                Limit = _maximumItemsToReturn
            }
                );

            var jsonProducts = productItems
                               .Select(p => new ProductView {
                Id = p.Id, Name = p.Name, Type = p.Type
            });

            return(jsonProducts);
        }
Exemple #4
0
        public async Task <List <IdResponseModel> > GetAllCardsAsync(int userId)
        {
            var user = await EnsureCustomerCreatedAsync(userId);

            SetStripeApiKey();

            StripeList <Card> cards = null;

            try
            {
                cards = await new CardService()
                        .ListAsync(user.Profile.StripeCustomerId);
            }
            catch (StripeException ex)
            {
                throw new CustomException(HttpStatusCode.BadRequest, "Stripe", ex.Message);
            }

            return(cards.Select(i => new IdResponseModel {
                Id = i.Id
            }).ToList());
        }