Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/main/java/com/stripe/StripeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading
Loading