Exemplo n.º 1
0
        public PlanServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new PlanService(this.StripeClient);

            this.createOptions = new PlanCreateOptions
            {
                Amount   = 123,
                Currency = "usd",
                Interval = "month",
                Nickname = "Plan Nickmame",
                Product  = new PlanProductCreateOptions
                {
                    Name = "Product Name",
                },
            };

            this.updateOptions = new PlanUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new PlanListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 2
0
        public PlanServiceTest()
        {
            this.service = new PlanService();

            this.createOptions = new PlanCreateOptions
            {
                Amount   = 123,
                Currency = "usd",
                Interval = "month",
                Nickname = "Plan Nickmame",
                Product  = new PlanProductCreateOptions
                {
                    Name = "Product Name",
                },
            };

            this.updateOptions = new PlanUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new PlanListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 3
0
        public PlanServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new PlanService(this.StripeClient);

            this.createOptions = new PlanCreateOptions
            {
                AmountDecimal = 0.01234567890m, // Ensure decimals work
                Currency      = "usd",
                Interval      = "month",
                Nickname      = "Plan Nickmame",
                Product       = new PlanProductCreateOptions
                {
                    Name = "Product Name",
                },
            };

            this.createDecimalTierOptions = new PlanCreateOptions
            {
                Currency = "usd",
                Interval = "month",
                Nickname = "Plan Nickmame",
                Product  = new PlanProductCreateOptions
                {
                    Name = "Product Name",
                },
                Tiers = new List <PlanTierOptions>
                {
                    new PlanTierOptions
                    {
                        UnitAmountDecimal = 0.04m,
                        UpTo = 10,
                    },
                    new PlanTierOptions
                    {
                        UnitAmountDecimal = 0.03m,
                        UpTo = PlanTierUpTo.Inf,
                    },
                },
            };

            this.updateOptions = new PlanUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new PlanListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 4
0
        public virtual async Task <Plan> Update(string planId, PlanUpdateOptions updateOptions)
        {
            var url = string.Format("{0}/{1}", Urls.Plans, planId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Plan> .MapFromJson(response));
        }