Skip to content

Commit

Permalink
Merge pull request #1669 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
Update generated code for beta
  • Loading branch information
stripe-openapi[bot] committed Oct 16, 2023
2 parents 76ccf5b + 5ae2936 commit 8bc2390
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
* Add support for new value `quote.accept_failed` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
* [#1633](https://github.com/stripe/stripe-java/pull/1633) Merge master

## 23.10.0 - 2023-10-16
* [#1670](https://github.com/stripe/stripe-java/pull/1670) Update generated code
* Add support for new values `issuing_token.created` and `issuing_token.updated` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
* [#1671](https://github.com/stripe/stripe-java/pull/1671) Disallow falback to global response getter only in tests

## 23.9.0 - 2023-10-11
* [#1668](https://github.com/stripe/stripe-java/pull/1668) Update generated code
* Add support for `redirect_on_completion`, `return_url`, and `ui_mode` on `Checkout.Session` and `checkout.SessionCreateParams`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v597
v602
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ test {
events "passed", "skipped", "failed"
exceptionFormat "full"
}

systemProperty "stripe.disallowGlobalResponseGetterFallback", "true"
}

spotless {
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/com/stripe/model/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ public class Customer extends ApiResource implements HasId, MetadataStore<Custom
Boolean deleted;

/**
* If Stripe bills the customer's latest invoice by automatically charging and the latest charge
* fails, it sets {@code delinquent`` to }true{@code . If Stripe bills the invoice by sending it,
* and the invoice isn't paid by the due date, it also sets `delinquent} to {@code true}.
* Tracks the most recent state change on any invoice belonging to the customer. Paying an invoice
* or marking it uncollectible via the API will set this field to false. An automatic payment
* failure or passing the {@code invoice.due_date} will set this field to {@code true}.
*
* <p>If an invoice becomes uncollectible by <a
* href="https://stripe.com/docs/billing/automatic-collection">dunning</a>, {@code delinquent}
* doesn't reset to {@code false}.
*
* <p>If you care whether the customer has paid their most recent subscription invoice, use {@code
* subscription.status} instead. Paying or marking uncollectible any customer invoice regardless
* of whether it is the latest invoice for a subscription will always set this field to {@code
* false}.
*/
@SerializedName("delinquent")
Boolean delinquent;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/stripe/model/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ public class Event extends ApiResource implements HasId {
* {@code issuing_dispute.funds_reinstated}, {@code issuing_dispute.submitted}, {@code
* issuing_dispute.updated}, {@code issuing_personalization_design.activated}, {@code
* issuing_personalization_design.deactivated}, {@code issuing_personalization_design.rejected},
* {@code issuing_personalization_design.updated}, {@code issuing_transaction.created}, {@code
* {@code issuing_personalization_design.updated}, {@code issuing_token.created}, {@code
* issuing_token.updated}, {@code issuing_transaction.created}, {@code
* issuing_transaction.updated}, {@code mandate.updated}, {@code
* payment_intent.amount_capturable_updated}, {@code payment_intent.canceled}, {@code
* payment_intent.created}, {@code payment_intent.partially_funded}, {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
* <p>Related guides: - <a
* href="https://stripe.com/docs/connect/payment-method-configurations">Payment Method
* Configurations API</a> - <a
* href="https://stripe.com/docs/payments/multiple-payment-method-configs">Multiple payment method
* configurations on dynamic payment methods</a> - <a
* href="https://stripe.com/docs/payments/multiple-payment-method-configs">Multiple configurations
* on dynamic payment methods</a> - <a
* href="https://stripe.com/docs/connect/multiple-payment-method-configurations">Multiple
* configurations for your Connect accounts</a>
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/stripe/model/issuing/Token.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

/**
* An issuing token object is created when an issued card is added to a digital wallet. As a <a
* href="https://stripe.com/docs/issuing">card issuer</a>, you can view and manage these tokens
* href="https://stripe.com/docs/issuing">card issuer</a>, you can <a
* href="https://stripe.com/docs/issuing/controls/token-management">view and manage these tokens</a>
* through Stripe.
*/
@Getter
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/com/stripe/net/ApiResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public void setResponseGetter(StripeResponseGetter srg) {

protected StripeResponseGetter getResponseGetter() {
if (this.responseGetter == null) {
throw new IllegalStateException(
"The StripeResponseGetter has not been set on this resource. "
+ "This should not happen and is likely a bug in the Stripe Java library. "
+ "Please open a github issue on https://github.com/stripe/stripe-java or contact "
+ "Stripe Support at https://support.stripe.com/contact/");
if (isGlobalFallbackDisallowed()) {
throw new IllegalStateException(
"The resource you're trying to use was deserialized without the use of ApiResource.GSON.\n"
+ "ApiResource.GSON contains type adapters that are important for correct deserialization and functioning of the resource.\n"
+ "To deserialize Events use Webhook.constructEvent, for other resources use ApiResource.GSON.fromJson(...)`");
}
return getGlobalResponseGetter();
}
return this.responseGetter;
}
Expand Down Expand Up @@ -152,4 +154,9 @@ public static <T extends HasId> ExpandableField<T> setExpandableFieldId(

return new ExpandableField<>(newId, currentObject.getExpanded());
}

private static boolean isGlobalFallbackDisallowed() {
return Objects.equals(
System.getProperty("stripe.disallowGlobalResponseGetterFallback"), "true");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,12 @@ public enum EnabledEvent implements ApiRequestParams.EnumParam {
@SerializedName("issuing_personalization_design.updated")
ISSUING_PERSONALIZATION_DESIGN__UPDATED("issuing_personalization_design.updated"),

@SerializedName("issuing_token.created")
ISSUING_TOKEN__CREATED("issuing_token.created"),

@SerializedName("issuing_token.updated")
ISSUING_TOKEN__UPDATED("issuing_token.updated"),

@SerializedName("issuing_transaction.created")
ISSUING_TRANSACTION__CREATED("issuing_transaction.created"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,12 @@ public enum EnabledEvent implements ApiRequestParams.EnumParam {
@SerializedName("issuing_personalization_design.updated")
ISSUING_PERSONALIZATION_DESIGN__UPDATED("issuing_personalization_design.updated"),

@SerializedName("issuing_token.created")
ISSUING_TOKEN__CREATED("issuing_token.created"),

@SerializedName("issuing_token.updated")
ISSUING_TOKEN__UPDATED("issuing_token.updated"),

@SerializedName("issuing_transaction.created")
ISSUING_TRANSACTION__CREATED("issuing_transaction.created"),

Expand Down
39 changes: 39 additions & 0 deletions src/test/java/com/stripe/functional/GeneratedExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,45 @@ public void testCapabilityServiceUpdate() throws StripeException {
null);
}

@Test
public void testExternalAccountServiceList2() throws StripeException {
StripeClient client = new StripeClient(networkSpy);

com.stripe.param.ExternalAccountListParams params =
com.stripe.param.ExternalAccountListParams.builder()
.setObject("bank_account")
.setLimit(3L)
.build();

com.stripe.model.StripeCollection<com.stripe.model.ExternalAccount> stripeCollection =
client.accounts().externalAccounts().list("acct_xxxxxxxxxxxxx", params);
assertNotNull(stripeCollection);
verifyRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
"/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts",
params.toMap(),
null);
}

@Test
public void testExternalAccountServiceList3() throws StripeException {
StripeClient client = new StripeClient(networkSpy);

com.stripe.param.ExternalAccountListParams params =
com.stripe.param.ExternalAccountListParams.builder().setObject("card").setLimit(3L).build();

com.stripe.model.StripeCollection<com.stripe.model.ExternalAccount> stripeCollection =
client.accounts().externalAccounts().list("acct_xxxxxxxxxxxxx", params);
assertNotNull(stripeCollection);
verifyRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
"/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts",
params.toMap(),
null);
}

@Test
public void testExternalAccountServiceCreate() throws StripeException {
StripeClient client = new StripeClient(networkSpy);
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/com/stripe/net/ApiResourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public void testInternalDeserializeSetsResponseGetter() {
Charge charge = ApiResource.INTERNAL_GSON.fromJson(json, Charge.class);
IllegalStateException e =
assertThrows(IllegalStateException.class, () -> charge.update(new HashMap<>()));
assertTrue(e.getMessage().contains("contact Stripe Support"));
assertTrue(
e.getMessage()
.contains(
"The resource you're trying to use was deserialized without the use of ApiResource.GSON"));
}
}

0 comments on commit 8bc2390

Please sign in to comment.