Contains information sent in a WebHook notification from Stripe, see 'https://stripe.com/docs/api#event_object' for details.
예제 #1
0
        public void StripeEvent_Roundtrips()
        {
            // Arrange
            JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.StripeEvent.json");
            StripeEvent expectedEvent = new StripeEvent
            {
                Id = "evt_17Y0a62eZvKYlo2CfDvB2QrJ",
                Object = "event",
                ApiVersion = "2015-10-16",
                Created = _testTime,
                Data = new StripeEventData
                {
                    Object = JObject.Parse("{ \"id\": \"12345\", \"object\": \"card\" }"),
                    PreviousAttributes = JObject.Parse("{ \"balance\": null, \"next\": 1340924237, \"closed\": false }")
                },
                LiveMode = true,
                PendingWebHooks = 10,
                Request = "req_7nbnyKCObIkSXC",
                EventType = "customer.source.created",
            };

            // Act
            StripeEvent actualEvent = data.ToObject<StripeEvent>();

            // Assert
            string expectedJson = JsonConvert.SerializeObject(expectedEvent);
            string actualJson = JsonConvert.SerializeObject(actualEvent);
            Assert.Equal(expectedJson, actualJson);
        }
예제 #2
0
        public void StripeEvent_Roundtrips()
        {
            // Arrange
            JObject     data          = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.StripeEvent.json");
            StripeEvent expectedEvent = new StripeEvent
            {
                Id         = "evt_17Y0a62eZvKYlo2CfDvB2QrJ",
                Object     = "event",
                ApiVersion = "2015-10-16",
                Created    = _testTime,
                Data       = new StripeEventData
                {
                    Object             = JObject.Parse("{ \"id\": \"12345\", \"object\": \"card\" }"),
                    PreviousAttributes = JObject.Parse("{ \"balance\": null, \"next\": 1340924237, \"closed\": false }")
                },
                LiveMode        = true,
                PendingWebHooks = 10,
                Request         = "req_7nbnyKCObIkSXC",
                EventType       = "customer.source.created",
            };

            // Act
            StripeEvent actualEvent = data.ToObject <StripeEvent>();

            // Assert
            string expectedJson = JsonConvert.SerializeObject(expectedEvent);
            string actualJson   = JsonConvert.SerializeObject(actualEvent);

            Assert.Equal(expectedJson, actualJson);
        }