diff --git a/API_VERSION b/API_VERSION index 8e27f52b526..dffa3a76a26 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -56689dcbcaa4c7ce6bf1b51a5add451972e0689c \ No newline at end of file +6d15a7f20cb77c2c22091a30e499cb89d7e3248c \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a481e4d6ff..1c9cc897b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,37 @@ ## 30.2.1-alpha.1 - 2025-11-05 * Updated publishing configuration. No changes to SDK content. +## 30.2.0 - 2025-11-05 +* [#2102](https://github.com/stripe/stripe-java/pull/2102) Update generated code + * Add support for `captureMethod` on `PaymentIntent.payment_method_options.card_present`, `PaymentIntentConfirmParams.payment_method_options.card_present`, `PaymentIntentCreateParams.payment_method_options.card_present`, and `PaymentIntentUpdateParams.payment_method_options.card_present` + +## 30.2.0-beta.1 - 2025-10-29 + +This release changes the pinned API version to `2025-10-29.preview`. + +* [#2092](https://github.com/stripe/stripe-java/pull/2092) Update generated code for beta + * Add support for `cryptoStorer` on `v2.core.AccountUpdateParams.identity.attestations.terms_of_service` +* [#2081](https://github.com/stripe/stripe-java/pull/2081) Update generated code for beta + * Add support for `update` method on resource `v2.moneymanagement.FinancialAccount` + * Add support for `confirm_microdeposits`, `list`, and `send_microdeposits` methods on resource `v2.core.vault.UsBankAccount` + * Add support for `list` method on resource `v2.core.vault.GbBankAccount` + * Add support for `paymentPortalUrl` on `Charge.payment_method_details.rechnung`, `PaymentAttemptRecord.payment_method_details.rechnung`, and `PaymentRecord.payment_method_details.rechnung` + * Add support for `taxIdElement` on `CustomerSession.components` and `CustomerSessionCreateParams.components` + * Add support for `startingAfter` on `PaymentAttemptRecordListParams` + * Add support for `reference` on `PaymentIntentAmountDetailsLineItem.payment_method_options.klarna`, `PaymentIntentCaptureParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentConfirmParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentCreateParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentIncrementAuthorizationParams.amount_details.line_items[].payment_method_options.klarna`, and `PaymentIntentUpdateParams.amount_details.line_items[].payment_method_options.klarna` + * Add support for `subscriptionReference` on `PaymentIntentAmountDetailsLineItem.payment_method_options.klarna` + * Add support for `closed` on `v2.core.AccountListParams` and `v2.core.Account` + * Add support for `usd` on `v2.core.Account.configuration.storer.capabilities.holds_currencies`, `v2.core.AccountCreateParams.configuration.storer.capabilities.holds_currencies`, and `v2.core.AccountUpdateParams.configuration.storer.capabilities.holds_currencies` + * Add support for `representativeDeclaration` on `v2.core.Account.identity.attestations`, `v2.core.AccountCreateParams.identity.attestations`, and `v2.core.AccountUpdateParams.identity.attestations` + * Add support for `verification` on `v2.core.vault.UsBankAccount` + * Add support for new value `payment_method` on enums `v2.core.AccountCreateParams.configuration.customer.automatic_indirect_tax.locationSource` and `v2.core.AccountUpdateParams.configuration.customer.automatic_indirect_tax.locationSource` + * Add support for new values `application_custom` and `application_express` on enums `v2.core.AccountCreateParams.defaults.responsibilities.feesCollector` and `v2.core.AccountUpdateParams.defaults.responsibilities.feesCollector` + * Add support for `v1Id` on `EventsV2MoneyManagementTransactionCreatedEvent` + * Remove support for thin event `V2BillingBillSettingUpdatedEvent` with related object `v2.billing.BillSetting` +* [#2080](https://github.com/stripe/stripe-java/pull/2080) Update generated code for beta + * Add support for `lastSeenAt` on `terminal.Reader` + * Add support for new value `2025-10-29.clover` on enum `WebhookEndpointCreateParams.apiVersion` + ## 30.2.0-alpha.2 - 2025-10-30 * [#2099](https://github.com/stripe/stripe-java/pull/2099) Update generated code for private-preview * Change `delegatedcheckout.RequestedSessionUpdateParams.line_item_details[].quantity` to be required @@ -54,33 +85,6 @@ * Add support for `complianceScreeningDescription` on `v2.core.Account.identity.business_details`, `v2.core.AccountCreateParams.identity.business_details`, and `v2.core.AccountUpdateParams.identity.business_details` * Add support for `externalAmount` on `v2.moneymanagement.ReceivedCredit` and `v2.moneymanagement.ReceivedDebit` -## 30.2.0-beta.1 - 2025-10-29 - -This release changes the pinned API version to `2025-10-29.preview`. - -* [#2092](https://github.com/stripe/stripe-java/pull/2092) Update generated code for beta - * Add support for `cryptoStorer` on `v2.core.AccountUpdateParams.identity.attestations.terms_of_service` -* [#2081](https://github.com/stripe/stripe-java/pull/2081) Update generated code for beta - * Add support for `update` method on resource `v2.moneymanagement.FinancialAccount` - * Add support for `confirm_microdeposits`, `list`, and `send_microdeposits` methods on resource `v2.core.vault.UsBankAccount` - * Add support for `list` method on resource `v2.core.vault.GbBankAccount` - * Add support for `paymentPortalUrl` on `Charge.payment_method_details.rechnung`, `PaymentAttemptRecord.payment_method_details.rechnung`, and `PaymentRecord.payment_method_details.rechnung` - * Add support for `taxIdElement` on `CustomerSession.components` and `CustomerSessionCreateParams.components` - * Add support for `startingAfter` on `PaymentAttemptRecordListParams` - * Add support for `reference` on `PaymentIntentAmountDetailsLineItem.payment_method_options.klarna`, `PaymentIntentCaptureParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentConfirmParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentCreateParams.amount_details.line_items[].payment_method_options.klarna`, `PaymentIntentIncrementAuthorizationParams.amount_details.line_items[].payment_method_options.klarna`, and `PaymentIntentUpdateParams.amount_details.line_items[].payment_method_options.klarna` - * Add support for `subscriptionReference` on `PaymentIntentAmountDetailsLineItem.payment_method_options.klarna` - * Add support for `closed` on `v2.core.AccountListParams` and `v2.core.Account` - * Add support for `usd` on `v2.core.Account.configuration.storer.capabilities.holds_currencies`, `v2.core.AccountCreateParams.configuration.storer.capabilities.holds_currencies`, and `v2.core.AccountUpdateParams.configuration.storer.capabilities.holds_currencies` - * Add support for `representativeDeclaration` on `v2.core.Account.identity.attestations`, `v2.core.AccountCreateParams.identity.attestations`, and `v2.core.AccountUpdateParams.identity.attestations` - * Add support for `verification` on `v2.core.vault.UsBankAccount` - * Add support for new value `payment_method` on enums `v2.core.AccountCreateParams.configuration.customer.automatic_indirect_tax.locationSource` and `v2.core.AccountUpdateParams.configuration.customer.automatic_indirect_tax.locationSource` - * Add support for new values `application_custom` and `application_express` on enums `v2.core.AccountCreateParams.defaults.responsibilities.feesCollector` and `v2.core.AccountUpdateParams.defaults.responsibilities.feesCollector` - * Add support for `v1Id` on `EventsV2MoneyManagementTransactionCreatedEvent` - * Remove support for thin event `V2BillingBillSettingUpdatedEvent` with related object `v2.billing.BillSetting` -* [#2080](https://github.com/stripe/stripe-java/pull/2080) Update generated code for beta - * Add support for `lastSeenAt` on `terminal.Reader` - * Add support for new value `2025-10-29.clover` on enum `WebhookEndpointCreateParams.apiVersion` - ## 30.1.0 - 2025-10-29 This release changes the pinned API version to `2025-10-29.clover`. diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4dfe75c0edd..dfd2783f161 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2106 \ No newline at end of file +v2111 \ No newline at end of file diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEvent.java b/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEvent.java new file mode 100644 index 00000000000..698afc65e8e --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEvent.java @@ -0,0 +1,22 @@ +// 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.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunCreatedEvent extends Event { + @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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEventNotification.java b/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEventNotification.java new file mode 100644 index 00000000000..e6d2ad1a28e --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunCreatedEventNotification.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.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunCreatedEventNotification 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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2ReportingReportRunCreatedEvent fetchEvent() throws StripeException { + return (V2ReportingReportRunCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunFailedEvent.java b/src/main/java/com/stripe/events/V2ReportingReportRunFailedEvent.java new file mode 100644 index 00000000000..ada9273359e --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunFailedEvent.java @@ -0,0 +1,22 @@ +// 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.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunFailedEvent extends Event { + @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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunFailedEventNotification.java b/src/main/java/com/stripe/events/V2ReportingReportRunFailedEventNotification.java new file mode 100644 index 00000000000..32fb0a68c62 --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunFailedEventNotification.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.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunFailedEventNotification 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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2ReportingReportRunFailedEvent fetchEvent() throws StripeException { + return (V2ReportingReportRunFailedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEvent.java b/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEvent.java new file mode 100644 index 00000000000..d5fc3a03345 --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEvent.java @@ -0,0 +1,22 @@ +// 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.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunSucceededEvent extends Event { + @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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEventNotification.java b/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEventNotification.java new file mode 100644 index 00000000000..0504682920f --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunSucceededEventNotification.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.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunSucceededEventNotification 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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2ReportingReportRunSucceededEvent fetchEvent() throws StripeException { + return (V2ReportingReportRunSucceededEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEvent.java b/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEvent.java new file mode 100644 index 00000000000..fb84370a29d --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEvent.java @@ -0,0 +1,22 @@ +// 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.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunUpdatedEvent extends Event { + @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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEventNotification.java new file mode 100644 index 00000000000..83d2b740559 --- /dev/null +++ b/src/main/java/com/stripe/events/V2ReportingReportRunUpdatedEventNotification.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.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import com.stripe.model.v2.reporting.ReportRun; +import lombok.Getter; + +@Getter +public final class V2ReportingReportRunUpdatedEventNotification 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 ReportRun fetchRelatedObject() throws StripeException { + return (ReportRun) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2ReportingReportRunUpdatedEvent fetchEvent() throws StripeException { + return (V2ReportingReportRunUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index 773509d9729..50fa1a5f155 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -31,6 +31,10 @@ @Setter @EqualsAndHashCode(callSuper = false) public class Charge extends ApiResource implements MetadataStore, BalanceTransactionSource { + /** Funds that are in transit and destined for another balance or another connected account. */ + @SerializedName("allocated_funds") + TransitBalance allocatedFunds; + /** * Amount intended to be collected by this payment. A positive integer representing how much to * charge in the smallest currency @@ -4383,6 +4387,7 @@ public void setDestinationObject(Account expandableObject) { @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); + trySetResponseGetter(allocatedFunds, responseGetter); trySetResponseGetter(application, responseGetter); trySetResponseGetter(applicationFee, responseGetter); trySetResponseGetter(balanceTransaction, responseGetter); diff --git a/src/main/java/com/stripe/model/EventDataClassLookup.java b/src/main/java/com/stripe/model/EventDataClassLookup.java index bc971e44b9a..d0539b7496e 100644 --- a/src/main/java/com/stripe/model/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/EventDataClassLookup.java @@ -108,6 +108,7 @@ public final class EventDataClassLookup { classLookup.put("topup", com.stripe.model.Topup.class); classLookup.put("transfer", com.stripe.model.Transfer.class); classLookup.put("transfer_reversal", com.stripe.model.TransferReversal.class); + classLookup.put("transit_balance", com.stripe.model.TransitBalance.class); classLookup.put("webhook_endpoint", com.stripe.model.WebhookEndpoint.class); classLookup.put("apps.secret", com.stripe.model.apps.Secret.class); diff --git a/src/main/java/com/stripe/model/InvoicePayment.java b/src/main/java/com/stripe/model/InvoicePayment.java index 300ebea267f..46165f99bc2 100644 --- a/src/main/java/com/stripe/model/InvoicePayment.java +++ b/src/main/java/com/stripe/model/InvoicePayment.java @@ -244,7 +244,7 @@ public static class Payment extends StripeObject { /** * Type of payment object associated with this invoice payment. * - *

One of {@code charge}, or {@code payment_intent}. + *

One of {@code charge}, {@code payment_intent}, or {@code payment_record}. */ @SerializedName("type") String type; diff --git a/src/main/java/com/stripe/model/TransitBalance.java b/src/main/java/com/stripe/model/TransitBalance.java new file mode 100644 index 00000000000..bf741c7f3ba --- /dev/null +++ b/src/main/java/com/stripe/model/TransitBalance.java @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +import com.google.gson.annotations.SerializedName; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** Funds that are in transit and destined for another balance or another connected account. */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class TransitBalance extends StripeObject { + @SerializedName("balance") + Balance balance; + + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** + * Three-letter ISO currency code, + * in lowercase. Must be a supported currency. + */ + @SerializedName("currency") + String currency; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code transit_balance}. + */ + @SerializedName("object") + String object; + + /** + * For more details about Balance, please refer to the API + * Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Balance extends StripeObject { + @SerializedName("available") + Long available; + + @SerializedName("pending") + Long pending; + } +} diff --git a/src/main/java/com/stripe/model/capital/FinancingOffer.java b/src/main/java/com/stripe/model/capital/FinancingOffer.java index 712975315f6..c13c4733c46 100644 --- a/src/main/java/com/stripe/model/capital/FinancingOffer.java +++ b/src/main/java/com/stripe/model/capital/FinancingOffer.java @@ -11,8 +11,10 @@ import com.stripe.net.BaseAddress; import com.stripe.net.RequestOptions; import com.stripe.net.StripeResponseGetter; +import com.stripe.param.capital.FinancingOfferCreateParams; import com.stripe.param.capital.FinancingOfferListParams; import com.stripe.param.capital.FinancingOfferMarkDeliveredParams; +import com.stripe.param.capital.FinancingOfferRefillParams; import com.stripe.param.capital.FinancingOfferRetrieveParams; import java.math.BigDecimal; import java.util.Map; @@ -365,6 +367,92 @@ public static class OfferedTerms extends StripeObject { BigDecimal withholdRate; } + public TestHelpers getTestHelpers() { + return new TestHelpers(this); + } + + public static class TestHelpers { + private final FinancingOffer resource; + + private TestHelpers(FinancingOffer resource) { + this.resource = resource; + } + + /** Creates a test financing offer for a connected account. */ + public static FinancingOffer create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a test financing offer for a connected account. */ + public static FinancingOffer create(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/test_helpers/capital/financing_offers"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getGlobalResponseGetter().request(request, FinancingOffer.class); + } + + /** Creates a test financing offer for a connected account. */ + public static FinancingOffer create(FinancingOfferCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a test financing offer for a connected account. */ + public static FinancingOffer create(FinancingOfferCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/test_helpers/capital/financing_offers"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, FinancingOffer.class); + } + + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill(Map params) throws StripeException { + return refill(params, (RequestOptions) null); + } + + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill(Map params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/capital/financing_offers/%s/refill", + ApiResource.urlEncodeId(this.resource.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return resource.getResponseGetter().request(request, FinancingOffer.class); + } + + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill(FinancingOfferRefillParams params) throws StripeException { + return refill(params, (RequestOptions) null); + } + + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill(FinancingOfferRefillParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/capital/financing_offers/%s/refill", + ApiResource.urlEncodeId(this.resource.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return resource.getResponseGetter().request(request, FinancingOffer.class); + } + } + @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); diff --git a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java index a4f137323bb..40f4b4e2317 100644 --- a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java @@ -199,6 +199,9 @@ public final class EventDataClassLookup { classLookup.put( "v2.payments.off_session_payment", com.stripe.model.v2.payments.OffSessionPayment.class); + classLookup.put("v2.reporting.report", com.stripe.model.v2.reporting.Report.class); + classLookup.put("v2.reporting.report_run", com.stripe.model.v2.reporting.ReportRun.class); + classLookup.put("v2.tax.automatic_rule", com.stripe.model.v2.tax.AutomaticRule.class); eventClassLookup.put("v1.account.updated", com.stripe.events.V1AccountUpdatedEvent.class); @@ -942,5 +945,16 @@ public final class EventDataClassLookup { eventClassLookup.put( "v2.payments.off_session_payment.succeeded", com.stripe.events.V2PaymentsOffSessionPaymentSucceededEvent.class); + eventClassLookup.put( + "v2.reporting.report_run.created", + com.stripe.events.V2ReportingReportRunCreatedEvent.class); + eventClassLookup.put( + "v2.reporting.report_run.failed", com.stripe.events.V2ReportingReportRunFailedEvent.class); + eventClassLookup.put( + "v2.reporting.report_run.succeeded", + com.stripe.events.V2ReportingReportRunSucceededEvent.class); + eventClassLookup.put( + "v2.reporting.report_run.updated", + com.stripe.events.V2ReportingReportRunUpdatedEvent.class); } } diff --git a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java index b4dc9169da9..02f408eb484 100644 --- a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java @@ -887,5 +887,17 @@ public final class EventNotificationClassLookup { eventClassLookup.put( "v2.payments.off_session_payment.succeeded", com.stripe.events.V2PaymentsOffSessionPaymentSucceededEventNotification.class); + eventClassLookup.put( + "v2.reporting.report_run.created", + com.stripe.events.V2ReportingReportRunCreatedEventNotification.class); + eventClassLookup.put( + "v2.reporting.report_run.failed", + com.stripe.events.V2ReportingReportRunFailedEventNotification.class); + eventClassLookup.put( + "v2.reporting.report_run.succeeded", + com.stripe.events.V2ReportingReportRunSucceededEventNotification.class); + eventClassLookup.put( + "v2.reporting.report_run.updated", + com.stripe.events.V2ReportingReportRunUpdatedEventNotification.class); } } diff --git a/src/main/java/com/stripe/model/v2/reporting/Report.java b/src/main/java/com/stripe/model/v2/reporting/Report.java new file mode 100644 index 00000000000..f57db3beef1 --- /dev/null +++ b/src/main/java/com/stripe/model/v2/reporting/Report.java @@ -0,0 +1,142 @@ +// File generated from our OpenAPI spec +package com.stripe.model.v2.reporting; + +import com.google.gson.annotations.SerializedName; +import com.stripe.model.HasId; +import com.stripe.model.StripeObject; +import java.time.Instant; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * The Report resource represents a customizable report template that provides insights into various + * aspects of your Stripe integration. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class Report extends StripeObject implements HasId { + /** The unique identifier of the {@code Report} object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** The human-readable name of the {@code Report}. */ + @SerializedName("name") + String name; + + /** + * String representing the object's type. Objects of the same type share the same value of the + * object field. + * + *

Equal to {@code v2.reporting.report}. + */ + @SerializedName("object") + String object; + + /** + * Specification of the parameters that the {@code Report} accepts. It details each parameter's + * name, description, whether it is required, and any validations performed. + */ + @SerializedName("parameters") + Map parameters; + + /** + * For more details about Parameter, please refer to the API + * Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Parameter extends StripeObject { + /** For array parameters, provides details about the array elements. */ + @SerializedName("array_details") + ArrayDetails arrayDetails; + + /** Explains the purpose and usage of the parameter. */ + @SerializedName("description") + String description; + + /** For enum parameters, provides the list of allowed values. */ + @SerializedName("enum_details") + EnumDetails enumDetails; + + /** Indicates whether the parameter must be provided. */ + @SerializedName("required") + Boolean required; + + /** For timestamp parameters, specifies the allowed date range. */ + @SerializedName("timestamp_details") + TimestampDetails timestampDetails; + + /** + * The data type of the parameter. + * + *

One of {@code array}, {@code enum}, {@code string}, or {@code timestamp}. + */ + @SerializedName("type") + String type; + + /** For array parameters, provides details about the array elements. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ArrayDetails extends StripeObject { + /** + * Data type of the elements in the array. + * + *

Equal to {@code enum}. + */ + @SerializedName("element_type") + String elementType; + + /** Details about enum elements in the array. */ + @SerializedName("enum_details") + EnumDetails enumDetails; + + /** Details about enum elements in the array. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EnumDetails extends StripeObject { + /** Allowed values of the enum. */ + @SerializedName("allowed_values") + List allowedValues; + } + } + + /** For enum parameters, provides the list of allowed values. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EnumDetails extends StripeObject { + /** Allowed values of the enum. */ + @SerializedName("allowed_values") + List allowedValues; + } + + /** For timestamp parameters, specifies the allowed date range. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class TimestampDetails extends StripeObject { + /** Maximum permitted timestamp which can be requested. */ + @SerializedName("max") + Instant max; + + /** Minimum permitted timestamp which can be requested. */ + @SerializedName("min") + Instant min; + } + } +} diff --git a/src/main/java/com/stripe/model/v2/reporting/ReportRun.java b/src/main/java/com/stripe/model/v2/reporting/ReportRun.java new file mode 100644 index 00000000000..cd086c1cce2 --- /dev/null +++ b/src/main/java/com/stripe/model/v2/reporting/ReportRun.java @@ -0,0 +1,176 @@ +// File generated from our OpenAPI spec +package com.stripe.model.v2.reporting; + +import com.google.gson.annotations.SerializedName; +import com.stripe.model.HasId; +import com.stripe.model.StripeObject; +import java.time.Instant; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * The {@code ReportRun} object represents an instance of a {@code Report} generated with specific + * run parameters. Once the object is created, Stripe begins processing the report. When the report + * has finished running, it will give you a reference to the results. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class ReportRun extends StripeObject implements HasId { + /** Time at which the object was created. */ + @SerializedName("created") + Instant created; + + /** The unique identifier of the {@code ReportRun} object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * String representing the object's type. Objects of the same type share the same value of the + * object field. + * + *

Equal to {@code v2.reporting.report_run}. + */ + @SerializedName("object") + String object; + + /** The unique identifier of the {@code Report} object which was run. */ + @SerializedName("report") + String report; + + /** The human-readable name of the {@code Report} which was run. */ + @SerializedName("report_name") + String reportName; + + /** The parameters used to customize the generation of the report. */ + @SerializedName("report_parameters") + Map reportParameters; + + /** Details how to retrieve the results of a successfully completed {@code ReportRun}. */ + @SerializedName("result") + Result result; + + /** The options specified for customizing the output file of the {@code ReportRun}. */ + @SerializedName("result_options") + ResultOptions resultOptions; + + /** + * The current status of the {@code ReportRun}. + * + *

One of {@code failed}, {@code running}, or {@code succeeded}. + */ + @SerializedName("status") + String status; + + /** + * Additional details about the current state of the {@code ReportRun}. The field is currently + * only populated when a {@code ReportRun} is in the {@code failed} state, providing more + * information about why the report failed to generate successfully. + */ + @SerializedName("status_details") + Map statusDetails; + + /** Details how to retrieve the results of a successfully completed {@code ReportRun}. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Result extends StripeObject { + /** + * Contains metadata about the file produced by the {@code ReportRun}, including its content + * type, size, and a URL to download its contents. + */ + @SerializedName("file") + File file; + + /** + * The type of the {@code ReportRun} result. + * + *

Equal to {@code file}. + */ + @SerializedName("type") + String type; + + /** + * Contains metadata about the file produced by the {@code ReportRun}, including its content + * type, size, and a URL to download its contents. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class File extends StripeObject { + /** + * The content type of the file. + * + *

One of {@code csv}, or {@code zip}. + */ + @SerializedName("content_type") + String contentType; + + /** A pre-signed URL that allows secure, time-limited access to download the file. */ + @SerializedName("download_url") + DownloadUrl downloadUrl; + + /** The total size of the file in bytes. */ + @SerializedName("size") + Long size; + + /** A pre-signed URL that allows secure, time-limited access to download the file. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class DownloadUrl extends StripeObject { + /** The time that the URL expires. */ + @SerializedName("expires_at") + Instant expiresAt; + + /** The URL that can be used for accessing the file. */ + @SerializedName("url") + String url; + } + } + } + + /** The options specified for customizing the output file of the {@code ReportRun}. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ResultOptions extends StripeObject { + /** + * If set, the generated report file will be compressed into a ZIP folder. This is useful for + * reducing file size and download time for large reports. + */ + @SerializedName("compress_file") + Boolean compressFile; + } + + /** + * For more details about StatusDetail, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class StatusDetail extends StripeObject { + /** + * Error code categorizing the reason the {@code ReportRun} failed. + * + *

One of {@code file_size_above_limit}, or {@code internal_error}. + */ + @SerializedName("error_code") + String errorCode; + + /** Error message with additional details about the failure. */ + @SerializedName("error_message") + String errorMessage; + } +} diff --git a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java index ff27c4305e8..52c50769f3c 100644 --- a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java @@ -14,6 +14,10 @@ @Getter @EqualsAndHashCode(callSuper = false) public class PaymentIntentConfirmParams extends ApiRequestParams { + /** Allocated Funds configuration for this PaymentIntent. */ + @SerializedName("allocated_funds") + AllocatedFunds allocatedFunds; + /** Provides industry-specific information about the amount. */ @SerializedName("amount_details") Object amountDetails; @@ -194,6 +198,7 @@ public class PaymentIntentConfirmParams extends ApiRequestParams { Boolean useStripeSdk; private PaymentIntentConfirmParams( + AllocatedFunds allocatedFunds, Object amountDetails, Object applicationFeeAmount, CaptureMethod captureMethod, @@ -218,6 +223,7 @@ private PaymentIntentConfirmParams( ApiRequestParams.EnumParam setupFutureUsage, Object shipping, Boolean useStripeSdk) { + this.allocatedFunds = allocatedFunds; this.amountDetails = amountDetails; this.applicationFeeAmount = applicationFeeAmount; this.captureMethod = captureMethod; @@ -249,6 +255,8 @@ public static Builder builder() { } public static class Builder { + private AllocatedFunds allocatedFunds; + private Object amountDetails; private Object applicationFeeAmount; @@ -300,6 +308,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public PaymentIntentConfirmParams build() { return new PaymentIntentConfirmParams( + this.allocatedFunds, this.amountDetails, this.applicationFeeAmount, this.captureMethod, @@ -326,6 +335,12 @@ public PaymentIntentConfirmParams build() { this.useStripeSdk); } + /** Allocated Funds configuration for this PaymentIntent. */ + public Builder setAllocatedFunds(PaymentIntentConfirmParams.AllocatedFunds allocatedFunds) { + this.allocatedFunds = allocatedFunds; + return this; + } + /** Provides industry-specific information about the amount. */ public Builder setAmountDetails(PaymentIntentConfirmParams.AmountDetails amountDetails) { this.amountDetails = amountDetails; @@ -735,6 +750,76 @@ public Builder setUseStripeSdk(Boolean useStripeSdk) { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class AllocatedFunds { + /** Whether Allocated Funds creation is enabled for this PaymentIntent. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private AllocatedFunds(Boolean enabled, Map extraParams) { + this.enabled = enabled; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentConfirmParams.AllocatedFunds build() { + return new PaymentIntentConfirmParams.AllocatedFunds(this.enabled, this.extraParams); + } + + /** Whether Allocated Funds creation is enabled for this PaymentIntent. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * PaymentIntentConfirmParams.AllocatedFunds#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link PaymentIntentConfirmParams.AllocatedFunds#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter @EqualsAndHashCode(callSuper = false) public static class AmountDetails { diff --git a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java index c4443513367..1893ad3c785 100644 --- a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java @@ -14,6 +14,10 @@ @Getter @EqualsAndHashCode(callSuper = false) public class PaymentIntentCreateParams extends ApiRequestParams { + /** Allocated Funds configuration for this PaymentIntent. */ + @SerializedName("allocated_funds") + AllocatedFunds allocatedFunds; + /** * Required. Amount intended to be collected by this PaymentIntent. A positive * integer representing how much to charge in the Required. Amount intended to be collected by this PaymentIntent. A positive * integer representing how much to charge in the extraParams; + + private AllocatedFunds(Boolean enabled, Map extraParams) { + this.enabled = enabled; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentCreateParams.AllocatedFunds build() { + return new PaymentIntentCreateParams.AllocatedFunds(this.enabled, this.extraParams); + } + + /** Whether Allocated Funds creation is enabled for this PaymentIntent. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * PaymentIntentCreateParams.AllocatedFunds#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link PaymentIntentCreateParams.AllocatedFunds#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter @EqualsAndHashCode(callSuper = false) public static class AmountDetails { diff --git a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java index 045b7c1a4e1..e0107f29772 100644 --- a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java @@ -14,6 +14,10 @@ @Getter @EqualsAndHashCode(callSuper = false) public class PaymentIntentUpdateParams extends ApiRequestParams { + /** Allocated Funds configuration for this PaymentIntent. */ + @SerializedName("allocated_funds") + AllocatedFunds allocatedFunds; + /** * Amount intended to be collected by this PaymentIntent. A positive integer representing how much * to charge in the smallest currency @@ -244,6 +248,7 @@ public class PaymentIntentUpdateParams extends ApiRequestParams { Object transferGroup; private PaymentIntentUpdateParams( + AllocatedFunds allocatedFunds, Long amount, Object amountDetails, Object applicationFeeAmount, @@ -272,6 +277,7 @@ private PaymentIntentUpdateParams( Object statementDescriptorSuffix, TransferData transferData, Object transferGroup) { + this.allocatedFunds = allocatedFunds; this.amount = amount; this.amountDetails = amountDetails; this.applicationFeeAmount = applicationFeeAmount; @@ -307,6 +313,8 @@ public static Builder builder() { } public static class Builder { + private AllocatedFunds allocatedFunds; + private Long amount; private Object amountDetails; @@ -366,6 +374,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public PaymentIntentUpdateParams build() { return new PaymentIntentUpdateParams( + this.allocatedFunds, this.amount, this.amountDetails, this.applicationFeeAmount, @@ -396,6 +405,12 @@ public PaymentIntentUpdateParams build() { this.transferGroup); } + /** Allocated Funds configuration for this PaymentIntent. */ + public Builder setAllocatedFunds(PaymentIntentUpdateParams.AllocatedFunds allocatedFunds) { + this.allocatedFunds = allocatedFunds; + return this; + } + /** * Amount intended to be collected by this PaymentIntent. A positive integer representing how * much to charge in the smallest @@ -1002,6 +1017,76 @@ public Builder setTransferGroup(EmptyParam transferGroup) { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class AllocatedFunds { + /** Whether Allocated Funds creation is enabled for this PaymentIntent. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private AllocatedFunds(Boolean enabled, Map extraParams) { + this.enabled = enabled; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentUpdateParams.AllocatedFunds build() { + return new PaymentIntentUpdateParams.AllocatedFunds(this.enabled, this.extraParams); + } + + /** Whether Allocated Funds creation is enabled for this PaymentIntent. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * PaymentIntentUpdateParams.AllocatedFunds#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link PaymentIntentUpdateParams.AllocatedFunds#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter @EqualsAndHashCode(callSuper = false) public static class AmountDetails { diff --git a/src/main/java/com/stripe/param/capital/FinancingOfferCreateParams.java b/src/main/java/com/stripe/param/capital/FinancingOfferCreateParams.java new file mode 100644 index 00000000000..678587f3a70 --- /dev/null +++ b/src/main/java/com/stripe/param/capital/FinancingOfferCreateParams.java @@ -0,0 +1,238 @@ +// File generated from our OpenAPI spec +package com.stripe.param.capital; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class FinancingOfferCreateParams extends ApiRequestParams { + /** Required. */ + @SerializedName("advance_amount") + Long advanceAmount; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. */ + @SerializedName("fee_amount") + Long feeAmount; + + /** Required. */ + @SerializedName("financing_type") + FinancingType financingType; + + @SerializedName("status") + Status status; + + /** Required. */ + @SerializedName("withhold_rate") + BigDecimal withholdRate; + + private FinancingOfferCreateParams( + Long advanceAmount, + List expand, + Map extraParams, + Long feeAmount, + FinancingType financingType, + Status status, + BigDecimal withholdRate) { + this.advanceAmount = advanceAmount; + this.expand = expand; + this.extraParams = extraParams; + this.feeAmount = feeAmount; + this.financingType = financingType; + this.status = status; + this.withholdRate = withholdRate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long advanceAmount; + + private List expand; + + private Map extraParams; + + private Long feeAmount; + + private FinancingType financingType; + + private Status status; + + private BigDecimal withholdRate; + + /** Finalize and obtain parameter instance from this builder. */ + public FinancingOfferCreateParams build() { + return new FinancingOfferCreateParams( + this.advanceAmount, + this.expand, + this.extraParams, + this.feeAmount, + this.financingType, + this.status, + this.withholdRate); + } + + /** Required. */ + public Builder setAdvanceAmount(Long advanceAmount) { + this.advanceAmount = advanceAmount; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * FinancingOfferCreateParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * FinancingOfferCreateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * FinancingOfferCreateParams#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link FinancingOfferCreateParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. */ + public Builder setFeeAmount(Long feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** Required. */ + public Builder setFinancingType(FinancingOfferCreateParams.FinancingType financingType) { + this.financingType = financingType; + return this; + } + + public Builder setStatus(FinancingOfferCreateParams.Status status) { + this.status = status; + return this; + } + + /** Required. */ + public Builder setWithholdRate(BigDecimal withholdRate) { + this.withholdRate = withholdRate; + return this; + } + } + + public enum FinancingType implements ApiRequestParams.EnumParam { + @SerializedName("cash_advance") + CASH_ADVANCE("cash_advance"), + + @SerializedName("fixed_term_loan") + FIXED_TERM_LOAN("fixed_term_loan"), + + @SerializedName("flex_loan") + FLEX_LOAN("flex_loan"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + FinancingType(String value) { + this.value = value; + } + } + + public enum Status implements ApiRequestParams.EnumParam { + @SerializedName("accepted") + ACCEPTED("accepted"), + + @SerializedName("accepted_other_offer") + ACCEPTED_OTHER_OFFER("accepted_other_offer"), + + @SerializedName("canceled") + CANCELED("canceled"), + + @SerializedName("completed") + COMPLETED("completed"), + + @SerializedName("delivered") + DELIVERED("delivered"), + + @SerializedName("expired") + EXPIRED("expired"), + + @SerializedName("fully_repaid") + FULLY_REPAID("fully_repaid"), + + @SerializedName("paid_out") + PAID_OUT("paid_out"), + + @SerializedName("rejected") + REJECTED("rejected"), + + @SerializedName("replaced") + REPLACED("replaced"), + + @SerializedName("undelivered") + UNDELIVERED("undelivered"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Status(String value) { + this.value = value; + } + } +} diff --git a/src/main/java/com/stripe/param/capital/FinancingOfferRefillParams.java b/src/main/java/com/stripe/param/capital/FinancingOfferRefillParams.java new file mode 100644 index 00000000000..d4da06f1e44 --- /dev/null +++ b/src/main/java/com/stripe/param/capital/FinancingOfferRefillParams.java @@ -0,0 +1,238 @@ +// File generated from our OpenAPI spec +package com.stripe.param.capital; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class FinancingOfferRefillParams extends ApiRequestParams { + /** Required. */ + @SerializedName("advance_amount") + Long advanceAmount; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. */ + @SerializedName("fee_amount") + Long feeAmount; + + /** Required. */ + @SerializedName("financing_type") + FinancingType financingType; + + @SerializedName("status") + Status status; + + /** Required. */ + @SerializedName("withhold_rate") + BigDecimal withholdRate; + + private FinancingOfferRefillParams( + Long advanceAmount, + List expand, + Map extraParams, + Long feeAmount, + FinancingType financingType, + Status status, + BigDecimal withholdRate) { + this.advanceAmount = advanceAmount; + this.expand = expand; + this.extraParams = extraParams; + this.feeAmount = feeAmount; + this.financingType = financingType; + this.status = status; + this.withholdRate = withholdRate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long advanceAmount; + + private List expand; + + private Map extraParams; + + private Long feeAmount; + + private FinancingType financingType; + + private Status status; + + private BigDecimal withholdRate; + + /** Finalize and obtain parameter instance from this builder. */ + public FinancingOfferRefillParams build() { + return new FinancingOfferRefillParams( + this.advanceAmount, + this.expand, + this.extraParams, + this.feeAmount, + this.financingType, + this.status, + this.withholdRate); + } + + /** Required. */ + public Builder setAdvanceAmount(Long advanceAmount) { + this.advanceAmount = advanceAmount; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * FinancingOfferRefillParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * FinancingOfferRefillParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * FinancingOfferRefillParams#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link FinancingOfferRefillParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. */ + public Builder setFeeAmount(Long feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** Required. */ + public Builder setFinancingType(FinancingOfferRefillParams.FinancingType financingType) { + this.financingType = financingType; + return this; + } + + public Builder setStatus(FinancingOfferRefillParams.Status status) { + this.status = status; + return this; + } + + /** Required. */ + public Builder setWithholdRate(BigDecimal withholdRate) { + this.withholdRate = withholdRate; + return this; + } + } + + public enum FinancingType implements ApiRequestParams.EnumParam { + @SerializedName("cash_advance") + CASH_ADVANCE("cash_advance"), + + @SerializedName("fixed_term_loan") + FIXED_TERM_LOAN("fixed_term_loan"), + + @SerializedName("flex_loan") + FLEX_LOAN("flex_loan"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + FinancingType(String value) { + this.value = value; + } + } + + public enum Status implements ApiRequestParams.EnumParam { + @SerializedName("accepted") + ACCEPTED("accepted"), + + @SerializedName("accepted_other_offer") + ACCEPTED_OTHER_OFFER("accepted_other_offer"), + + @SerializedName("canceled") + CANCELED("canceled"), + + @SerializedName("completed") + COMPLETED("completed"), + + @SerializedName("delivered") + DELIVERED("delivered"), + + @SerializedName("expired") + EXPIRED("expired"), + + @SerializedName("fully_repaid") + FULLY_REPAID("fully_repaid"), + + @SerializedName("paid_out") + PAID_OUT("paid_out"), + + @SerializedName("rejected") + REJECTED("rejected"), + + @SerializedName("replaced") + REPLACED("replaced"), + + @SerializedName("undelivered") + UNDELIVERED("undelivered"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Status(String value) { + this.value = value; + } + } +} diff --git a/src/main/java/com/stripe/param/v2/reporting/ReportRunCreateParams.java b/src/main/java/com/stripe/param/v2/reporting/ReportRunCreateParams.java new file mode 100644 index 00000000000..c91ef7c0b45 --- /dev/null +++ b/src/main/java/com/stripe/param/v2/reporting/ReportRunCreateParams.java @@ -0,0 +1,207 @@ +// File generated from our OpenAPI spec +package com.stripe.param.v2.reporting; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.HashMap; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class ReportRunCreateParams extends ApiRequestParams { + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. The unique identifier of the {@code Report} being requested. */ + @SerializedName("report") + String report; + + /** + * Required. A map of parameter names to values, specifying how the report should + * be customized. The accepted parameters depend on the specific {@code Report} being run. + */ + @SerializedName("report_parameters") + Map reportParameters; + + /** Optional settings to customize the results of the {@code ReportRun}. */ + @SerializedName("result_options") + ResultOptions resultOptions; + + private ReportRunCreateParams( + Map extraParams, + String report, + Map reportParameters, + ResultOptions resultOptions) { + this.extraParams = extraParams; + this.report = report; + this.reportParameters = reportParameters; + this.resultOptions = resultOptions; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String report; + + private Map reportParameters; + + private ResultOptions resultOptions; + + /** Finalize and obtain parameter instance from this builder. */ + public ReportRunCreateParams build() { + return new ReportRunCreateParams( + this.extraParams, this.report, this.reportParameters, this.resultOptions); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ReportRunCreateParams#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link ReportRunCreateParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. The unique identifier of the {@code Report} being requested. */ + public Builder setReport(String report) { + this.report = report; + return this; + } + + /** + * Add a key/value pair to `reportParameters` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link ReportRunCreateParams#reportParameters} for the field documentation. + */ + public Builder putReportParameter(String key, Object value) { + if (this.reportParameters == null) { + this.reportParameters = new HashMap<>(); + } + this.reportParameters.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `reportParameters` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link ReportRunCreateParams#reportParameters} for the field documentation. + */ + public Builder putAllReportParameter(Map map) { + if (this.reportParameters == null) { + this.reportParameters = new HashMap<>(); + } + this.reportParameters.putAll(map); + return this; + } + + /** Optional settings to customize the results of the {@code ReportRun}. */ + public Builder setResultOptions(ReportRunCreateParams.ResultOptions resultOptions) { + this.resultOptions = resultOptions; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ResultOptions { + /** + * If set, the generated report file will be compressed into a ZIP folder. This is useful for + * reducing file size and download time for large reports. + */ + @SerializedName("compress_file") + Boolean compressFile; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private ResultOptions(Boolean compressFile, Map extraParams) { + this.compressFile = compressFile; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean compressFile; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public ReportRunCreateParams.ResultOptions build() { + return new ReportRunCreateParams.ResultOptions(this.compressFile, this.extraParams); + } + + /** + * If set, the generated report file will be compressed into a ZIP folder. This is useful for + * reducing file size and download time for large reports. + */ + public Builder setCompressFile(Boolean compressFile) { + this.compressFile = compressFile; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ReportRunCreateParams.ResultOptions#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link ReportRunCreateParams.ResultOptions#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } +} diff --git a/src/main/java/com/stripe/service/TestHelpersService.java b/src/main/java/com/stripe/service/TestHelpersService.java index ae9ca904ac7..03820b70524 100644 --- a/src/main/java/com/stripe/service/TestHelpersService.java +++ b/src/main/java/com/stripe/service/TestHelpersService.java @@ -9,6 +9,10 @@ public TestHelpersService(StripeResponseGetter responseGetter) { super(responseGetter); } + public com.stripe.service.testhelpers.CapitalService capital() { + return new com.stripe.service.testhelpers.CapitalService(this.getResponseGetter()); + } + public com.stripe.service.testhelpers.ConfirmationTokenService confirmationTokens() { return new com.stripe.service.testhelpers.ConfirmationTokenService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/V2Services.java b/src/main/java/com/stripe/service/V2Services.java index 7caae813077..c08dd0210c6 100644 --- a/src/main/java/com/stripe/service/V2Services.java +++ b/src/main/java/com/stripe/service/V2Services.java @@ -25,6 +25,10 @@ public com.stripe.service.v2.PaymentService payments() { return new com.stripe.service.v2.PaymentService(this.getResponseGetter()); } + public com.stripe.service.v2.ReportingService reporting() { + return new com.stripe.service.v2.ReportingService(this.getResponseGetter()); + } + public com.stripe.service.v2.TaxService tax() { return new com.stripe.service.v2.TaxService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/testhelpers/CapitalService.java b/src/main/java/com/stripe/service/testhelpers/CapitalService.java new file mode 100644 index 00000000000..24e6d8facba --- /dev/null +++ b/src/main/java/com/stripe/service/testhelpers/CapitalService.java @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec +package com.stripe.service.testhelpers; + +import com.stripe.net.ApiService; +import com.stripe.net.StripeResponseGetter; + +public final class CapitalService extends ApiService { + public CapitalService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + public com.stripe.service.testhelpers.capital.FinancingOfferService financingOffers() { + return new com.stripe.service.testhelpers.capital.FinancingOfferService( + this.getResponseGetter()); + } +} diff --git a/src/main/java/com/stripe/service/testhelpers/capital/FinancingOfferService.java b/src/main/java/com/stripe/service/testhelpers/capital/FinancingOfferService.java new file mode 100644 index 00000000000..b78ef8c774f --- /dev/null +++ b/src/main/java/com/stripe/service/testhelpers/capital/FinancingOfferService.java @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec +package com.stripe.service.testhelpers.capital; + +import com.stripe.exception.StripeException; +import com.stripe.model.capital.FinancingOffer; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.capital.FinancingOfferCreateParams; +import com.stripe.param.capital.FinancingOfferRefillParams; + +public final class FinancingOfferService extends ApiService { + public FinancingOfferService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Creates a test financing offer for a connected account. */ + public FinancingOffer create(FinancingOfferCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + /** Creates a test financing offer for a connected account. */ + public FinancingOffer create(FinancingOfferCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/test_helpers/capital/financing_offers"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, FinancingOffer.class); + } + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill(String financingOffer, FinancingOfferRefillParams params) + throws StripeException { + return refill(financingOffer, params, (RequestOptions) null); + } + /** Refills a test financing offer for a connected account. */ + public FinancingOffer refill( + String financingOffer, FinancingOfferRefillParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/capital/financing_offers/%s/refill", + ApiResource.urlEncodeId(financingOffer)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, FinancingOffer.class); + } +} diff --git a/src/main/java/com/stripe/service/v2/ReportingService.java b/src/main/java/com/stripe/service/v2/ReportingService.java new file mode 100644 index 00000000000..b183507d17f --- /dev/null +++ b/src/main/java/com/stripe/service/v2/ReportingService.java @@ -0,0 +1,19 @@ +// File generated from our OpenAPI spec +package com.stripe.service.v2; + +import com.stripe.net.ApiService; +import com.stripe.net.StripeResponseGetter; + +public final class ReportingService extends ApiService { + public ReportingService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + public com.stripe.service.v2.reporting.ReportRunService reportRuns() { + return new com.stripe.service.v2.reporting.ReportRunService(this.getResponseGetter()); + } + + public com.stripe.service.v2.reporting.ReportService reports() { + return new com.stripe.service.v2.reporting.ReportService(this.getResponseGetter()); + } +} diff --git a/src/main/java/com/stripe/service/v2/reporting/ReportRunService.java b/src/main/java/com/stripe/service/v2/reporting/ReportRunService.java new file mode 100644 index 00000000000..3fcaa058210 --- /dev/null +++ b/src/main/java/com/stripe/service/v2/reporting/ReportRunService.java @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec +package com.stripe.service.v2.reporting; + +import com.stripe.exception.RateLimitException; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.reporting.ReportRun; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.v2.reporting.ReportRunCreateParams; + +public final class ReportRunService extends ApiService { + public ReportRunService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** + * Initiates the generation of a {@code ReportRun} based on the specified report template and + * user-provided parameters. It's the starting point for obtaining report data, and returns a + * {@code ReportRun} object which can be used to track the progress and retrieve the results of + * the report. + */ + public ReportRun create(ReportRunCreateParams params) throws StripeException, RateLimitException { + return create(params, (RequestOptions) null); + } + /** + * Initiates the generation of a {@code ReportRun} based on the specified report template and + * user-provided parameters. It's the starting point for obtaining report data, and returns a + * {@code ReportRun} object which can be used to track the progress and retrieve the results of + * the report. + */ + public ReportRun create(ReportRunCreateParams params, RequestOptions options) + throws StripeException, RateLimitException { + String path = "/v2/reporting/report_runs"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, ReportRun.class); + } + /** + * Fetches the current state and details of a previously created {@code ReportRun}. If the {@code + * ReportRun} has succeeded, the endpoint will provide details for how to retrieve the results. + */ + public ReportRun retrieve(String id) throws StripeException { + return retrieve(id, (RequestOptions) null); + } + /** + * Fetches the current state and details of a previously created {@code ReportRun}. If the {@code + * ReportRun} has succeeded, the endpoint will provide details for how to retrieve the results. + */ + public ReportRun retrieve(String id, RequestOptions options) throws StripeException { + String path = String.format("/v2/reporting/report_runs/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, null, options); + return this.request(request, ReportRun.class); + } +} diff --git a/src/main/java/com/stripe/service/v2/reporting/ReportService.java b/src/main/java/com/stripe/service/v2/reporting/ReportService.java new file mode 100644 index 00000000000..f17de6e395f --- /dev/null +++ b/src/main/java/com/stripe/service/v2/reporting/ReportService.java @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec +package com.stripe.service.v2.reporting; + +import com.stripe.exception.StripeException; +import com.stripe.model.v2.reporting.Report; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; + +public final class ReportService extends ApiService { + public ReportService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** + * Retrieves metadata about a specific {@code Report} template, including its name, description, + * and the parameters it accepts. It's useful for understanding the capabilities and requirements + * of a particular {@code Report} before requesting a {@code ReportRun}. + */ + public Report retrieve(String id) throws StripeException { + return retrieve(id, (RequestOptions) null); + } + /** + * Retrieves metadata about a specific {@code Report} template, including its name, description, + * and the parameters it accepts. It's useful for understanding the capabilities and requirements + * of a particular {@code Report} before requesting a {@code ReportRun}. + */ + public Report retrieve(String id, RequestOptions options) throws StripeException { + String path = String.format("/v2/reporting/reports/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, null, options); + return this.request(request, Report.class); + } +} diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index ad9286985de..0ecd3a47b85 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -13,6 +13,9 @@ import com.stripe.param.*; import java.math.BigDecimal; import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import org.junit.jupiter.api.Test; class GeneratedExamples extends BaseStripeTest { @@ -3208,7 +3211,7 @@ public void testCoreEventsGetServices() throws StripeException { null, null, com.stripe.model.v2.core.Event.class, - "{\"changes\":{\"key\":{}},\"context\":\"context\",\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"reason\":{\"type\":\"request\",\"request\":{\"id\":\"obj_123\",\"idempotency_key\":\"idempotency_key\"}},\"type\":\"type\",\"v1_event_id\":\"v1_event_id\",\"livemode\":true}"); + "{\"changes\":{\"int_key\":123,\"string_key\":\"value\",\"boolean_key\":true,\"object_key\":{\"object_int_key\":123,\"object_string_key\":\"value\",\"object_boolean_key\":true},\"array_key\":[1,2,3]},\"context\":\"context\",\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"reason\":{\"type\":\"request\",\"request\":{\"id\":\"obj_123\",\"idempotency_key\":\"idempotency_key\"}},\"type\":\"type\",\"v1_event_id\":\"v1_event_id\"}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.core.Event event = client.v2().core().events().retrieve("ll_123"); @@ -27229,7 +27232,7 @@ public void testV2CoreEventGetServices() throws StripeException { null, new TypeToken< com.stripe.model.v2.StripeCollection>() {}.getType(), - "{\"data\":[{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}],\"next_page_url\":null,\"previous_page_url\":null}"); + "{\"data\":[{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"type\":\"type\"}],\"next_page_url\":null,\"previous_page_url\":null}"); StripeClient client = new StripeClient(networkSpy); com.stripe.param.v2.core.EventListParams params = @@ -27251,7 +27254,7 @@ public void testV2CoreEventGet2Services() throws StripeException { null, null, com.stripe.model.v2.core.Event.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"type\":\"type\"}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.core.Event event = client.v2().core().events().retrieve("id_123"); @@ -27450,7 +27453,7 @@ public void testV2CoreEventDestinationPost5Services() throws StripeException { null, null, com.stripe.model.v2.core.Event.class, - "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.core.event\",\"type\":\"type\",\"livemode\":true}"); + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"livemode\":true,\"object\":\"v2.core.event\",\"type\":\"type\"}"); StripeClient client = new StripeClient(networkSpy); com.stripe.model.v2.core.Event event = client.v2().core().eventDestinations().ping("id_123"); @@ -29101,6 +29104,92 @@ public void testV2PaymentsOffSessionPaymentPost3Services() throws StripeExceptio null); } + @Test + public void testV2ReportingReportGetServices() throws StripeException { + stubRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + "/v2/reporting/reports/id_123", + null, + null, + com.stripe.model.v2.reporting.Report.class, + "{\"id\":\"obj_123\",\"name\":\"name\",\"object\":\"v2.reporting.report\",\"parameters\":{\"key\":{\"description\":\"description\",\"required\":true,\"type\":\"string\"}},\"livemode\":true}"); + StripeClient client = new StripeClient(networkSpy); + + com.stripe.model.v2.reporting.Report report = + client.v2().reporting().reports().retrieve("id_123"); + assertNotNull(report); + verifyRequest( + BaseAddress.API, ApiResource.RequestMethod.GET, "/v2/reporting/reports/id_123", null, null); + } + + @Test + public void testV2ReportingReportRunPostServices() throws StripeException { + stubRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v2/reporting/report_runs", + null, + null, + com.stripe.model.v2.reporting.ReportRun.class, + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.reporting.report_run\",\"report\":\"report\",\"report_name\":\"report_name\",\"report_parameters\":{\"int_key\":123,\"string_key\":\"value\",\"boolean_key\":true,\"object_key\":{\"object_int_key\":123,\"object_string_key\":\"value\",\"object_boolean_key\":true},\"array_key\":[1,2,3]},\"status\":\"failed\",\"status_details\":{\"key\":{}},\"livemode\":true}"); + StripeClient client = new StripeClient(networkSpy); + + com.stripe.param.v2.reporting.ReportRunCreateParams params = + com.stripe.param.v2.reporting.ReportRunCreateParams.builder() + .setReport("report") + .putReportParameter("int_key", new BigDecimal(123)) + .putReportParameter("string_key", "value") + .putReportParameter("boolean_key", true) + .putReportParameter( + "object_key", + new HashMap() { + { + put("object_int_key", new BigDecimal(123)); + put("object_string_key", "value"); + put("object_boolean_key", true); + } + }) + .putReportParameter( + "array_key", + new ArrayList<>( + Arrays.asList(new BigDecimal(1), new BigDecimal(2), new BigDecimal(3)))) + .build(); + + com.stripe.model.v2.reporting.ReportRun reportRun = + client.v2().reporting().reportRuns().create(params); + assertNotNull(reportRun); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v2/reporting/report_runs", + params.toMap(), + null); + } + + @Test + public void testV2ReportingReportRunGetServices() throws StripeException { + stubRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + "/v2/reporting/report_runs/id_123", + null, + null, + com.stripe.model.v2.reporting.ReportRun.class, + "{\"created\":\"1970-01-12T21:42:34.472Z\",\"id\":\"obj_123\",\"object\":\"v2.reporting.report_run\",\"report\":\"report\",\"report_name\":\"report_name\",\"report_parameters\":{\"int_key\":123,\"string_key\":\"value\",\"boolean_key\":true,\"object_key\":{\"object_int_key\":123,\"object_string_key\":\"value\",\"object_boolean_key\":true},\"array_key\":[1,2,3]},\"status\":\"failed\",\"status_details\":{\"key\":{}},\"livemode\":true}"); + StripeClient client = new StripeClient(networkSpy); + + com.stripe.model.v2.reporting.ReportRun reportRun = + client.v2().reporting().reportRuns().retrieve("id_123"); + assertNotNull(reportRun); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + "/v2/reporting/report_runs/id_123", + null, + null); + } + @Test public void testV2TaxAutomaticRulePostServices() throws StripeException { stubRequest(