public SessionServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new SessionService(this.StripeClient);

            this.createOptions = new SessionCreateOptions
            {
                CancelUrl         = "https://stripe.com/cancel",
                ClientReferenceId = "1234",
                LineItems         = new List <SessionLineItemOptions>
                {
                    new SessionLineItemOptions
                    {
                        Amount      = 1234,
                        Currency    = "usd",
                        Description = "item1",
                        Images      = new List <string>
                        {
                            "https://stripe.com/image1",
                        },
                        Name     = "item name",
                        Quantity = 2,
                    },
                },
                PaymentIntentData = new SessionPaymentIntentDataOptions
                {
                    Description = "description",
                    Shipping    = new ChargeShippingOptions
                    {
                        Name    = "name",
                        Phone   = "555-555-5555",
                        Address = new AddressOptions
                        {
                            State      = "CA",
                            City       = "City",
                            Line1      = "Line1",
                            Line2      = "Line2",
                            PostalCode = "90210",
                            Country    = "US",
                        },
                    },
                },
                PaymentMethodTypes = new List <string>
                {
                    "card",
                },
                SuccessUrl = "https://stripe.com/success",
            };

            this.listOptions = new SessionListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 2
0
        public SessionServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new SessionService(this.StripeClient);

            this.createOptions = new SessionCreateOptions
            {
                CancelUrl         = "https://stripe.com/cancel",
                ClientReferenceId = "1234",
                LineItems         = new List <SessionLineItemOptions>
                {
                    new SessionLineItemOptions
                    {
                        Images = new List <string>
                        {
                            "https://stripe.com/image1",
                        },
                        PriceData = new SessionLineItemPriceDataOptions
                        {
                            Currency          = "usd",
                            Product           = "prod_123",
                            UnitAmountDecimal = 0.01234567890m, // Ensure decimals work
                        },
                        Name     = "item name",
                        Quantity = 2,
                    },
                    new SessionLineItemOptions
                    {
                        Images = new List <string>
                        {
                            "https://stripe.com/image1",
                        },
                        PriceData = new SessionLineItemPriceDataOptions
                        {
                            Currency  = "usd",
                            Product   = "prod_ABC",
                            Recurring = new SessionLineItemPriceDataRecurringOptions
                            {
                                Interval      = "day",
                                IntervalCount = 15,
                            },
                            UnitAmountDecimal = 0.01234567890m, // Ensure decimals work
                        },
                        Quantity = 2,
                    },
                },
                PaymentIntentData = new SessionPaymentIntentDataOptions
                {
                    Description = "description",
                    Shipping    = new ChargeShippingOptions
                    {
                        Name    = "name",
                        Phone   = "555-555-5555",
                        Address = new AddressOptions
                        {
                            State      = "CA",
                            City       = "City",
                            Line1      = "Line1",
                            Line2      = "Line2",
                            PostalCode = "90210",
                            Country    = "US",
                        },
                    },
                },
                PaymentMethodTypes = new List <string>
                {
                    "card",
                },
                SuccessUrl = "https://stripe.com/success",
            };

            this.listOptions = new SessionListOptions
            {
                Limit = 1,
            };

            this.listLineItemsOptions = new SessionListLineItemsOptions
            {
                Limit = 1,
            };
        }