Skip to content

Commit 5dd5e8e

Browse files
Merge pull request #2055 from stripe/latest-codegen-beta
Update generated code for beta
2 parents 6319815 + 44cda31 commit 5dd5e8e

136 files changed

Lines changed: 2400 additions & 123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/stripe/StripeClient.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.stripe.exception.SignatureVerificationException;
44
import com.stripe.exception.StripeException;
55
import com.stripe.model.StripeObject;
6-
import com.stripe.model.ThinEvent;
6+
import com.stripe.model.v2.EventNotification;
77
import com.stripe.net.*;
88
import com.stripe.net.Webhook.Signature;
99
import java.net.PasswordAuthentication;
@@ -52,9 +52,9 @@ protected StripeResponseGetter getResponseGetter() {
5252
* @return the StripeEvent instance
5353
* @throws SignatureVerificationException if the verification fails.
5454
*/
55-
public ThinEvent parseThinEvent(String payload, String sigHeader, String secret)
55+
public EventNotification parseEventNotification(String payload, String sigHeader, String secret)
5656
throws SignatureVerificationException {
57-
return parseThinEvent(payload, sigHeader, secret, Webhook.DEFAULT_TOLERANCE);
57+
return parseEventNotification(payload, sigHeader, secret, Webhook.DEFAULT_TOLERANCE);
5858
}
5959

6060
/**
@@ -70,11 +70,12 @@ public ThinEvent parseThinEvent(String payload, String sigHeader, String secret)
7070
* @return the StripeEvent instance
7171
* @throws SignatureVerificationException if the verification fails.
7272
*/
73-
public ThinEvent parseThinEvent(String payload, String sigHeader, String secret, long tolerance)
73+
public EventNotification parseEventNotification(
74+
String payload, String sigHeader, String secret, long tolerance)
7475
throws SignatureVerificationException {
7576
Signature.verifyHeader(payload, sigHeader, secret, tolerance);
7677

77-
return ApiResource.GSON.fromJson(payload, ThinEvent.class);
78+
return EventNotification.fromJson(payload, this);
7879
}
7980

8081
/**

src/main/java/com/stripe/events/V1BillingMeterErrorReportTriggeredEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.stripe.exception.StripeException;
66
import com.stripe.model.billing.Meter;
77
import com.stripe.model.v2.Event;
8+
import com.stripe.model.v2.Event.RelatedObject;
89
import java.time.Instant;
910
import java.util.List;
1011
import lombok.Getter;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.events;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.exception.StripeException;
6+
import com.stripe.model.billing.Meter;
7+
import com.stripe.model.v2.Event.RelatedObject;
8+
import com.stripe.model.v2.EventNotification;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public final class V1BillingMeterErrorReportTriggeredEventNotification extends EventNotification {
13+
@SerializedName("related_object")
14+
15+
/** Object containing the reference to API resource relevant to the event. */
16+
RelatedObject relatedObject;
17+
18+
/** Retrieves the related object from the API. Make an API request on every call. */
19+
public Meter fetchRelatedObject() throws StripeException {
20+
return (Meter) super.fetchRelatedObject(this.relatedObject);
21+
}
22+
/** Retrieve the corresponding full event from the Stripe API. */
23+
@Override
24+
public V1BillingMeterErrorReportTriggeredEvent fetchEvent() throws StripeException {
25+
return (V1BillingMeterErrorReportTriggeredEvent) super.fetchEvent();
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.events;
3+
4+
import com.stripe.exception.StripeException;
5+
import com.stripe.model.v2.EventNotification;
6+
7+
public final class V1BillingMeterNoMeterFoundEventNotification extends EventNotification {
8+
/** Retrieve the corresponding full event from the Stripe API. */
9+
@Override
10+
public V1BillingMeterNoMeterFoundEvent fetchEvent() throws StripeException {
11+
return (V1BillingMeterNoMeterFoundEvent) super.fetchEvent();
12+
}
13+
}

src/main/java/com/stripe/events/V2BillingBillSettingUpdatedEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.google.gson.annotations.SerializedName;
55
import com.stripe.exception.StripeException;
66
import com.stripe.model.v2.Event;
7+
import com.stripe.model.v2.Event.RelatedObject;
78
import com.stripe.model.v2.billing.BillSetting;
89
import java.time.Instant;
910
import lombok.Getter;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.events;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.exception.StripeException;
6+
import com.stripe.model.v2.Event.RelatedObject;
7+
import com.stripe.model.v2.EventNotification;
8+
import com.stripe.model.v2.billing.BillSetting;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public final class V2BillingBillSettingUpdatedEventNotification extends EventNotification {
13+
@SerializedName("related_object")
14+
15+
/** Object containing the reference to API resource relevant to the event. */
16+
RelatedObject relatedObject;
17+
18+
/** Retrieves the related object from the API. Make an API request on every call. */
19+
public BillSetting fetchRelatedObject() throws StripeException {
20+
return (BillSetting) super.fetchRelatedObject(this.relatedObject);
21+
}
22+
/** Retrieve the corresponding full event from the Stripe API. */
23+
@Override
24+
public V2BillingBillSettingUpdatedEvent fetchEvent() throws StripeException {
25+
return (V2BillingBillSettingUpdatedEvent) super.fetchEvent();
26+
}
27+
}

src/main/java/com/stripe/events/V2CoreAccountClosedEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.google.gson.annotations.SerializedName;
55
import com.stripe.exception.StripeException;
66
import com.stripe.model.v2.Event;
7+
import com.stripe.model.v2.Event.RelatedObject;
78
import com.stripe.model.v2.core.Account;
89
import lombok.Getter;
910

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.events;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.exception.StripeException;
6+
import com.stripe.model.v2.Event.RelatedObject;
7+
import com.stripe.model.v2.EventNotification;
8+
import com.stripe.model.v2.core.Account;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public final class V2CoreAccountClosedEventNotification extends EventNotification {
13+
@SerializedName("related_object")
14+
15+
/** Object containing the reference to API resource relevant to the event. */
16+
RelatedObject relatedObject;
17+
18+
/** Retrieves the related object from the API. Make an API request on every call. */
19+
public Account fetchRelatedObject() throws StripeException {
20+
return (Account) super.fetchRelatedObject(this.relatedObject);
21+
}
22+
/** Retrieve the corresponding full event from the Stripe API. */
23+
@Override
24+
public V2CoreAccountClosedEvent fetchEvent() throws StripeException {
25+
return (V2CoreAccountClosedEvent) super.fetchEvent();
26+
}
27+
}

src/main/java/com/stripe/events/V2CoreAccountCreatedEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.google.gson.annotations.SerializedName;
55
import com.stripe.exception.StripeException;
66
import com.stripe.model.v2.Event;
7+
import com.stripe.model.v2.Event.RelatedObject;
78
import com.stripe.model.v2.core.Account;
89
import lombok.Getter;
910

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.events;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.exception.StripeException;
6+
import com.stripe.model.v2.Event.RelatedObject;
7+
import com.stripe.model.v2.EventNotification;
8+
import com.stripe.model.v2.core.Account;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public final class V2CoreAccountCreatedEventNotification extends EventNotification {
13+
@SerializedName("related_object")
14+
15+
/** Object containing the reference to API resource relevant to the event. */
16+
RelatedObject relatedObject;
17+
18+
/** Retrieves the related object from the API. Make an API request on every call. */
19+
public Account fetchRelatedObject() throws StripeException {
20+
return (Account) super.fetchRelatedObject(this.relatedObject);
21+
}
22+
/** Retrieve the corresponding full event from the Stripe API. */
23+
@Override
24+
public V2CoreAccountCreatedEvent fetchEvent() throws StripeException {
25+
return (V2CoreAccountCreatedEvent) super.fetchEvent();
26+
}
27+
}

0 commit comments

Comments
 (0)