From f45e43473422cd6aa2cfa4654b2587e19f13ab46 Mon Sep 17 00:00:00 2001 From: Jesse Rosalia Date: Thu, 25 Sep 2025 16:44:36 -0700 Subject: [PATCH 1/2] updated generated and manually maintained code to move V2.Event, V2.EventDestination and V2.EventNotification to V2.Core, and UnknownEventNotification to Stripe.Events --- .../EventDestinations/EventDestination.cs | 2 +- .../EventDestinationAmazonEventbridge.cs | 2 +- .../EventDestinationStatusDetails.cs | 2 +- .../EventDestinationStatusDetailsDisabled.cs | 2 +- .../EventDestinationWebhookEndpoint.cs | 2 +- .../V2/Core}/EventNotification.cs | 8 +-- .../V2/Core}/EventNotificationReason.cs | 4 +- .../Core}/EventNotificationReasonRequest.cs | 4 +- .../Core}/EventNotificationRelatedObject.cs | 4 +- .../Entities/V2/{ => Core}/Events/Event.cs | 4 +- .../V2/{ => Core}/Events/Event.partial.cs | 2 +- .../V2/{ => Core}/Events/EventReason.cs | 2 +- .../{ => Core}/Events/EventReasonRequest.cs | 2 +- .../{ => Core}/Events/EventRelatedObject.cs | 2 +- .../UnknownEventNotification.cs | 15 +++-- ...V1BillingMeterErrorReportTriggeredEvent.cs | 4 +- ...erErrorReportTriggeredEventNotification.cs | 4 +- .../Events/V1BillingMeterNoMeterFoundEvent.cs | 2 +- ...llingMeterNoMeterFoundEventNotification.cs | 2 +- .../Events/V2CoreEventDestinationPingEvent.cs | 12 ++-- ...reEventDestinationPingEventNotification.cs | 12 ++-- .../STJStripeObjectConverter.cs | 2 +- .../JsonConverters/STJV2EventConverter.cs | 8 +-- .../STJV2EventNotificationConverter.cs | 8 +-- .../JsonConverters/V2EventConverter.cs | 6 +- .../V2EventNotificationConverter.cs | 4 +- .../Infrastructure/Public/StripeClient.cs | 3 +- .../Public/StripeTypeRegistry.cs | 4 +- .../EventDestinationService.cs | 64 +++++++++---------- .../Services/V2/Core/Events/EventService.cs | 24 +++---- src/StripeTests/Events/V2/EventTest.cs | 10 +-- .../Services/GeneratedExamplesTest.cs | 21 +++--- .../ClassesHaveAllNecessaryJsonAttributes.cs | 4 +- .../Wholesome/DontForgetEntityType.cs | 2 +- ...oftAndSystemTextJsonOutputTheSameObject.cs | 6 +- 35 files changed, 130 insertions(+), 129 deletions(-) rename src/Stripe.net/Entities/V2/{ => Core}/EventDestinations/EventDestination.cs (99%) rename src/Stripe.net/Entities/V2/{ => Core}/EventDestinations/EventDestinationAmazonEventbridge.cs (97%) rename src/Stripe.net/Entities/V2/{ => Core}/EventDestinations/EventDestinationStatusDetails.cs (95%) rename src/Stripe.net/Entities/V2/{ => Core}/EventDestinations/EventDestinationStatusDetailsDisabled.cs (95%) rename src/Stripe.net/Entities/V2/{ => Core}/EventDestinations/EventDestinationWebhookEndpoint.cs (96%) rename src/Stripe.net/{Infrastructure/Public => Entities/V2/Core}/EventNotification.cs (98%) rename src/Stripe.net/{Infrastructure/Public => Entities/V2/Core}/EventNotificationReason.cs (96%) rename src/Stripe.net/{Infrastructure/Public => Entities/V2/Core}/EventNotificationReasonRequest.cs (96%) rename src/Stripe.net/{Infrastructure/Public => Entities/V2/Core}/EventNotificationRelatedObject.cs (96%) rename src/Stripe.net/Entities/V2/{ => Core}/Events/Event.cs (96%) rename src/Stripe.net/Entities/V2/{ => Core}/Events/Event.partial.cs (98%) rename src/Stripe.net/Entities/V2/{ => Core}/Events/EventReason.cs (96%) rename src/Stripe.net/Entities/V2/{ => Core}/Events/EventReasonRequest.cs (96%) rename src/Stripe.net/Entities/V2/{ => Core}/Events/EventRelatedObject.cs (97%) rename src/Stripe.net/{Infrastructure/Public => Events}/UnknownEventNotification.cs (79%) diff --git a/src/Stripe.net/Entities/V2/EventDestinations/EventDestination.cs b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestination.cs similarity index 99% rename from src/Stripe.net/Entities/V2/EventDestinations/EventDestination.cs rename to src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestination.cs index 95d60b03f9..6af66d8601 100644 --- a/src/Stripe.net/Entities/V2/EventDestinations/EventDestination.cs +++ b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestination.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using System; using System.Collections.Generic; diff --git a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationAmazonEventbridge.cs b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationAmazonEventbridge.cs similarity index 97% rename from src/Stripe.net/Entities/V2/EventDestinations/EventDestinationAmazonEventbridge.cs rename to src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationAmazonEventbridge.cs index 7cb8c95369..a10d1dd23c 100644 --- a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationAmazonEventbridge.cs +++ b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationAmazonEventbridge.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetails.cs b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetails.cs similarity index 95% rename from src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetails.cs rename to src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetails.cs index 6b5e5793ea..509bd8d368 100644 --- a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetails.cs +++ b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetails.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetailsDisabled.cs b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetailsDisabled.cs similarity index 95% rename from src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetailsDisabled.cs rename to src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetailsDisabled.cs index ef2456a2b4..69168896ae 100644 --- a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationStatusDetailsDisabled.cs +++ b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationStatusDetailsDisabled.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationWebhookEndpoint.cs b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationWebhookEndpoint.cs similarity index 96% rename from src/Stripe.net/Entities/V2/EventDestinations/EventDestinationWebhookEndpoint.cs rename to src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationWebhookEndpoint.cs index f58033edf5..8d9646e5b0 100644 --- a/src/Stripe.net/Entities/V2/EventDestinations/EventDestinationWebhookEndpoint.cs +++ b/src/Stripe.net/Entities/V2/Core/EventDestinations/EventDestinationWebhookEndpoint.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Infrastructure/Public/EventNotification.cs b/src/Stripe.net/Entities/V2/Core/EventNotification.cs similarity index 98% rename from src/Stripe.net/Infrastructure/Public/EventNotification.cs rename to src/Stripe.net/Entities/V2/Core/EventNotification.cs index 5c4a0e10e7..1cf64e61c0 100644 --- a/src/Stripe.net/Infrastructure/Public/EventNotification.cs +++ b/src/Stripe.net/Entities/V2/Core/EventNotification.cs @@ -1,4 +1,4 @@ -namespace Stripe.V2 +namespace Stripe.V2.Core { using System; using System.Collections.Generic; @@ -96,13 +96,13 @@ public static EventNotification FromJson(string payload, StripeClient client) } protected internal T FetchEvent() - where T : V2.Event + where T : V2.Core.Event { return this.FetchEventAsync().ConfigureAwait(false).GetAwaiter().GetResult(); } protected async Task FetchEventAsync(CancellationToken cancellationToken = default) - where T : V2.Event + where T : V2.Core.Event { if (this.Client == null) { @@ -147,4 +147,4 @@ protected virtual async Task FetchRelatedObjectAsync(EventNotificationRela return this.Client.Deserialize(res.Content); } } -} +} \ No newline at end of file diff --git a/src/Stripe.net/Infrastructure/Public/EventNotificationReason.cs b/src/Stripe.net/Entities/V2/Core/EventNotificationReason.cs similarity index 96% rename from src/Stripe.net/Infrastructure/Public/EventNotificationReason.cs rename to src/Stripe.net/Entities/V2/Core/EventNotificationReason.cs index 9c72290d7f..41fa17e472 100644 --- a/src/Stripe.net/Infrastructure/Public/EventNotificationReason.cs +++ b/src/Stripe.net/Entities/V2/Core/EventNotificationReason.cs @@ -1,4 +1,4 @@ -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER @@ -28,4 +28,4 @@ public class EventNotificationReason #endif public EventNotificationReasonRequest Request { get; set; } } -} +} \ No newline at end of file diff --git a/src/Stripe.net/Infrastructure/Public/EventNotificationReasonRequest.cs b/src/Stripe.net/Entities/V2/Core/EventNotificationReasonRequest.cs similarity index 96% rename from src/Stripe.net/Infrastructure/Public/EventNotificationReasonRequest.cs rename to src/Stripe.net/Entities/V2/Core/EventNotificationReasonRequest.cs index 050ff8a154..b9b193ff05 100644 --- a/src/Stripe.net/Infrastructure/Public/EventNotificationReasonRequest.cs +++ b/src/Stripe.net/Entities/V2/Core/EventNotificationReasonRequest.cs @@ -1,4 +1,4 @@ -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER @@ -28,4 +28,4 @@ public class EventNotificationReasonRequest #endif public string IdempotencyKey { get; set; } } -} +} \ No newline at end of file diff --git a/src/Stripe.net/Infrastructure/Public/EventNotificationRelatedObject.cs b/src/Stripe.net/Entities/V2/Core/EventNotificationRelatedObject.cs similarity index 96% rename from src/Stripe.net/Infrastructure/Public/EventNotificationRelatedObject.cs rename to src/Stripe.net/Entities/V2/Core/EventNotificationRelatedObject.cs index 39f9155369..830298a13e 100644 --- a/src/Stripe.net/Infrastructure/Public/EventNotificationRelatedObject.cs +++ b/src/Stripe.net/Entities/V2/Core/EventNotificationRelatedObject.cs @@ -1,6 +1,6 @@ #nullable disable -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER @@ -27,4 +27,4 @@ public class EventNotificationRelatedObject #endif public string Url { get; internal set; } } -} +} \ No newline at end of file diff --git a/src/Stripe.net/Entities/V2/Events/Event.cs b/src/Stripe.net/Entities/V2/Core/Events/Event.cs similarity index 96% rename from src/Stripe.net/Entities/V2/Events/Event.cs rename to src/Stripe.net/Entities/V2/Core/Events/Event.cs index 713f7ef2cf..93f2c9ad39 100644 --- a/src/Stripe.net/Entities/V2/Events/Event.cs +++ b/src/Stripe.net/Entities/V2/Core/Events/Event.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using System; using Newtonsoft.Json; @@ -8,7 +8,7 @@ namespace Stripe.V2 #endif /// - /// Code generated portion of Thin Event. + /// Code generated portion of V2 Event resource. /// public partial class Event : StripeEntity, IHasId, IHasObject { diff --git a/src/Stripe.net/Entities/V2/Events/Event.partial.cs b/src/Stripe.net/Entities/V2/Core/Events/Event.partial.cs similarity index 98% rename from src/Stripe.net/Entities/V2/Events/Event.partial.cs rename to src/Stripe.net/Entities/V2/Core/Events/Event.partial.cs index b1987388ed..5ac01c61d1 100644 --- a/src/Stripe.net/Entities/V2/Events/Event.partial.cs +++ b/src/Stripe.net/Entities/V2/Core/Events/Event.partial.cs @@ -1,4 +1,4 @@ -namespace Stripe.V2 +namespace Stripe.V2.Core { using System; using System.Net.Http; diff --git a/src/Stripe.net/Entities/V2/Events/EventReason.cs b/src/Stripe.net/Entities/V2/Core/Events/EventReason.cs similarity index 96% rename from src/Stripe.net/Entities/V2/Events/EventReason.cs rename to src/Stripe.net/Entities/V2/Core/Events/EventReason.cs index 2db0006cad..aad979a974 100644 --- a/src/Stripe.net/Entities/V2/Events/EventReason.cs +++ b/src/Stripe.net/Entities/V2/Core/Events/EventReason.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Entities/V2/Events/EventReasonRequest.cs b/src/Stripe.net/Entities/V2/Core/Events/EventReasonRequest.cs similarity index 96% rename from src/Stripe.net/Entities/V2/Events/EventReasonRequest.cs rename to src/Stripe.net/Entities/V2/Core/Events/EventReasonRequest.cs index 373500ee68..e652a5d237 100644 --- a/src/Stripe.net/Entities/V2/Events/EventReasonRequest.cs +++ b/src/Stripe.net/Entities/V2/Core/Events/EventReasonRequest.cs @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Entities/V2/Events/EventRelatedObject.cs b/src/Stripe.net/Entities/V2/Core/Events/EventRelatedObject.cs similarity index 97% rename from src/Stripe.net/Entities/V2/Events/EventRelatedObject.cs rename to src/Stripe.net/Entities/V2/Core/Events/EventRelatedObject.cs index 5f880dac20..d631bf07e5 100644 --- a/src/Stripe.net/Entities/V2/Events/EventRelatedObject.cs +++ b/src/Stripe.net/Entities/V2/Core/Events/EventRelatedObject.cs @@ -1,4 +1,4 @@ -namespace Stripe.V2 +namespace Stripe.V2.Core { using Newtonsoft.Json; #if NET6_0_OR_GREATER diff --git a/src/Stripe.net/Infrastructure/Public/UnknownEventNotification.cs b/src/Stripe.net/Events/UnknownEventNotification.cs similarity index 79% rename from src/Stripe.net/Infrastructure/Public/UnknownEventNotification.cs rename to src/Stripe.net/Events/UnknownEventNotification.cs index 482e8090e7..325362662e 100644 --- a/src/Stripe.net/Infrastructure/Public/UnknownEventNotification.cs +++ b/src/Stripe.net/Events/UnknownEventNotification.cs @@ -1,10 +1,11 @@ -namespace Stripe.V2 +namespace Stripe.Events { using System; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; + using Stripe.V2.Core; #if NET6_0_OR_GREATER using STJS = System.Text.Json.Serialization; #endif @@ -12,7 +13,7 @@ namespace Stripe.V2 /// /// Represents an EventNotification that is valid, but that the SDK doesn't have types for. May have a RelatedObject and can be used to fetch the corresponding full event. /// - public class UnknownEventNotification : EventNotification + public class UnknownEventNotification : V2.Core.EventNotification { #nullable enable /// @@ -24,14 +25,14 @@ public class UnknownEventNotification : EventNotification #endif public EventNotificationRelatedObject? RelatedObject { get; internal set; } - public V2.Event FetchEvent() + public V2.Core.Event FetchEvent() { - return this.FetchEvent(); + return this.FetchEvent(); } - public Task FetchEventAsync(CancellationToken cancellationToken = default) + public Task FetchEventAsync(CancellationToken cancellationToken = default) { - return this.FetchEventAsync(cancellationToken); + return this.FetchEventAsync(cancellationToken); } public StripeEntity FetchRelatedObject() @@ -54,4 +55,4 @@ public Task FetchRelatedObjectAsync() return this.FetchRelatedObjectAsync(this.RelatedObject); } } -} +} \ No newline at end of file diff --git a/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEvent.cs b/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEvent.cs index 1fa31bc3bb..cba3fd21a3 100644 --- a/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEvent.cs +++ b/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEvent.cs @@ -10,7 +10,7 @@ namespace Stripe.Events /// /// Occurs when a Meter has invalid async usage events. /// - public class V1BillingMeterErrorReportTriggeredEvent : V2.Event + public class V1BillingMeterErrorReportTriggeredEvent : V2.Core.Event { /// /// Data for the v1.billing.meter.error_report_triggered event. @@ -30,7 +30,7 @@ public class V1BillingMeterErrorReportTriggeredEvent : V2.Event [STJS.JsonPropertyName("related_object")] #endif - public V2.EventRelatedObject RelatedObject { get; set; } + public V2.Core.EventRelatedObject RelatedObject { get; set; } /// /// Asynchronously retrieves the related object from the API. Make an API request on every diff --git a/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEventNotification.cs b/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEventNotification.cs index 1c320e7d04..40128e436d 100644 --- a/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEventNotification.cs +++ b/src/Stripe.net/Events/V1BillingMeterErrorReportTriggeredEventNotification.cs @@ -11,7 +11,7 @@ namespace Stripe.Events /// /// Occurs when a Meter has invalid async usage events. /// - public class V1BillingMeterErrorReportTriggeredEventNotification : V2.EventNotification + public class V1BillingMeterErrorReportTriggeredEventNotification : V2.Core.EventNotification { /// /// Object containing the reference to API resource relevant to the event. @@ -21,7 +21,7 @@ public class V1BillingMeterErrorReportTriggeredEventNotification : V2.EventNotif [STJS.JsonPropertyName("related_object")] #endif - public V2.EventNotificationRelatedObject RelatedObject { get; set; } + public V2.Core.EventNotificationRelatedObject RelatedObject { get; set; } /// /// Asynchronously retrieves the related object from the API. Make an API request on every diff --git a/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEvent.cs b/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEvent.cs index 1d436ff04f..6fb99e883d 100644 --- a/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEvent.cs +++ b/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEvent.cs @@ -10,7 +10,7 @@ namespace Stripe.Events /// /// Occurs when a Meter's id is missing or invalid in async usage events. /// - public class V1BillingMeterNoMeterFoundEvent : V2.Event + public class V1BillingMeterNoMeterFoundEvent : V2.Core.Event { /// /// Data for the v1.billing.meter.no_meter_found event. diff --git a/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEventNotification.cs b/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEventNotification.cs index 314fbd6bfe..0f802535f4 100644 --- a/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEventNotification.cs +++ b/src/Stripe.net/Events/V1BillingMeterNoMeterFoundEventNotification.cs @@ -7,7 +7,7 @@ namespace Stripe.Events /// /// Occurs when a Meter's id is missing or invalid in async usage events. /// - public class V1BillingMeterNoMeterFoundEventNotification : V2.EventNotification + public class V1BillingMeterNoMeterFoundEventNotification : V2.Core.EventNotification { public V1BillingMeterNoMeterFoundEvent FetchEvent() { diff --git a/src/Stripe.net/Events/V2CoreEventDestinationPingEvent.cs b/src/Stripe.net/Events/V2CoreEventDestinationPingEvent.cs index 4642c65c7e..cd3cbff1ab 100644 --- a/src/Stripe.net/Events/V2CoreEventDestinationPingEvent.cs +++ b/src/Stripe.net/Events/V2CoreEventDestinationPingEvent.cs @@ -10,7 +10,7 @@ namespace Stripe.Events /// /// A ping event used to test the connection to an EventDestination. /// - public class V2CoreEventDestinationPingEvent : V2.Event + public class V2CoreEventDestinationPingEvent : V2.Core.Event { /// /// Object containing the reference to API resource relevant to the event. @@ -20,23 +20,23 @@ public class V2CoreEventDestinationPingEvent : V2.Event [STJS.JsonPropertyName("related_object")] #endif - public V2.EventRelatedObject RelatedObject { get; set; } + public V2.Core.EventRelatedObject RelatedObject { get; set; } /// /// Asynchronously retrieves the related object from the API. Make an API request on every /// call. /// - public Task FetchRelatedObjectAsync() + public Task FetchRelatedObjectAsync() { - return this.FetchRelatedObjectAsync(this.RelatedObject); + return this.FetchRelatedObjectAsync(this.RelatedObject); } /// /// Retrieves the related object from the API. Make an API request on every call. /// - public V2.EventDestination FetchRelatedObject() + public V2.Core.EventDestination FetchRelatedObject() { - return this.FetchRelatedObject(this.RelatedObject); + return this.FetchRelatedObject(this.RelatedObject); } } } diff --git a/src/Stripe.net/Events/V2CoreEventDestinationPingEventNotification.cs b/src/Stripe.net/Events/V2CoreEventDestinationPingEventNotification.cs index 92f8bb4a76..4fab0cff7a 100644 --- a/src/Stripe.net/Events/V2CoreEventDestinationPingEventNotification.cs +++ b/src/Stripe.net/Events/V2CoreEventDestinationPingEventNotification.cs @@ -11,7 +11,7 @@ namespace Stripe.Events /// /// A ping event used to test the connection to an EventDestination. /// - public class V2CoreEventDestinationPingEventNotification : V2.EventNotification + public class V2CoreEventDestinationPingEventNotification : V2.Core.EventNotification { /// /// Object containing the reference to API resource relevant to the event. @@ -21,23 +21,23 @@ public class V2CoreEventDestinationPingEventNotification : V2.EventNotification [STJS.JsonPropertyName("related_object")] #endif - public V2.EventNotificationRelatedObject RelatedObject { get; set; } + public V2.Core.EventNotificationRelatedObject RelatedObject { get; set; } /// /// Asynchronously retrieves the related object from the API. Make an API request on every /// call. /// - public Task FetchRelatedObjectAsync() + public Task FetchRelatedObjectAsync() { - return this.FetchRelatedObjectAsync(this.RelatedObject); + return this.FetchRelatedObjectAsync(this.RelatedObject); } /// /// Retrieves the related object from the API. Make an API request on every call. /// - public V2.EventDestination FetchRelatedObject() + public V2.Core.EventDestination FetchRelatedObject() { - return this.FetchRelatedObject(this.RelatedObject); + return this.FetchRelatedObject(this.RelatedObject); } public V2CoreEventDestinationPingEvent FetchEvent() diff --git a/src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs b/src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs index ee6563bfeb..ba76da58c4 100644 --- a/src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs +++ b/src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs @@ -28,7 +28,7 @@ public override bool CanConvert(Type objectType) { var typeInfo = objectType.GetTypeInfo(); return (typeInfo.IsInterface && typeInfo.FullName.StartsWith("Stripe")) || - typeInfo.FullName.Equals("Stripe.V2.Event"); + typeInfo.FullName.Equals("Stripe.V2.Core.Event"); } public override JsonConverter CreateConverter( diff --git a/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventConverter.cs b/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventConverter.cs index cee0c0f97b..7ed335bd96 100644 --- a/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventConverter.cs +++ b/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventConverter.cs @@ -8,10 +8,10 @@ namespace Stripe.Infrastructure using static Stripe.Infrastructure.SerializablePropertyCache; /// - /// Converts a to JSON, including any fields + /// Converts a to JSON, including any fields /// in derived classes. /// - internal class STJV2EventConverter : STJDefaultConverter + internal class STJV2EventConverter : STJDefaultConverter { /// /// Reads the JSON representation of the object. @@ -20,7 +20,7 @@ internal class STJV2EventConverter : STJDefaultConverter /// Type of the object. /// The calling serializer's options. /// The object value. - public override V2.Event Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override V2.Core.Event Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { throw new NotSupportedException("STJV2EventConverter should only be used while serializing."); } @@ -34,7 +34,7 @@ public override V2.Event Read(ref Utf8JsonReader reader, Type typeToConvert, Jso /// public override bool CanConvert(Type objectType) { - return typeof(Stripe.V2.Event).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + return typeof(Stripe.V2.Core.Event).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); } } } diff --git a/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventNotificationConverter.cs b/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventNotificationConverter.cs index 1ac0a31b62..2464d304bf 100644 --- a/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventNotificationConverter.cs +++ b/src/Stripe.net/Infrastructure/JsonConverters/STJV2EventNotificationConverter.cs @@ -8,10 +8,10 @@ namespace Stripe.Infrastructure using static Stripe.Infrastructure.SerializablePropertyCache; /// - /// Converts a to JSON, including any fields + /// Converts a to JSON, including any fields /// in derived classes. /// - internal class STJV2EventNotificationConverter : STJDefaultConverter + internal class STJV2EventNotificationConverter : STJDefaultConverter { /// /// Reads the JSON representation of the object. @@ -20,7 +20,7 @@ internal class STJV2EventNotificationConverter : STJDefaultConverterType of the object. /// The calling serializer's options. /// The object value. - public override V2.EventNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override V2.Core.EventNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { throw new NotSupportedException("STJV2EventConverter should only be used while serializing."); } @@ -34,7 +34,7 @@ public override V2.EventNotification Read(ref Utf8JsonReader reader, Type typeTo /// public override bool CanConvert(Type objectType) { - return typeof(Stripe.V2.EventNotification).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + return typeof(Stripe.V2.Core.EventNotification).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); } } } diff --git a/src/Stripe.net/Infrastructure/JsonConverters/V2EventConverter.cs b/src/Stripe.net/Infrastructure/JsonConverters/V2EventConverter.cs index 4e617a80dc..8cc4b9e8fd 100644 --- a/src/Stripe.net/Infrastructure/JsonConverters/V2EventConverter.cs +++ b/src/Stripe.net/Infrastructure/JsonConverters/V2EventConverter.cs @@ -35,12 +35,12 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (concreteType == null) { // If "type" is unknown by this SDK, default to the generic ThinEvent type. - concreteType = typeof(V2.Event); + concreteType = typeof(V2.Core.Event); } using (var subReader = jsonObject.CreateReader()) { - var e = (V2.Event)Activator.CreateInstance(concreteType); + var e = (V2.Core.Event)Activator.CreateInstance(concreteType); if (serializer.Context.Context is DeserializationContext context) { @@ -62,7 +62,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist /// public override bool CanConvert(Type objectType) { - return objectType.GetTypeInfo() == typeof(V2.Event); + return objectType.GetTypeInfo() == typeof(V2.Core.Event); } } } diff --git a/src/Stripe.net/Infrastructure/JsonConverters/V2EventNotificationConverter.cs b/src/Stripe.net/Infrastructure/JsonConverters/V2EventNotificationConverter.cs index 70d0125db0..d1dc2073f8 100644 --- a/src/Stripe.net/Infrastructure/JsonConverters/V2EventNotificationConverter.cs +++ b/src/Stripe.net/Infrastructure/JsonConverters/V2EventNotificationConverter.cs @@ -25,7 +25,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist // class to deserialize into. var typeValue = (string)jsonObject["type"]; - Type concreteType = StripeTypeRegistry.GetConcreteV2EventNotificationType(typeValue) ?? typeof(V2.UnknownEventNotification); + Type concreteType = StripeTypeRegistry.GetConcreteV2EventNotificationType(typeValue) ?? typeof(Events.UnknownEventNotification); using var subReader = jsonObject.CreateReader(); var e = Activator.CreateInstance(concreteType); @@ -42,7 +42,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist /// public override bool CanConvert(Type objectType) { - return objectType.GetTypeInfo() == typeof(V2.EventNotification); + return objectType.GetTypeInfo() == typeof(V2.Core.EventNotification); } } } diff --git a/src/Stripe.net/Infrastructure/Public/StripeClient.cs b/src/Stripe.net/Infrastructure/Public/StripeClient.cs index 1c499f594e..f7bfdddcbf 100644 --- a/src/Stripe.net/Infrastructure/Public/StripeClient.cs +++ b/src/Stripe.net/Infrastructure/Public/StripeClient.cs @@ -7,8 +7,7 @@ namespace Stripe using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; - using Stripe.Infrastructure; - using Stripe.V2; + using Stripe.V2.Core; /// /// A Stripe client, used to issue requests to Stripe's API and deserialize responses. diff --git a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs index 4fd6799059..1558dd2290 100644 --- a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs +++ b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs @@ -181,8 +181,8 @@ public static class StripeTypeRegistry { "v2.billing.meter_event", typeof(V2.Billing.MeterEvent) }, { "v2.billing.meter_event_adjustment", typeof(V2.Billing.MeterEventAdjustment) }, { "v2.billing.meter_event_session", typeof(V2.Billing.MeterEventSession) }, - { "v2.core.event", typeof(V2.Event) }, - { "v2.core.event_destination", typeof(V2.EventDestination) }, + { "v2.core.event", typeof(V2.Core.Event) }, + { "v2.core.event_destination", typeof(V2.Core.EventDestination) }, // V2ObjectsToTypes: The end of the section generated from our OpenAPI spec }); diff --git a/src/Stripe.net/Services/V2/Core/EventDestinations/EventDestinationService.cs b/src/Stripe.net/Services/V2/Core/EventDestinations/EventDestinationService.cs index 299fe81932..204602333b 100644 --- a/src/Stripe.net/Services/V2/Core/EventDestinations/EventDestinationService.cs +++ b/src/Stripe.net/Services/V2/Core/EventDestinations/EventDestinationService.cs @@ -23,17 +23,17 @@ internal EventDestinationService(IStripeClient client) /// /// Create a new event destination. /// - public virtual V2.EventDestination Create(EventDestinationCreateOptions options, RequestOptions requestOptions = null) + public virtual EventDestination Create(EventDestinationCreateOptions options, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations", options, requestOptions); } /// /// Create a new event destination. /// - public virtual Task CreateAsync(EventDestinationCreateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task CreateAsync(EventDestinationCreateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations", options, requestOptions, cancellationToken); } /// @@ -55,113 +55,113 @@ public virtual V2.DeletedObject Delete(string id, EventDestinationDeleteOptions /// /// Disable an event destination. /// - public virtual V2.EventDestination Disable(string id, EventDestinationDisableOptions options = null, RequestOptions requestOptions = null) + public virtual EventDestination Disable(string id, EventDestinationDisableOptions options = null, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/disable", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/disable", options, requestOptions); } /// /// Disable an event destination. /// - public virtual Task DisableAsync(string id, EventDestinationDisableOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task DisableAsync(string id, EventDestinationDisableOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/disable", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/disable", options, requestOptions, cancellationToken); } /// /// Enable an event destination. /// - public virtual V2.EventDestination Enable(string id, EventDestinationEnableOptions options = null, RequestOptions requestOptions = null) + public virtual EventDestination Enable(string id, EventDestinationEnableOptions options = null, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/enable", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/enable", options, requestOptions); } /// /// Enable an event destination. /// - public virtual Task EnableAsync(string id, EventDestinationEnableOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task EnableAsync(string id, EventDestinationEnableOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/enable", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/enable", options, requestOptions, cancellationToken); } /// /// Retrieves the details of an event destination. /// - public virtual V2.EventDestination Get(string id, EventDestinationGetOptions options = null, RequestOptions requestOptions = null) + public virtual EventDestination Get(string id, EventDestinationGetOptions options = null, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions); } /// /// Retrieves the details of an event destination. /// - public virtual Task GetAsync(string id, EventDestinationGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task GetAsync(string id, EventDestinationGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); } /// /// Lists all event destinations. /// - public virtual V2.StripeList List(EventDestinationListOptions options = null, RequestOptions requestOptions = null) + public virtual V2.StripeList List(EventDestinationListOptions options = null, RequestOptions requestOptions = null) { - return this.Request>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations", options, requestOptions); + return this.Request>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations", options, requestOptions); } /// /// Lists all event destinations. /// - public virtual Task> ListAsync(EventDestinationListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task> ListAsync(EventDestinationListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations", options, requestOptions, cancellationToken); + return this.RequestAsync>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/event_destinations", options, requestOptions, cancellationToken); } /// /// Lists all event destinations. /// - public virtual IEnumerable ListAutoPaging(EventDestinationListOptions options = null, RequestOptions requestOptions = null) + public virtual IEnumerable ListAutoPaging(EventDestinationListOptions options = null, RequestOptions requestOptions = null) { - return this.ListRequestAutoPaging($"/v2/core/event_destinations", options, requestOptions); + return this.ListRequestAutoPaging($"/v2/core/event_destinations", options, requestOptions); } /// /// Lists all event destinations. /// - public virtual IAsyncEnumerable ListAutoPagingAsync(EventDestinationListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual IAsyncEnumerable ListAutoPagingAsync(EventDestinationListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.ListRequestAutoPagingAsync($"/v2/core/event_destinations", options, requestOptions, cancellationToken); + return this.ListRequestAutoPagingAsync($"/v2/core/event_destinations", options, requestOptions, cancellationToken); } /// /// Send a ping event to an event destination. /// - public virtual V2.Event Ping(string id, EventDestinationPingOptions options = null, RequestOptions requestOptions = null) + public virtual Event Ping(string id, EventDestinationPingOptions options = null, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/ping", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/ping", options, requestOptions); } /// /// Send a ping event to an event destination. /// - public virtual Task PingAsync(string id, EventDestinationPingOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task PingAsync(string id, EventDestinationPingOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/ping", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}/ping", options, requestOptions, cancellationToken); } /// /// Update the details of an event destination. /// - public virtual V2.EventDestination Update(string id, EventDestinationUpdateOptions options, RequestOptions requestOptions = null) + public virtual EventDestination Update(string id, EventDestinationUpdateOptions options, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions); } /// /// Update the details of an event destination. /// - public virtual Task UpdateAsync(string id, EventDestinationUpdateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task UpdateAsync(string id, EventDestinationUpdateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v2/core/event_destinations/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); } } } diff --git a/src/Stripe.net/Services/V2/Core/Events/EventService.cs b/src/Stripe.net/Services/V2/Core/Events/EventService.cs index e39553225f..2278aec9b4 100644 --- a/src/Stripe.net/Services/V2/Core/Events/EventService.cs +++ b/src/Stripe.net/Services/V2/Core/Events/EventService.cs @@ -23,49 +23,49 @@ internal EventService(IStripeClient client) /// /// Retrieves the details of an event. /// - public virtual V2.Event Get(string id, EventGetOptions options = null, RequestOptions requestOptions = null) + public virtual Event Get(string id, EventGetOptions options = null, RequestOptions requestOptions = null) { - return this.Request(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events/{WebUtility.UrlEncode(id)}", options, requestOptions); + return this.Request(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events/{WebUtility.UrlEncode(id)}", options, requestOptions); } /// /// Retrieves the details of an event. /// - public virtual Task GetAsync(string id, EventGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task GetAsync(string id, EventGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); + return this.RequestAsync(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events/{WebUtility.UrlEncode(id)}", options, requestOptions, cancellationToken); } /// /// List events, going back up to 30 days. /// - public virtual V2.StripeList List(EventListOptions options = null, RequestOptions requestOptions = null) + public virtual V2.StripeList List(EventListOptions options = null, RequestOptions requestOptions = null) { - return this.Request>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events", options, requestOptions); + return this.Request>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events", options, requestOptions); } /// /// List events, going back up to 30 days. /// - public virtual Task> ListAsync(EventListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual Task> ListAsync(EventListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.RequestAsync>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events", options, requestOptions, cancellationToken); + return this.RequestAsync>(BaseAddress.Api, HttpMethod.Get, $"/v2/core/events", options, requestOptions, cancellationToken); } /// /// List events, going back up to 30 days. /// - public virtual IEnumerable ListAutoPaging(EventListOptions options = null, RequestOptions requestOptions = null) + public virtual IEnumerable ListAutoPaging(EventListOptions options = null, RequestOptions requestOptions = null) { - return this.ListRequestAutoPaging($"/v2/core/events", options, requestOptions); + return this.ListRequestAutoPaging($"/v2/core/events", options, requestOptions); } /// /// List events, going back up to 30 days. /// - public virtual IAsyncEnumerable ListAutoPagingAsync(EventListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + public virtual IAsyncEnumerable ListAutoPagingAsync(EventListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { - return this.ListRequestAutoPagingAsync($"/v2/core/events", options, requestOptions, cancellationToken); + return this.ListRequestAutoPagingAsync($"/v2/core/events", options, requestOptions, cancellationToken); } } } diff --git a/src/StripeTests/Events/V2/EventTest.cs b/src/StripeTests/Events/V2/EventTest.cs index 0df98de0a0..32e4936e91 100644 --- a/src/StripeTests/Events/V2/EventTest.cs +++ b/src/StripeTests/Events/V2/EventTest.cs @@ -164,8 +164,8 @@ public static string GenerateSigHeader(string payload) /// parse a EventNotification and then uses the method to retrieve the full Event. /// /// The json payload to parse. - /// A V2.Event derived class. - private Stripe.V2.Event DoParseSignedEventAndFetch(string payload) + /// A V2.Core.Event derived class. + private Stripe.V2.Core.Event DoParseSignedEventAndFetch(string payload) { this.MockHttpClientFixture.MockHandler.Protected() .Setup>( @@ -180,7 +180,7 @@ private Stripe.V2.Event DoParseSignedEventAndFetch(string payload) var bte = this.DoParseSignedEventNotification(payload); // fetch full event - return bte.FetchEvent(); + return bte.FetchEvent(); } /// @@ -189,7 +189,7 @@ private Stripe.V2.Event DoParseSignedEventAndFetch(string payload) /// /// The json payload to parse. /// An EventNotification derived class. - private Stripe.V2.EventNotification DoParseSignedEventNotification(string payload) + private Stripe.V2.Core.EventNotification DoParseSignedEventNotification(string payload) { var notif = this.stripeClient.ParseEventNotification(payload, GenerateSigHeader(payload), WebhookSecret); @@ -292,7 +292,7 @@ public void ParseEventNotificationWithInvalidSignature() [Fact] public void ParseUnknownEventDirectly() { - var stripeEvent = JsonUtils.DeserializeObject(v2UnknownEventPayload); + var stripeEvent = JsonUtils.DeserializeObject(v2UnknownEventPayload); Assert.NotNull(stripeEvent); Assert.Equal("evt_234", stripeEvent.Id); Assert.Equal("event", stripeEvent.Object); diff --git a/src/StripeTests/Services/GeneratedExamplesTest.cs b/src/StripeTests/Services/GeneratedExamplesTest.cs index 3b86da02c7..12e3a0d7f7 100644 --- a/src/StripeTests/Services/GeneratedExamplesTest.cs +++ b/src/StripeTests/Services/GeneratedExamplesTest.cs @@ -726,7 +726,7 @@ public void TestCoreEventsGet() "{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"context\":\"context\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"reason\":{\"type\":\"request\",\"request\":{\"id\":\"obj_123\",\"idempotency_key\":\"idempotency_key\"}},\"type\":\"type\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.Events; - Stripe.V2.Event result = service.Get("ll_123"); + Stripe.V2.Core.Event result = service.Get("ll_123"); this.AssertRequest(HttpMethod.Get, "/v2/core/events/ll_123"); } @@ -6254,7 +6254,7 @@ public void TestV2CoreEventGet() }; var client = new StripeClient(this.Requestor); var service = client.V2.Core.Events; - Stripe.V2.StripeList events = service.List( + Stripe.V2.StripeList events = service.List( options); this.AssertRequest( HttpMethod.Get, @@ -6272,7 +6272,7 @@ public void TestV2CoreEventGet2() "{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"type\":\"type\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.Events; - Stripe.V2.Event result = service.Get("id_123"); + Stripe.V2.Core.Event result = service.Get("id_123"); this.AssertRequest(HttpMethod.Get, "/v2/core/events/id_123"); } @@ -6286,7 +6286,7 @@ public void TestV2CoreEventDestinationGet() "{\"data\":[{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}],\"next_page_url\":null,\"previous_page_url\":null}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.StripeList eventDestinations = service + Stripe.V2.StripeList eventDestinations = service .List(); this.AssertRequest(HttpMethod.Get, "/v2/core/event_destinations"); } @@ -6308,7 +6308,7 @@ public void TestV2CoreEventDestinationPost() }; var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.EventDestination eventDestination = service.Create( + Stripe.V2.Core.EventDestination eventDestination = service.Create( options); this.AssertRequest(HttpMethod.Post, "/v2/core/event_destinations"); } @@ -6339,7 +6339,8 @@ public void TestV2CoreEventDestinationGet2() "{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.EventDestination eventDestination = service.Get("id_123"); + Stripe.V2.Core.EventDestination eventDestination = service.Get( + "id_123"); this.AssertRequest( HttpMethod.Get, "/v2/core/event_destinations/id_123"); @@ -6356,7 +6357,7 @@ public void TestV2CoreEventDestinationPost2() var options = new Stripe.V2.Core.EventDestinationUpdateOptions(); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.EventDestination eventDestination = service.Update( + Stripe.V2.Core.EventDestination eventDestination = service.Update( "id_123", options); this.AssertRequest( @@ -6374,7 +6375,7 @@ public void TestV2CoreEventDestinationPost3() "{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.EventDestination eventDestination = service.Disable( + Stripe.V2.Core.EventDestination eventDestination = service.Disable( "id_123"); this.AssertRequest( HttpMethod.Post, @@ -6391,7 +6392,7 @@ public void TestV2CoreEventDestinationPost4() "{\"id\":\"obj_123\",\"object\":\"v2.core.event_destination\",\"created\":\"1970-01-12T21:42:34.472Z\",\"description\":\"description\",\"enabled_events\":[\"enabled_events\"],\"event_payload\":\"thin\",\"livemode\":true,\"name\":\"name\",\"status\":\"disabled\",\"type\":\"amazon_eventbridge\",\"updated\":\"1970-01-03T17:07:10.277Z\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.EventDestination eventDestination = service.Enable( + Stripe.V2.Core.EventDestination eventDestination = service.Enable( "id_123"); this.AssertRequest( HttpMethod.Post, @@ -6408,7 +6409,7 @@ public void TestV2CoreEventDestinationPost5() "{\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"created\":\"1970-01-12T21:42:34.472Z\",\"livemode\":true,\"type\":\"type\"}"); var client = new StripeClient(this.Requestor); var service = client.V2.Core.EventDestinations; - Stripe.V2.Event result = service.Ping("id_123"); + Stripe.V2.Core.Event result = service.Ping("id_123"); this.AssertRequest( HttpMethod.Post, "/v2/core/event_destinations/id_123/ping"); diff --git a/src/StripeTests/Wholesome/ClassesHaveAllNecessaryJsonAttributes.cs b/src/StripeTests/Wholesome/ClassesHaveAllNecessaryJsonAttributes.cs index 6323cee54c..46d456bf25 100644 --- a/src/StripeTests/Wholesome/ClassesHaveAllNecessaryJsonAttributes.cs +++ b/src/StripeTests/Wholesome/ClassesHaveAllNecessaryJsonAttributes.cs @@ -62,8 +62,8 @@ public void Check() } } - // Special case for Stripe.V2.Event - if (type == typeof(Stripe.V2.Event)) + // Special case for Stripe.V2.Core.Event + if (type == typeof(Stripe.V2.Core.Event)) { var converter = type.GetCustomAttribute(typeof(STJS.JsonConverterAttribute), false) as STJS.JsonConverterAttribute; if (converter?.ConverterType != typeof(STJV2EventConverter)) diff --git a/src/StripeTests/Wholesome/DontForgetEntityType.cs b/src/StripeTests/Wholesome/DontForgetEntityType.cs index d31af4c717..9e36fe8143 100644 --- a/src/StripeTests/Wholesome/DontForgetEntityType.cs +++ b/src/StripeTests/Wholesome/DontForgetEntityType.cs @@ -35,7 +35,7 @@ public void Check() continue; } - if (baseType == typeof(Stripe.V2.Event)) + if (baseType == typeof(Stripe.V2.Core.Event)) { continue; } diff --git a/src/StripeTests/Wholesome/NewtonsoftAndSystemTextJsonOutputTheSameObject.cs b/src/StripeTests/Wholesome/NewtonsoftAndSystemTextJsonOutputTheSameObject.cs index e4b0f155fb..4c21e0480d 100644 --- a/src/StripeTests/Wholesome/NewtonsoftAndSystemTextJsonOutputTheSameObject.cs +++ b/src/StripeTests/Wholesome/NewtonsoftAndSystemTextJsonOutputTheSameObject.cs @@ -349,11 +349,11 @@ private void CheckGenericTypes(List genericTypes, List results) var listType = list.GetType(); genericTypes.RemoveAll(gt => listType.FullName.StartsWith(gt.FullName)); - // This also tests polymorphic types like V2.Event within + // This also tests polymorphic types like V2.Core.Event within // the list - var v2List = new Stripe.V2.StripeList + var v2List = new Stripe.V2.StripeList { - Data = new List + Data = new List { this.PopulateWithReasonableDefaults(new V1BillingMeterErrorReportTriggeredEvent(), null, new Dictionary()), this.PopulateWithReasonableDefaults(new V1BillingMeterErrorReportTriggeredEvent(), null, new Dictionary()), From c98d980299adb168825a3848d4b5dbc3e9e80c2c Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 26 Sep 2025 18:05:55 -0700 Subject: [PATCH 2/2] fix test --- .../Infrastructure/Public/StripeContextIntegrationTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StripeTests/Infrastructure/Public/StripeContextIntegrationTest.cs b/src/StripeTests/Infrastructure/Public/StripeContextIntegrationTest.cs index fe8cf0dd58..a63c3c1b1a 100644 --- a/src/StripeTests/Infrastructure/Public/StripeContextIntegrationTest.cs +++ b/src/StripeTests/Infrastructure/Public/StripeContextIntegrationTest.cs @@ -2,7 +2,7 @@ namespace StripeTests.Infrastructure.Public { using System; using Stripe; - using Stripe.V2; + using Stripe.V2.Core; using Xunit; public class StripeContextIntegrationTest