diff --git a/src/main/java/com/stripe/StripeClient.java b/src/main/java/com/stripe/StripeClient.java index e5b816ddb45..356f474d768 100644 --- a/src/main/java/com/stripe/StripeClient.java +++ b/src/main/java/com/stripe/StripeClient.java @@ -3,7 +3,7 @@ import com.stripe.exception.SignatureVerificationException; import com.stripe.exception.StripeException; import com.stripe.model.StripeObject; -import com.stripe.model.ThinEvent; +import com.stripe.model.v2.EventNotification; import com.stripe.net.*; import com.stripe.net.Webhook.Signature; import java.net.PasswordAuthentication; @@ -52,9 +52,9 @@ protected StripeResponseGetter getResponseGetter() { * @return the StripeEvent instance * @throws SignatureVerificationException if the verification fails. */ - public ThinEvent parseThinEvent(String payload, String sigHeader, String secret) + public EventNotification parseEventNotification(String payload, String sigHeader, String secret) throws SignatureVerificationException { - return parseThinEvent(payload, sigHeader, secret, Webhook.DEFAULT_TOLERANCE); + return parseEventNotification(payload, sigHeader, secret, Webhook.DEFAULT_TOLERANCE); } /** @@ -70,11 +70,12 @@ public ThinEvent parseThinEvent(String payload, String sigHeader, String secret) * @return the StripeEvent instance * @throws SignatureVerificationException if the verification fails. */ - public ThinEvent parseThinEvent(String payload, String sigHeader, String secret, long tolerance) + public EventNotification parseEventNotification( + String payload, String sigHeader, String secret, long tolerance) throws SignatureVerificationException { Signature.verifyHeader(payload, sigHeader, secret, tolerance); - return ApiResource.GSON.fromJson(payload, ThinEvent.class); + return EventNotification.fromJson(payload, this); } /** diff --git a/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java index bab476098a3..89ec7c14531 100644 --- a/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java +++ b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java @@ -5,6 +5,7 @@ import com.stripe.exception.StripeException; import com.stripe.model.billing.Meter; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import java.time.Instant; import java.util.List; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEventNotification.java new file mode 100644 index 00000000000..367a95aa50f --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingMeterErrorReportTriggeredEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterErrorReportTriggeredEvent fetchEvent() throws StripeException { + return (V1BillingMeterErrorReportTriggeredEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEventNotification.java new file mode 100644 index 00000000000..e533858cff0 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterNoMeterFoundEventNotification.java @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.stripe.exception.StripeException; +import com.stripe.model.v2.EventNotification; + +public final class V1BillingMeterNoMeterFoundEventNotification extends EventNotification { + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterNoMeterFoundEvent fetchEvent() throws StripeException { + return (V1BillingMeterNoMeterFoundEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEvent.java b/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEvent.java index 21fa0a13c73..2d6084b5886 100644 --- a/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.billing.BillSetting; import java.time.Instant; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEventNotification.java new file mode 100644 index 00000000000..9af45757d7e --- /dev/null +++ b/src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.billing.BillSetting; +import lombok.Getter; + +@Getter +public final class V2BillingBillSettingUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public BillSetting fetchRelatedObject() throws StripeException { + return (BillSetting) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2BillingBillSettingUpdatedEvent fetchEvent() throws StripeException { + return (V2BillingBillSettingUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountClosedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountClosedEvent.java index fcb7ccad65c..8e1550bb8a0 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountClosedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountClosedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountClosedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountClosedEventNotification.java new file mode 100644 index 00000000000..112474652cf --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountClosedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountClosedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountClosedEvent fetchEvent() throws StripeException { + return (V2CoreAccountClosedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountCreatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountCreatedEvent.java index 1ddaea50aad..b58d08beedf 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountCreatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountCreatedEventNotification.java new file mode 100644 index 00000000000..20f06885b75 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountCreatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent.java index 9f3e530d5e2..5d8a3bfb498 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification.java new file mode 100644 index 00000000000..9fe85d2ef2b --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification.java @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final +class V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent) + super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEvent.java index c9997f52540..900ef39bc56 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification.java new file mode 100644 index 00000000000..d53a3147f98 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationCustomerUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationCustomerUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent.java index e0f9e3277e2..5cfd9900bb3 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification.java new file mode 100644 index 00000000000..1ee2665d742 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification.java @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final +class V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent) + super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEvent.java index 9ba30fcb762..b82a7027f87 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification.java new file mode 100644 index 00000000000..579890ec4a4 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationMerchantUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationMerchantUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent.java index 68ea8fcc6f6..4a9cf048cfd 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification.java new file mode 100644 index 00000000000..ed594d7a539 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification.java @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final +class V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent) + super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEvent.java index 0e6d2123045..54d60c31637 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification.java new file mode 100644 index 00000000000..6833033286a --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationRecipientUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationRecipientUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.java index e18e72ec8e8..0a0ca2b4967 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification.java new file mode 100644 index 00000000000..289eb4f0abe --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification.java @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent fetchEvent() + throws StripeException { + return (V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent) + super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEvent.java index d057a78f52d..89701f76748 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification.java new file mode 100644 index 00000000000..6d8159e99a6 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingConfigurationStorerUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountIncludingConfigurationStorerUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEvent.java index ae52d938d29..9df07897f72 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEventNotification.java new file mode 100644 index 00000000000..2362fac5797 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingDefaultsUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingDefaultsUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingDefaultsUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountIncludingDefaultsUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEvent.java index 6765dfbbff9..a2ca6417c0b 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEventNotification.java new file mode 100644 index 00000000000..8c5cb570aee --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingIdentityUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingIdentityUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingIdentityUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountIncludingIdentityUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEvent.java index fdc9c03a996..ae6db587a21 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEventNotification.java new file mode 100644 index 00000000000..6d99ccac484 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingRequirementsUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingRequirementsUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingRequirementsUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountIncludingRequirementsUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountLinkReturnedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountLinkReturnedEventNotification.java new file mode 100644 index 00000000000..22c01a82692 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountLinkReturnedEventNotification.java @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.stripe.exception.StripeException; +import com.stripe.model.v2.EventNotification; + +public final class V2CoreAccountLinkReturnedEventNotification extends EventNotification { + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountLinkReturnedEvent fetchEvent() throws StripeException { + return (V2CoreAccountLinkReturnedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEvent.java index df147f10d99..8ea68e3c48d 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.AccountPerson; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEventNotification.java new file mode 100644 index 00000000000..0d981e7e5b4 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.AccountPerson; +import lombok.Getter; + +@Getter +public final class V2CoreAccountPersonCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public AccountPerson fetchRelatedObject() throws StripeException { + return (AccountPerson) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountPersonCreatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountPersonCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEvent.java index 021e1273d8a..2b1c403623c 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.AccountPerson; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEventNotification.java new file mode 100644 index 00000000000..06e3ac8b55e --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonDeletedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.AccountPerson; +import lombok.Getter; + +@Getter +public final class V2CoreAccountPersonDeletedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public AccountPerson fetchRelatedObject() throws StripeException { + return (AccountPerson) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountPersonDeletedEvent fetchEvent() throws StripeException { + return (V2CoreAccountPersonDeletedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEvent.java index 0ab14ed5003..0b17ebd2c0a 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.AccountPerson; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEventNotification.java new file mode 100644 index 00000000000..b6789389c37 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountPersonUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.AccountPerson; +import lombok.Getter; + +@Getter +public final class V2CoreAccountPersonUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public AccountPerson fetchRelatedObject() throws StripeException { + return (AccountPerson) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountPersonUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountPersonUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountUpdatedEvent.java index ab021a3a5e6..e76cb2c21a4 100644 --- a/src/main/java/com/stripe/events/V2CoreAccountUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreAccountUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.core.Account; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreAccountUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountUpdatedEventNotification.java new file mode 100644 index 00000000000..60fcb1a50d6 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.core.Account; +import lombok.Getter; + +@Getter +public final class V2CoreAccountUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreEventDestinationPingEvent.java b/src/main/java/com/stripe/events/V2CoreEventDestinationPingEvent.java index 7d94b5d35f5..f56280dc61d 100644 --- a/src/main/java/com/stripe/events/V2CoreEventDestinationPingEvent.java +++ b/src/main/java/com/stripe/events/V2CoreEventDestinationPingEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.EventDestination; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2CoreEventDestinationPingEventNotification.java b/src/main/java/com/stripe/events/V2CoreEventDestinationPingEventNotification.java new file mode 100644 index 00000000000..e6d0c7da525 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreEventDestinationPingEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventDestination; +import com.stripe.model.v2.EventNotification; +import lombok.Getter; + +@Getter +public final class V2CoreEventDestinationPingEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public EventDestination fetchRelatedObject() throws StripeException { + return (EventDestination) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreEventDestinationPingEvent fetchEvent() throws StripeException { + return (V2CoreEventDestinationPingEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEvent.java index c49cef0b590..07bd8859901 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.Adjustment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEventNotification.java new file mode 100644 index 00000000000..0ea6e9e5574 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementAdjustmentCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.Adjustment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementAdjustmentCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Adjustment fetchRelatedObject() throws StripeException { + return (Adjustment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementAdjustmentCreatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementAdjustmentCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEvent.java index 577b9adcd73..89ecbea26d1 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.FinancialAccount; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEventNotification.java new file mode 100644 index 00000000000..29b04f53c7d --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountCreatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.FinancialAccount; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementFinancialAccountCreatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public FinancialAccount fetchRelatedObject() throws StripeException { + return (FinancialAccount) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementFinancialAccountCreatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementFinancialAccountCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEvent.java index a25c2f0376f..33edf898615 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.FinancialAccount; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEventNotification.java new file mode 100644 index 00000000000..073e8e54a81 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAccountUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.FinancialAccount; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementFinancialAccountUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public FinancialAccount fetchRelatedObject() throws StripeException { + return (FinancialAccount) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementFinancialAccountUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementFinancialAccountUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEvent.java index a4d553a335c..c4ac42358ef 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.FinancialAddress; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEventNotification.java new file mode 100644 index 00000000000..31ae0273fb8 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressActivatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.FinancialAddress; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementFinancialAddressActivatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public FinancialAddress fetchRelatedObject() throws StripeException { + return (FinancialAddress) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementFinancialAddressActivatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementFinancialAddressActivatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEvent.java index b36da4c2052..240294bb068 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.FinancialAddress; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEventNotification.java new file mode 100644 index 00000000000..bf3aa0f19af --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementFinancialAddressFailedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.FinancialAddress; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementFinancialAddressFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public FinancialAddress fetchRelatedObject() throws StripeException { + return (FinancialAddress) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementFinancialAddressFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementFinancialAddressFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEvent.java index 6b062a0da1f..3047c7bf7fd 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEventNotification.java new file mode 100644 index 00000000000..7e0613a8800 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferAvailableEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferAvailableEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferAvailableEvent fetchEvent() throws StripeException { + return (V2MoneyManagementInboundTransferAvailableEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEvent.java index 45c3609996b..55644f79660 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEventNotification.java new file mode 100644 index 00000000000..954a7595afc --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitFailedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferBankDebitFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferBankDebitFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementInboundTransferBankDebitFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEvent.java index c8ef8383888..d87d4304556 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEventNotification.java new file mode 100644 index 00000000000..0b5ac997bca --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitProcessingEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferBankDebitProcessingEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferBankDebitProcessingEvent fetchEvent() + throws StripeException { + return (V2MoneyManagementInboundTransferBankDebitProcessingEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEvent.java index 440ad713697..5d163fc4f10 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEventNotification.java new file mode 100644 index 00000000000..05fd13e8409 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitQueuedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferBankDebitQueuedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferBankDebitQueuedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementInboundTransferBankDebitQueuedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEvent.java index 7ff0df672fc..bd32c9997ba 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEventNotification.java new file mode 100644 index 00000000000..b6ecfe06b8e --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitReturnedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferBankDebitReturnedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferBankDebitReturnedEvent fetchEvent() + throws StripeException { + return (V2MoneyManagementInboundTransferBankDebitReturnedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEvent.java index a758c8ea3dd..8bf2e732179 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.InboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEventNotification.java new file mode 100644 index 00000000000..1c9a3f081c9 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementInboundTransferBankDebitSucceededEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.InboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementInboundTransferBankDebitSucceededEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public InboundTransfer fetchRelatedObject() throws StripeException { + return (InboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementInboundTransferBankDebitSucceededEvent fetchEvent() + throws StripeException { + return (V2MoneyManagementInboundTransferBankDebitSucceededEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEvent.java index e05cab15362..f5652721144 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEventNotification.java new file mode 100644 index 00000000000..65ec57521cf --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCanceledEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentCanceledEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentCanceledEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentCanceledEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEvent.java index 8199431922b..78d681ab75d 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEventNotification.java new file mode 100644 index 00000000000..4a54ffeebae --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentCreatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentCreatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentCreatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEvent.java index 51e00b2bd8b..543076b6e71 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEventNotification.java new file mode 100644 index 00000000000..3286a458c71 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentFailedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEvent.java index 97094ba5707..d2e2ffffdf2 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEventNotification.java new file mode 100644 index 00000000000..b60d2aa1d01 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentPostedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentPostedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentPostedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentPostedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEvent.java index 20cd3e99d59..56f44a37c3f 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEventNotification.java new file mode 100644 index 00000000000..00ef67dae2b --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentReturnedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentReturnedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentReturnedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentReturnedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEvent.java index df6a44bf6d6..399fda693cc 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEventNotification.java new file mode 100644 index 00000000000..c0b858a1956 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundPaymentUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundPayment; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundPaymentUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundPayment fetchRelatedObject() throws StripeException { + return (OutboundPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundPaymentUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundPaymentUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEvent.java index 7bdefa71434..83b4caa79d3 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEventNotification.java new file mode 100644 index 00000000000..2c04fd3724e --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCanceledEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferCanceledEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferCanceledEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferCanceledEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEvent.java index c6a7e72cd73..10dd840e974 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEventNotification.java new file mode 100644 index 00000000000..5f114d7cb77 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferCreatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferCreatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferCreatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEvent.java index becbaa18022..e50febc0a6e 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEventNotification.java new file mode 100644 index 00000000000..7bb69333287 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferFailedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEvent.java index f83c3fdc514..09223087b5e 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEventNotification.java new file mode 100644 index 00000000000..61f2b11147f --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferPostedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferPostedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferPostedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferPostedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEvent.java index edf505e25ad..b2e7562901f 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEventNotification.java new file mode 100644 index 00000000000..1e5682041e2 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferReturnedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferReturnedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferReturnedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferReturnedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEvent.java index cb00fd9ae7b..ad134388a6f 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.OutboundTransfer; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEventNotification.java new file mode 100644 index 00000000000..e74007aa889 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementOutboundTransferUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.OutboundTransfer; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementOutboundTransferUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OutboundTransfer fetchRelatedObject() throws StripeException { + return (OutboundTransfer) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementOutboundTransferUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementOutboundTransferUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEvent.java index ac0fef5e97e..3204e532be0 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.PayoutMethod; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEventNotification.java new file mode 100644 index 00000000000..8b571b385e3 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementPayoutMethodUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.PayoutMethod; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementPayoutMethodUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public PayoutMethod fetchRelatedObject() throws StripeException { + return (PayoutMethod) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementPayoutMethodUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementPayoutMethodUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEvent.java index 827216bff82..844431bb728 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedCredit; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEventNotification.java new file mode 100644 index 00000000000..b116ede1d4a --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditAvailableEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedCredit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedCreditAvailableEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedCredit fetchRelatedObject() throws StripeException { + return (ReceivedCredit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedCreditAvailableEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedCreditAvailableEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEvent.java index b586e3b640f..83f572e3dcf 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedCredit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEventNotification.java new file mode 100644 index 00000000000..3715ca966d3 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditFailedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedCredit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedCreditFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedCredit fetchRelatedObject() throws StripeException { + return (ReceivedCredit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedCreditFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedCreditFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEvent.java index fd09a5a73d8..d6fc3586e29 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedCredit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEventNotification.java new file mode 100644 index 00000000000..36b16347614 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditReturnedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedCredit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedCreditReturnedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedCredit fetchRelatedObject() throws StripeException { + return (ReceivedCredit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedCreditReturnedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedCreditReturnedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEvent.java index ce9892bc56e..c30b7123954 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedCredit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEventNotification.java new file mode 100644 index 00000000000..31423c75961 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedCreditSucceededEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedCredit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedCreditSucceededEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedCredit fetchRelatedObject() throws StripeException { + return (ReceivedCredit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedCreditSucceededEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedCreditSucceededEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEvent.java index 0b7e444652d..e4d2bd9f139 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedDebit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEventNotification.java new file mode 100644 index 00000000000..0ebb50ac13a --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitCanceledEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedDebit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedDebitCanceledEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedDebit fetchRelatedObject() throws StripeException { + return (ReceivedDebit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedDebitCanceledEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedDebitCanceledEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEvent.java index 4444c09fb7f..b686d6f66e7 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedDebit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEventNotification.java new file mode 100644 index 00000000000..fb41b5494ef --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitFailedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedDebit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedDebitFailedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedDebit fetchRelatedObject() throws StripeException { + return (ReceivedDebit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedDebitFailedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedDebitFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEvent.java index 6c31ee3f30d..2dc23c0bda7 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedDebit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEventNotification.java new file mode 100644 index 00000000000..40a91fef0ef --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitPendingEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedDebit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedDebitPendingEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedDebit fetchRelatedObject() throws StripeException { + return (ReceivedDebit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedDebitPendingEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedDebitPendingEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEvent.java index 7a7b1b1371f..d3da8915b91 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedDebit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEventNotification.java new file mode 100644 index 00000000000..7e67345ee78 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitSucceededEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedDebit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedDebitSucceededEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedDebit fetchRelatedObject() throws StripeException { + return (ReceivedDebit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedDebitSucceededEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedDebitSucceededEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEvent.java index 5bac7233606..47abad46148 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.ReceivedDebit; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEventNotification.java new file mode 100644 index 00000000000..bfea1d5cf8a --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementReceivedDebitUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.ReceivedDebit; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementReceivedDebitUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public ReceivedDebit fetchRelatedObject() throws StripeException { + return (ReceivedDebit) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementReceivedDebitUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementReceivedDebitUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEvent.java index a1b1fab15f7..f3460fca31e 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.Transaction; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEventNotification.java new file mode 100644 index 00000000000..326c49e9422 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementTransactionCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.Transaction; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementTransactionCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Transaction fetchRelatedObject() throws StripeException { + return (Transaction) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementTransactionCreatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementTransactionCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEvent.java b/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEvent.java index d005e359a54..e974da3f02b 100644 --- a/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEvent.java +++ b/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.moneymanagement.Transaction; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEventNotification.java new file mode 100644 index 00000000000..c7252c61bc0 --- /dev/null +++ b/src/main/java/com/stripe/events/V2MoneyManagementTransactionUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.moneymanagement.Transaction; +import lombok.Getter; + +@Getter +public final class V2MoneyManagementTransactionUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Transaction fetchRelatedObject() throws StripeException { + return (Transaction) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2MoneyManagementTransactionUpdatedEvent fetchEvent() throws StripeException { + return (V2MoneyManagementTransactionUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent.java index dcfd26ea0be..90c1aa77008 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification.java new file mode 100644 index 00000000000..1f5d0bae0e9 --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent fetchEvent() + throws StripeException { + return (V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent.java index e5e4529cd04..9864372f9f7 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification.java new file mode 100644 index 00000000000..2b1a9c22202 --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent fetchEvent() + throws StripeException { + return (V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEvent.java index dcc0b2fef50..23fdf2c6eef 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEventNotification.java new file mode 100644 index 00000000000..d2d27218d0f --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCanceledEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentCanceledEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentCanceledEvent fetchEvent() throws StripeException { + return (V2PaymentsOffSessionPaymentCanceledEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEvent.java index 4ea1f62dda1..7e4a282de49 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEventNotification.java new file mode 100644 index 00000000000..a458e987631 --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentCreatedEvent fetchEvent() throws StripeException { + return (V2PaymentsOffSessionPaymentCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEvent.java index cb294e12b12..19194defedf 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEventNotification.java new file mode 100644 index 00000000000..64326c604ff --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentFailedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentFailedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentFailedEvent fetchEvent() throws StripeException { + return (V2PaymentsOffSessionPaymentFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEvent.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEvent.java index 53e3a37eb7c..0de7e6b2e8b 100644 --- a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEvent.java +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEvent.java @@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; import com.stripe.model.v2.Event; +import com.stripe.model.v2.Event.RelatedObject; import com.stripe.model.v2.payments.OffSessionPayment; import lombok.Getter; diff --git a/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEventNotification.java b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEventNotification.java new file mode 100644 index 00000000000..8d3af017182 --- /dev/null +++ b/src/main/java/com/stripe/events/V2PaymentsOffSessionPaymentSucceededEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.payments.OffSessionPayment; +import lombok.Getter; + +@Getter +public final class V2PaymentsOffSessionPaymentSucceededEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public OffSessionPayment fetchRelatedObject() throws StripeException { + return (OffSessionPayment) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2PaymentsOffSessionPaymentSucceededEvent fetchEvent() throws StripeException { + return (V2PaymentsOffSessionPaymentSucceededEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/examples/ThinEventWebhookHandler.java b/src/main/java/com/stripe/examples/EventNotificationWebhookHandler.java similarity index 56% rename from src/main/java/com/stripe/examples/ThinEventWebhookHandler.java rename to src/main/java/com/stripe/examples/EventNotificationWebhookHandler.java index f26cdf99bae..d5869d57281 100644 --- a/src/main/java/com/stripe/examples/ThinEventWebhookHandler.java +++ b/src/main/java/com/stripe/examples/EventNotificationWebhookHandler.java @@ -2,10 +2,12 @@ import com.stripe.StripeClient; import com.stripe.events.V1BillingMeterErrorReportTriggeredEvent; +import com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification; import com.stripe.exception.StripeException; -import com.stripe.model.ThinEvent; import com.stripe.model.billing.Meter; import com.stripe.model.v2.Event; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.UnknownEventNotification; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; @@ -16,18 +18,18 @@ import java.nio.charset.StandardCharsets; /** - * Receive and process thin events like the v1.billing.meter.error_report_triggered event. + * Receive and process EventNotifications like the v1.billing.meter.error_report_triggered event. * *

In this example, we: * *

*/ -public class ThinEventWebhookHandler { +public class EventNotificationWebhookHandler { private static final String API_KEY = System.getenv("STRIPE_API_KEY"); private static final String WEBHOOK_SECRET = System.getenv("WEBHOOK_SECRET"); @@ -65,20 +67,34 @@ public void handle(HttpExchange exchange) throws IOException { String sigHeader = exchange.getRequestHeaders().getFirst("Stripe-Signature"); try { - ThinEvent thinEvent = client.parseThinEvent(webhookBody, sigHeader, WEBHOOK_SECRET); + EventNotification eventNotif = + client.parseEventNotification(webhookBody, sigHeader, WEBHOOK_SECRET); - // Fetch the event data to understand the failure - Event baseEvent = client.v2().core().events().retrieve(thinEvent.getId()); - if (baseEvent instanceof V1BillingMeterErrorReportTriggeredEvent) { - V1BillingMeterErrorReportTriggeredEvent event = - (V1BillingMeterErrorReportTriggeredEvent) baseEvent; - Meter meter = event.fetchRelatedObject(); + // determine what sort of event you have + if (eventNotif instanceof V1BillingMeterErrorReportTriggeredEventNotification) { + V1BillingMeterErrorReportTriggeredEventNotification eventNotification = + (V1BillingMeterErrorReportTriggeredEventNotification) eventNotif; - String meterId = meter.getId(); - System.out.println(meterId); + // after casting, can fetch the related object (which is correctly typed) + Meter meter = eventNotification.fetchRelatedObject(); + System.out.println(meter.getId()); - // Record the failures and alert your team - // Add your logic here + V1BillingMeterErrorReportTriggeredEvent event = eventNotification.fetchEvent(); + System.out.println(event.getData().getDeveloperMessageSummary()); + + // add additional logic + } + // ... check other event types you know about + else if (eventNotif instanceof UnknownEventNotification) { + UnknownEventNotification unknownEvent = (UnknownEventNotification) eventNotif; + System.out.println("Received unknown event: " + unknownEvent.getId()); + // can keep matching on the "type" field + // other helper methods still work, but you'll have to handle types yourself + if (unknownEvent.getType().equals("some.new.event")) { + Event event = unknownEvent.fetchEvent(); + System.out.println(event.getReason()); + // handle + } } exchange.sendResponseHeaders(200, -1); diff --git a/src/main/java/com/stripe/model/ThinEvent.java b/src/main/java/com/stripe/model/ThinEvent.java deleted file mode 100644 index 5b7bd129c17..00000000000 --- a/src/main/java/com/stripe/model/ThinEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.stripe.model; - -import com.google.gson.annotations.SerializedName; -import java.time.Instant; -import lombok.Getter; - -/** - * ThinEvent represents the json that's delivered from an Event Destination. It's a basic class with - * no additional methods or properties. Use it to check basic information about a delivered event. - * If you want more details, use `stripeClient.v2().core().events().retrieve(thin_event.id)` to - * fetch the full event object. - */ -@Getter -public class ThinEvent { - /** Unique identifier for the event. */ - @SerializedName("id") - public String id; - - /** The type of the event. */ - @SerializedName("type") - public String type; - - /** Time at which the object was created. */ - @SerializedName("created") - public Instant created; - - /** Livemode indicates if the event is from a production(true) or test(false) account. */ - @SerializedName("livemode") - public Boolean livemode; - - /** [Optional] Authentication context needed to fetch the event or related object. */ - @SerializedName("context") - public String context; - - /** [Optional] Object containing the reference to API resource relevant to the event. */ - @SerializedName("related_object") - public ThinEventRelatedObject relatedObject; - - /** [Optional] Reason for the event. */ - @SerializedName("reason") - public com.stripe.model.v2.Event.Reason reason; -} diff --git a/src/main/java/com/stripe/model/ThinEventRelatedObject.java b/src/main/java/com/stripe/model/ThinEventRelatedObject.java deleted file mode 100644 index 48ea526eca3..00000000000 --- a/src/main/java/com/stripe/model/ThinEventRelatedObject.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.stripe.model; - -import com.google.gson.annotations.SerializedName; -import lombok.Getter; - -@Getter -public class ThinEventRelatedObject { - @SerializedName("id") - public String id; - - @SerializedName("type") - public String type; - - @SerializedName("url") - public String url; -} diff --git a/src/main/java/com/stripe/model/v2/EventNotification.java b/src/main/java/com/stripe/model/v2/EventNotification.java new file mode 100644 index 00000000000..33866cf95e7 --- /dev/null +++ b/src/main/java/com/stripe/model/v2/EventNotification.java @@ -0,0 +1,134 @@ +package com.stripe.model.v2; + +import com.google.gson.JsonObject; +import com.google.gson.annotations.SerializedName; +import com.stripe.StripeClient; +import com.stripe.exception.StripeException; +import com.stripe.model.StripeObject; +import com.stripe.model.v2.Event.RelatedObject; +import com.stripe.net.ApiMode; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiResource.RequestMethod; +import com.stripe.net.RawRequestOptions; +import com.stripe.net.StripeResponse; +import java.time.Instant; +import lombok.AccessLevel; +import lombok.Getter; + +/** + * `EventNotification` represents the common properties for json that's delivered from an Event + * Destination. A concrete child of `EventNotification` will be returned from + * `StripeClient.parseEventNotificaion()`. You will likely want to cast that object to a more + * specific child of `EventNotification`, like `PushedV1BillingMeterErrorReportTriggeredEvent` + */ +@Getter +public abstract class EventNotification { + /** + * For more details about Request, please refer to the API + * Reference. + */ + @Getter + public static class Request { + /** ID of the API request that caused the event. */ + @SerializedName("id") + String id; + + /** The idempotency key transmitted during the request. */ + @SerializedName("idempotency_key") + String idempotencyKey; + } + + @Getter + public static class Reason { + /** Information on the API request that instigated the event. */ + @SerializedName("request") + Request request; + + /** + * Event reason type. + * + *

Equal to {@code request}. + */ + @SerializedName("type") + String type; + } + + /** Unique identifier for the event. */ + @SerializedName("id") + public String id; + + /** The type of the event. */ + @SerializedName("type") + public String type; + + /** Time at which the object was created. */ + @SerializedName("created") + public Instant created; + + /** Livemode indicates if the event is from a production(true) or test(false) account. */ + @SerializedName("livemode") + public Boolean livemode; + + /** [Optional] Authentication context needed to fetch the event or related object. */ + @SerializedName("context") + public String context; + + /** [Optional] Reason for the event. */ + @SerializedName("reason") + public Reason reason; + + @Getter(AccessLevel.NONE) + protected transient StripeClient client; + + /** + * Helper for constructing an Event Notification. Doesn't perform signature validation, so you + * should use {@link com.stripe.StripeClient#parseEventNotification} instead for initial handling. + * This is useful in unit tests and working with EventNotifications that you've already validated + * the authenticity of. + */ + public static EventNotification fromJson(String payload, StripeClient client) { + // don't love the double json parse here, but I don't think we can avoid it? + JsonObject jsonObject = ApiResource.GSON.fromJson(payload, JsonObject.class).getAsJsonObject(); + + Class cls = + EventNotificationClassLookup.eventClassLookup.get(jsonObject.get("type").getAsString()); + if (cls == null) { + cls = UnknownEventNotification.class; + } + + EventNotification e = ApiResource.GSON.fromJson(payload, cls); + e.client = client; + return e; + } + + private RawRequestOptions getRequestOptions() { + if (context == null) { + return null; + } + return new RawRequestOptions.RawRequestOptionsBuilder().setStripeContext(context).build(); + } + + /* retrieves the full payload for an event. Protected because individual push classes use it, but type it correctly */ + protected Event fetchEvent() throws StripeException { + StripeResponse response = + client.rawRequest( + RequestMethod.GET, String.format("/v2/core/events/%s", id), null, getRequestOptions()); + + return (Event) client.deserialize(response.body(), ApiMode.V2); + } + + /** Retrieves the object associated with the event. */ + protected StripeObject fetchRelatedObject(RelatedObject relatedObject) throws StripeException { + if (relatedObject == null) { + // used by UnknownEventNotification, so be a little defensive + return null; + } + + String relativeUrl = relatedObject.getUrl(); + + StripeResponse response = + client.rawRequest(RequestMethod.GET, relativeUrl, null, getRequestOptions()); + + return client.deserialize(response.body(), ApiMode.getMode(relativeUrl)); + } +} diff --git a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java new file mode 100644 index 00000000000..88ece3628cc --- /dev/null +++ b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java @@ -0,0 +1,220 @@ +// File generated from our OpenAPI spec +package com.stripe.model.v2; + +import java.util.HashMap; +import java.util.Map; + +/** + * Event data class look up used in event deserialization. The key to look up is `object` string of + * the model. + * + *

For internal use by Stripe SDK only. + */ +public final class EventNotificationClassLookup { + public static final Map> eventClassLookup = + new HashMap<>(); + + static { + eventClassLookup.put( + "v1.billing.meter.error_report_triggered", + com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification.class); + eventClassLookup.put( + "v1.billing.meter.no_meter_found", + com.stripe.events.V1BillingMeterNoMeterFoundEventNotification.class); + eventClassLookup.put( + "v2.billing.bill_setting.updated", + com.stripe.events.V2BillingBillSettingUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account.closed", com.stripe.events.V2CoreAccountClosedEventNotification.class); + eventClassLookup.put( + "v2.core.account.created", com.stripe.events.V2CoreAccountCreatedEventNotification.class); + eventClassLookup.put( + "v2.core.account.updated", com.stripe.events.V2CoreAccountUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account[configuration.customer].capability_status_updated", + com.stripe.events + .V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.customer].updated", + com.stripe.events.V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.merchant].capability_status_updated", + com.stripe.events + .V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.merchant].updated", + com.stripe.events.V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.recipient].capability_status_updated", + com.stripe.events + .V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.recipient].updated", + com.stripe.events.V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.storer].capability_status_updated", + com.stripe.events + .V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification + .class); + eventClassLookup.put( + "v2.core.account[configuration.storer].updated", + com.stripe.events.V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account[defaults].updated", + com.stripe.events.V2CoreAccountIncludingDefaultsUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account[identity].updated", + com.stripe.events.V2CoreAccountIncludingIdentityUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account[requirements].updated", + com.stripe.events.V2CoreAccountIncludingRequirementsUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account_link.returned", + com.stripe.events.V2CoreAccountLinkReturnedEventNotification.class); + eventClassLookup.put( + "v2.core.account_person.created", + com.stripe.events.V2CoreAccountPersonCreatedEventNotification.class); + eventClassLookup.put( + "v2.core.account_person.deleted", + com.stripe.events.V2CoreAccountPersonDeletedEventNotification.class); + eventClassLookup.put( + "v2.core.account_person.updated", + com.stripe.events.V2CoreAccountPersonUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.event_destination.ping", + com.stripe.events.V2CoreEventDestinationPingEventNotification.class); + eventClassLookup.put( + "v2.money_management.adjustment.created", + com.stripe.events.V2MoneyManagementAdjustmentCreatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.financial_account.created", + com.stripe.events.V2MoneyManagementFinancialAccountCreatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.financial_account.updated", + com.stripe.events.V2MoneyManagementFinancialAccountUpdatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.financial_address.activated", + com.stripe.events.V2MoneyManagementFinancialAddressActivatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.financial_address.failed", + com.stripe.events.V2MoneyManagementFinancialAddressFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.available", + com.stripe.events.V2MoneyManagementInboundTransferAvailableEventNotification.class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.bank_debit_failed", + com.stripe.events.V2MoneyManagementInboundTransferBankDebitFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.bank_debit_processing", + com.stripe.events.V2MoneyManagementInboundTransferBankDebitProcessingEventNotification + .class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.bank_debit_queued", + com.stripe.events.V2MoneyManagementInboundTransferBankDebitQueuedEventNotification.class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.bank_debit_returned", + com.stripe.events.V2MoneyManagementInboundTransferBankDebitReturnedEventNotification.class); + eventClassLookup.put( + "v2.money_management.inbound_transfer.bank_debit_succeeded", + com.stripe.events.V2MoneyManagementInboundTransferBankDebitSucceededEventNotification + .class); + eventClassLookup.put( + "v2.money_management.outbound_payment.canceled", + com.stripe.events.V2MoneyManagementOutboundPaymentCanceledEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_payment.created", + com.stripe.events.V2MoneyManagementOutboundPaymentCreatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_payment.failed", + com.stripe.events.V2MoneyManagementOutboundPaymentFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_payment.posted", + com.stripe.events.V2MoneyManagementOutboundPaymentPostedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_payment.returned", + com.stripe.events.V2MoneyManagementOutboundPaymentReturnedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_payment.updated", + com.stripe.events.V2MoneyManagementOutboundPaymentUpdatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.canceled", + com.stripe.events.V2MoneyManagementOutboundTransferCanceledEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.created", + com.stripe.events.V2MoneyManagementOutboundTransferCreatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.failed", + com.stripe.events.V2MoneyManagementOutboundTransferFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.posted", + com.stripe.events.V2MoneyManagementOutboundTransferPostedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.returned", + com.stripe.events.V2MoneyManagementOutboundTransferReturnedEventNotification.class); + eventClassLookup.put( + "v2.money_management.outbound_transfer.updated", + com.stripe.events.V2MoneyManagementOutboundTransferUpdatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.payout_method.updated", + com.stripe.events.V2MoneyManagementPayoutMethodUpdatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_credit.available", + com.stripe.events.V2MoneyManagementReceivedCreditAvailableEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_credit.failed", + com.stripe.events.V2MoneyManagementReceivedCreditFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_credit.returned", + com.stripe.events.V2MoneyManagementReceivedCreditReturnedEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_credit.succeeded", + com.stripe.events.V2MoneyManagementReceivedCreditSucceededEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_debit.canceled", + com.stripe.events.V2MoneyManagementReceivedDebitCanceledEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_debit.failed", + com.stripe.events.V2MoneyManagementReceivedDebitFailedEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_debit.pending", + com.stripe.events.V2MoneyManagementReceivedDebitPendingEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_debit.succeeded", + com.stripe.events.V2MoneyManagementReceivedDebitSucceededEventNotification.class); + eventClassLookup.put( + "v2.money_management.received_debit.updated", + com.stripe.events.V2MoneyManagementReceivedDebitUpdatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.transaction.created", + com.stripe.events.V2MoneyManagementTransactionCreatedEventNotification.class); + eventClassLookup.put( + "v2.money_management.transaction.updated", + com.stripe.events.V2MoneyManagementTransactionUpdatedEventNotification.class); + eventClassLookup.put( + "v2.payments.off_session_payment.authorization_attempt_failed", + com.stripe.events.V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification + .class); + eventClassLookup.put( + "v2.payments.off_session_payment.authorization_attempt_started", + com.stripe.events.V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification + .class); + eventClassLookup.put( + "v2.payments.off_session_payment.canceled", + com.stripe.events.V2PaymentsOffSessionPaymentCanceledEventNotification.class); + eventClassLookup.put( + "v2.payments.off_session_payment.created", + com.stripe.events.V2PaymentsOffSessionPaymentCreatedEventNotification.class); + eventClassLookup.put( + "v2.payments.off_session_payment.failed", + com.stripe.events.V2PaymentsOffSessionPaymentFailedEventNotification.class); + eventClassLookup.put( + "v2.payments.off_session_payment.succeeded", + com.stripe.events.V2PaymentsOffSessionPaymentSucceededEventNotification.class); + } +} diff --git a/src/main/java/com/stripe/model/v2/UnknownEventNotification.java b/src/main/java/com/stripe/model/v2/UnknownEventNotification.java new file mode 100644 index 00000000000..f8f2e37559f --- /dev/null +++ b/src/main/java/com/stripe/model/v2/UnknownEventNotification.java @@ -0,0 +1,35 @@ +package com.stripe.model.v2; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.StripeObject; +import com.stripe.model.v2.Event.RelatedObject; +import lombok.Getter; + +/** + * Represents a valid EventNotification that the SDK doesn't have a type for. May have a + * `relatedObject` property. + */ +@Getter +public class UnknownEventNotification extends EventNotification { + /** [Optional] Object containing the reference to API resource relevant to the event. */ + @SerializedName("related_object") + public RelatedObject relatedObject; + + /** + * Will make the API call to fetch a related object, if possible. The returned object will have + * the correct type at runtime, but type information about it isn't known at compile time. + */ + public StripeObject fetchRelatedObject() throws StripeException { + return super.fetchRelatedObject(this.relatedObject); + } + + /** + * Will make the API call to fetch a related object, if possible. The returned object will have + * the correct type at runtime, but type information about it isn't known at compile time. + */ + @Override + public Event fetchEvent() throws StripeException { + return super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/net/ApiMode.java b/src/main/java/com/stripe/net/ApiMode.java index f9c7e340500..164af7b848a 100644 --- a/src/main/java/com/stripe/net/ApiMode.java +++ b/src/main/java/com/stripe/net/ApiMode.java @@ -2,5 +2,15 @@ public enum ApiMode { V1, - V2 + V2; + + public static ApiMode getMode(String url) { + if (url.startsWith("/v2")) { + return ApiMode.V2; + } + + // some urls, like `/oauth`, don't start with `/v1`. So just assume anything without `/v2` is + // v1. + return ApiMode.V1; + } } diff --git a/src/main/java/com/stripe/net/ApiRequest.java b/src/main/java/com/stripe/net/ApiRequest.java index cc318fb9f46..4125444bb01 100644 --- a/src/main/java/com/stripe/net/ApiRequest.java +++ b/src/main/java/com/stripe/net/ApiRequest.java @@ -19,7 +19,7 @@ private ApiRequest( Map params) { super(baseAddress, method, path, options, usage); this.params = params; - this.apiMode = path.startsWith("/v2") ? ApiMode.V2 : ApiMode.V1; + this.apiMode = ApiMode.getMode(path); } public ApiRequest( diff --git a/src/main/java/com/stripe/net/RawApiRequest.java b/src/main/java/com/stripe/net/RawApiRequest.java index 10ff94aafdd..78a2bc207b8 100644 --- a/src/main/java/com/stripe/net/RawApiRequest.java +++ b/src/main/java/com/stripe/net/RawApiRequest.java @@ -22,7 +22,7 @@ private RawApiRequest( super(baseAddress, method, path, options, usage); this.rawContent = rawContent; this.options = options; - this.apiMode = path.startsWith("/v2") ? ApiMode.V2 : ApiMode.V1; + this.apiMode = ApiMode.getMode(path); } public RawApiRequest( diff --git a/src/test/java/com/stripe/BaseStripeTest.java b/src/test/java/com/stripe/BaseStripeTest.java index 847dd57cfb1..a0843ce4385 100644 --- a/src/test/java/com/stripe/BaseStripeTest.java +++ b/src/test/java/com/stripe/BaseStripeTest.java @@ -186,7 +186,7 @@ public static void verifyRequest( * Verifies that a request was made with the provided parameters. * * @param method HTTP method (GET, POST or DELETE) - * @param path request path (e.g. "/v1/charges"). Can also be an abolute URL. + * @param path request path (e.g. "/v1/charges"). Can also be an absolute URL. * @param params map containing the parameters. If null, the parameters are not checked. * @param options request options. If null, the options are not checked. */ @@ -320,7 +320,7 @@ public static void stubRequest( * stripe-mock yet. * * @param method HTTP method (GET, POST or DELETE) - * @param path request path (e.g. "/v1/charges"). Can also be an abolute URL. + * @param path request path (e.g. "/v1/charges"). Can also be an absolute URL. * @param params map containing the parameters. If null, the parameters are not checked. * @param options request options. If null, the options are not checked. * @param typeToken Class of the API resource that will be returned for the stubbed request. @@ -356,7 +356,7 @@ public static void stubRequest( * stripe-mock yet. * * @param method HTTP method (GET, POST or DELETE) - * @param path request path (e.g. "/v1/charges"). Can also be an abolute URL. + * @param path request path (e.g. "/v1/charges"). Can also be an absolute URL. * @param params map containing the parameters. If null, the parameters are not checked. * @param options request options. If null, the options are not checked. * @param typeToken Class of the API resource that will be returned for the stubbed request. diff --git a/src/test/java/com/stripe/StripeClientTest.java b/src/test/java/com/stripe/StripeClientTest.java index a0355e86273..f8c18ce31a7 100644 --- a/src/test/java/com/stripe/StripeClientTest.java +++ b/src/test/java/com/stripe/StripeClientTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertThrows; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -9,20 +10,29 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import com.stripe.events.V1BillingMeterErrorReportTriggeredEvent; +import com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification; +import com.stripe.events.V1BillingMeterNoMeterFoundEventNotification; import com.stripe.exception.SignatureVerificationException; import com.stripe.exception.StripeException; -import com.stripe.model.ThinEvent; +import com.stripe.model.billing.Meter; import com.stripe.model.terminal.Reader; +import com.stripe.model.v2.Event; +import com.stripe.model.v2.EventNotification; +import com.stripe.model.v2.UnknownEventNotification; import com.stripe.net.*; +import com.stripe.net.ApiResource.RequestMethod; import java.lang.reflect.Type; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.time.Instant; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -129,7 +139,8 @@ public void checksWebhookSignature() throws InvalidKeyException, NoSuchAlgorithmException, SignatureVerificationException { StripeClient client = new StripeClient("sk_123"); - String payload = "{\n \"id\": \"evt_test_webhook\",\n \"object\": \"event\"\n}"; + String payload = + "{\n \"id\": \"evt_test_webhook\",\n \"type\": \"v1.whatever\",\n \"object\": \"event\"\n}"; String secret = "whsec_test_secret"; Map options = new HashMap<>(); @@ -138,7 +149,7 @@ public void checksWebhookSignature() String signature = WebhookTest.generateSigHeader(options); - ThinEvent e = client.parseThinEvent(payload, signature, secret); + EventNotification e = client.parseEventNotification(payload, signature, secret); assertEquals(e.getId(), "evt_test_webhook"); } @@ -147,44 +158,56 @@ public void failsWebhookVerification() throws InvalidKeyException, NoSuchAlgorithmException, SignatureVerificationException { StripeClient client = new StripeClient("sk_123"); - String payload = "{\n \"id\": \"evt_test_webhook\",\n \"object\": \"event\"\n}"; + String payload = + "{\n \"id\": \"evt_test_webhook\",\n \"type\": \"v1.whatever\",\n \"object\": \"event\"\n}"; String secret = "whsec_test_secret"; String signature = "bad signature"; assertThrows( SignatureVerificationException.class, () -> { - client.parseThinEvent(payload, signature, secret); + client.parseEventNotification(payload, signature, secret); }); } - static final String v2PushEventWithRelatedObject = + static final String v2EventNotificationWithRelatedObject = "{\n" + " \"id\": \"evt_234\",\n" + " \"object\": \"event\",\n" - + " \"type\": \"financial_account.balance.opened\",\n" + + " \"type\": \"v1.billing.meter.error_report_triggered\",\n" + " \"livemode\": false,\n" + + " \"context\": \"org_123\",\n" + " \"created\": \"2022-02-15T00:27:45.330Z\",\n" - + " \"context\": \"context 123\",\n" + " \"related_object\": {\n" - + " \"id\": \"fa_123\",\n" - + " \"type\": \"financial_account\",\n" - + " \"url\": \"/v2/financial_accounts/fa_123\",\n" - + " \"stripe_context\": \"acct_123\"\n" - + " }\n" + + " \"id\": \"meter_123\",\n" + + " \"type\": \"billing.meter\",\n" + + " \"url\": \"/v1/billing/meter/meter_123\"" + + " },\n" + + " \"reason\": { \"type\": \"request\", \"request\": {\n" + + " \"id\": \"abc123\", \"idempotency_key\": \"qwer\"}\n" + + " }" + "}"; - static final String v2PushEventWithoutRelatedObject = + static final String v2EventNotificationWithoutRelatedObject = "{\n" + " \"id\": \"evt_234\",\n" + " \"object\": \"event\",\n" - + " \"type\": \"financial_account.balance.opened\",\n" + + " \"type\": \"v1.billing.meter.no_meter_found\",\n" + + " \"livemode\": false,\n" + + " \"created\": \"2022-02-15T00:27:45.330Z\"\n" + + "}"; + + static final String v2UnknownEventNotification = + "{\n" + + " \"id\": \"evt_234\",\n" + + " \"object\": \"event\",\n" + + " \"type\": \"v1.imaginary_event\",\n" + " \"livemode\": false,\n" + " \"created\": \"2022-02-15T00:27:45.330Z\"\n" + "}"; @Test - public void parsesThinEventWithoutRelatedObject() + public void parsesEventNotificationWithoutRelatedObject() throws InvalidKeyException, NoSuchAlgorithmException, SignatureVerificationException { StripeClient client = new StripeClient("sk_123"); @@ -192,22 +215,22 @@ public void parsesThinEventWithoutRelatedObject() String secret = "whsec_test_secret"; Map options = new HashMap<>(); - options.put("payload", v2PushEventWithoutRelatedObject); + options.put("payload", v2EventNotificationWithoutRelatedObject); options.put("secret", secret); String signature = WebhookTest.generateSigHeader(options); - ThinEvent baseThinEvent = - client.parseThinEvent(v2PushEventWithoutRelatedObject, signature, secret); - assertNotNull(baseThinEvent); - assertEquals("evt_234", baseThinEvent.getId()); - assertEquals("financial_account.balance.opened", baseThinEvent.getType()); - assertEquals(Instant.parse("2022-02-15T00:27:45.330Z"), baseThinEvent.created); - assertNull(baseThinEvent.context); - assertNull(baseThinEvent.relatedObject); + EventNotification eventNotification = + client.parseEventNotification(v2EventNotificationWithoutRelatedObject, signature, secret); + assertNotNull(eventNotification); + assertEquals("evt_234", eventNotification.getId()); + assertEquals("v1.billing.meter.no_meter_found", eventNotification.getType()); + assertEquals(Instant.parse("2022-02-15T00:27:45.330Z"), eventNotification.created); + assertNull(eventNotification.context); + assertInstanceOf(V1BillingMeterNoMeterFoundEventNotification.class, eventNotification); } @Test - public void parsesThinEventWithRelatedObject() + public void parsesEventNotificationWithRelatedObject() throws InvalidKeyException, NoSuchAlgorithmException, SignatureVerificationException { StripeClient client = new StripeClient("sk_123"); @@ -215,21 +238,69 @@ public void parsesThinEventWithRelatedObject() String secret = "whsec_test_secret"; Map options = new HashMap<>(); - options.put("payload", v2PushEventWithRelatedObject); + options.put("payload", v2EventNotificationWithRelatedObject); options.put("secret", secret); String signature = WebhookTest.generateSigHeader(options); - ThinEvent baseThinEvent = - client.parseThinEvent(v2PushEventWithRelatedObject, signature, secret); - assertNotNull(baseThinEvent); - assertEquals("evt_234", baseThinEvent.getId()); - assertEquals("financial_account.balance.opened", baseThinEvent.getType()); - assertEquals(Instant.parse("2022-02-15T00:27:45.330Z"), baseThinEvent.created); - assertEquals("context 123", baseThinEvent.context); - assertNotNull(baseThinEvent.relatedObject); - assertEquals("fa_123", baseThinEvent.relatedObject.id); - assertEquals("financial_account", baseThinEvent.relatedObject.type); - assertEquals("/v2/financial_accounts/fa_123", baseThinEvent.relatedObject.url); + EventNotification eventNotification = + client.parseEventNotification(v2EventNotificationWithRelatedObject, signature, secret); + assertNotNull(eventNotification); + assertEquals("evt_234", eventNotification.getId()); + assertEquals("v1.billing.meter.error_report_triggered", eventNotification.getType()); + assertEquals(Instant.parse("2022-02-15T00:27:45.330Z"), eventNotification.created); + assertEquals("org_123", eventNotification.context); + assertInstanceOf(V1BillingMeterErrorReportTriggeredEventNotification.class, eventNotification); + assertEquals("request", eventNotification.getReason().getType()); + assertEquals("abc123", eventNotification.getReason().getRequest().getId()); + + V1BillingMeterErrorReportTriggeredEventNotification e = + (V1BillingMeterErrorReportTriggeredEventNotification) eventNotification; + + assertNotNull(e.getRelatedObject()); + assertEquals("meter_123", e.getRelatedObject().getId()); + assertEquals("billing.meter", e.getRelatedObject().getType()); + assertEquals("/v1/billing/meter/meter_123", e.getRelatedObject().getUrl()); + } + + @Test + public void parsesUnknownEventNotification() + throws InvalidKeyException, NoSuchAlgorithmException, StripeException { + + StripeClient client = new StripeClient(networkSpy); + + // the existing stubRequest doesn't support rawRequest, so we'll stub manually here + Mockito.doAnswer( + invocation -> { + RawApiRequest request = invocation.getArgument(0); + String path = request.getPath(); + + if (request.getMethod() == RequestMethod.GET + && path.equals("/v2/core/events/evt_234")) { + return new StripeResponse( + 200, + HttpHeaders.of(Collections.emptyMap()), + "{\"id\": \"evt_234\", \"object\": \"v2.core.event\",\"type\": \"v1.imaginary\",\"data\": {}}"); + } + + throw new Exception( + String.format( + "Unexpected rawRequest made: %s %s", request.getMethod(), request.getPath())); + }) + .when(networkSpy) + .rawRequest(Mockito.any()); + + EventNotification eventNotification = + EventNotification.fromJson(v2UnknownEventNotification, client); + + assertNotNull(eventNotification); + assertEquals("evt_234", eventNotification.getId()); + assertEquals("v1.imaginary_event", eventNotification.getType()); + assertInstanceOf(UnknownEventNotification.class, eventNotification); + UnknownEventNotification e = (UnknownEventNotification) eventNotification; + + assertNull(e.getRelatedObject()); + assertNull(e.fetchRelatedObject()); // doesn't work, but doesn't throw + assertInstanceOf(Event.class, e.fetchEvent()); } @Test @@ -277,4 +348,56 @@ public void stripeClientWithStripeContextInV1Api() throws StripeException { assertEquals("ctx", stripeRequest.headers().firstValue("Stripe-Context").get()); }); } + + @Test + public void parseEventNotificationAndPull() + throws StripeException, InvalidKeyException, NoSuchAlgorithmException { + StripeClient client = new StripeClient(networkSpy); + + // the existing stubRequest doesn't support rawRequest, so we'll stub manually here + Mockito.doAnswer( + invocation -> { + RawApiRequest request = invocation.getArgument(0); + String path = request.getPath(); + + if (request.getMethod() == RequestMethod.GET) { + if (path.equals("/v2/core/events/evt_234")) { + return new StripeResponse( + 200, + HttpHeaders.of(Collections.emptyMap()), + "{\"id\": \"evt_234\", \"object\": \"v2.core.event\",\"type\": \"v1.billing.meter.error_report_triggered\",\"data\": {}}"); + } else if (path.equals("/v1/billing/meter/meter_123")) { + return new StripeResponse( + 200, + HttpHeaders.of(Collections.emptyMap()), + "{\"id\": \"meter_123\", \"object\": \"billing.meter\", \"display_name\": \"Test Meter\"}"); + } + } + throw new Exception( + String.format( + "Unexpected rawRequest made: %s %s", request.getMethod(), request.getPath())); + }) + .when(networkSpy) + .rawRequest(Mockito.any()); + + EventNotification eventNotification = + EventNotification.fromJson(v2EventNotificationWithRelatedObject, client); + + assertInstanceOf(V1BillingMeterErrorReportTriggeredEventNotification.class, eventNotification); + + V1BillingMeterErrorReportTriggeredEventNotification en = + (V1BillingMeterErrorReportTriggeredEventNotification) eventNotification; + + assertInstanceOf(V1BillingMeterErrorReportTriggeredEvent.class, en.fetchEvent()); + assertInstanceOf(Meter.class, en.fetchRelatedObject()); + + // we should have made 2 API requests + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(RawApiRequest.class); + Mockito.verify(networkSpy, Mockito.times(2)).rawRequest(requestCaptor.capture()); + + // and we should have included 'Stripe-Context' in both + for (RawApiRequest v : requestCaptor.getAllValues()) { + assertEquals("org_123", v.getOptions().getStripeContext()); + } + } }