Skip to content

Commit

Permalink
codegen --beta
Browse files Browse the repository at this point in the history
  • Loading branch information
prathmesh-stripe committed Oct 2, 2024
1 parent cf94e6f commit a5e173b
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 31 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/stripe/ApiVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
package com.stripe;

final class ApiVersion {
public static final String CURRENT = "2024-06-20";
public static final String PREVIEW_CURRENT = "cs_ubb_launch";
public static final String CURRENT = "2024-09-30.acacia";
}
1 change: 0 additions & 1 deletion src/main/java/com/stripe/Stripe.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public abstract class Stripe {
public static final int DEFAULT_READ_TIMEOUT = 80 * 1000;

public static final String API_VERSION = ApiVersion.CURRENT;
public static final String PREVIEW_API_VERSION = ApiVersion.PREVIEW_CURRENT;
public static final String CONNECT_API_BASE = "https://connect.stripe.com";
public static final String LIVE_API_BASE = "https://api.stripe.com";
public static final String UPLOAD_API_BASE = "https://files.stripe.com";
Expand Down
73 changes: 73 additions & 0 deletions src/main/java/com/stripe/model/CreditNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
import com.stripe.model.billing.CreditBalanceTransaction;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
Expand Down Expand Up @@ -148,6 +149,9 @@ public class CreditNote extends ApiResource implements HasId, MetadataStore<Cred
@SerializedName("pre_payment_amount")
Long prePaymentAmount;

@SerializedName("pretax_credit_amounts")
List<CreditNote.PretaxCreditAmount> pretaxCreditAmounts;

/**
* Reason for issuing this credit note, one of {@code duplicate}, {@code fraudulent}, {@code
* order_change}, or {@code product_unsatisfactory}.
Expand Down Expand Up @@ -658,6 +662,75 @@ public void setDiscountObject(Discount expandableObject) {
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class PretaxCreditAmount extends StripeObject {
/** The amount, in cents (or local equivalent), of the pretax credit amount. */
@SerializedName("amount")
Long amount;

/** The credit balance transaction that was applied to get this pretax credit amount. */
@SerializedName("credit_balance_transaction")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<CreditBalanceTransaction> creditBalanceTransaction;

/** The discount that was applied to get this pretax credit amount. */
@SerializedName("discount")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Discount> discount;

/**
* Type of the pretax credit amount referenced.
*
* <p>One of {@code credit_balance_transaction}, or {@code discount}.
*/
@SerializedName("type")
String type;

/** Get ID of expandable {@code creditBalanceTransaction} object. */
public String getCreditBalanceTransaction() {
return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null;
}

public void setCreditBalanceTransaction(String id) {
this.creditBalanceTransaction =
ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction);
}

/** Get expanded {@code creditBalanceTransaction}. */
public CreditBalanceTransaction getCreditBalanceTransactionObject() {
return (this.creditBalanceTransaction != null)
? this.creditBalanceTransaction.getExpanded()
: null;
}

public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) {
this.creditBalanceTransaction =
new ExpandableField<CreditBalanceTransaction>(expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code discount} object. */
public String getDiscount() {
return (this.discount != null) ? this.discount.getId() : null;
}

public void setDiscount(String id) {
this.discount = ApiResource.setExpandableFieldId(id, this.discount);
}

/** Get expanded {@code discount}. */
public Discount getDiscountObject() {
return (this.discount != null) ? this.discount.getExpanded() : null;
}

public void setDiscountObject(Discount expandableObject) {
this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
97 changes: 97 additions & 0 deletions src/main/java/com/stripe/model/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
import com.stripe.model.billing.CreditBalanceTransaction;
import com.stripe.model.testhelpers.TestClock;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
Expand Down Expand Up @@ -639,6 +640,9 @@ public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice
@SerializedName("total_margin_amounts")
List<Invoice.TotalMarginAmount> totalMarginAmounts;

@SerializedName("total_pretax_credit_amounts")
List<Invoice.TotalPretaxCreditAmount> totalPretaxCreditAmounts;

/** The aggregate amounts calculated per tax rate for all line items. */
@SerializedName("total_tax_amounts")
List<Invoice.TotalTaxAmount> totalTaxAmounts;
Expand Down Expand Up @@ -3205,6 +3209,99 @@ public void setMarginObject(Margin expandableObject) {
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class TotalPretaxCreditAmount extends StripeObject {
/** The amount, in cents (or local equivalent), of the pretax credit amount. */
@SerializedName("amount")
Long amount;

/** The credit balance transaction that was applied to get this pretax credit amount. */
@SerializedName("credit_balance_transaction")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<CreditBalanceTransaction> creditBalanceTransaction;

/** The discount that was applied to get this pretax credit amount. */
@SerializedName("discount")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Discount> discount;

/** The margin that was applied to get this pretax credit amount. */
@SerializedName("margin")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Margin> margin;

/**
* Type of the pretax credit amount referenced.
*
* <p>One of {@code credit_balance_transaction}, {@code discount}, or {@code margin}.
*/
@SerializedName("type")
String type;

/** Get ID of expandable {@code creditBalanceTransaction} object. */
public String getCreditBalanceTransaction() {
return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null;
}

public void setCreditBalanceTransaction(String id) {
this.creditBalanceTransaction =
ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction);
}

/** Get expanded {@code creditBalanceTransaction}. */
public CreditBalanceTransaction getCreditBalanceTransactionObject() {
return (this.creditBalanceTransaction != null)
? this.creditBalanceTransaction.getExpanded()
: null;
}

public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) {
this.creditBalanceTransaction =
new ExpandableField<CreditBalanceTransaction>(expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code discount} object. */
public String getDiscount() {
return (this.discount != null) ? this.discount.getId() : null;
}

public void setDiscount(String id) {
this.discount = ApiResource.setExpandableFieldId(id, this.discount);
}

/** Get expanded {@code discount}. */
public Discount getDiscountObject() {
return (this.discount != null) ? this.discount.getExpanded() : null;
}

public void setDiscountObject(Discount expandableObject) {
this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code margin} object. */
public String getMargin() {
return (this.margin != null) ? this.margin.getId() : null;
}

public void setMargin(String id) {
this.margin = ApiResource.setExpandableFieldId(id, this.margin);
}

/** Get expanded {@code margin}. */
public Margin getMarginObject() {
return (this.margin != null) ? this.margin.getExpanded() : null;
}

public void setMarginObject(Margin expandableObject) {
this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/model/InvoiceLineItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public static class PretaxCreditAmount extends StripeObject {
/**
* Type of the pretax credit amount referenced.
*
* <p>One of {@code credit_balance_transaction}, or {@code discount}.
* <p>One of {@code credit_balance_transaction}, {@code discount}, or {@code margin}.
*/
@SerializedName("type")
String type;
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/com/stripe/model/Quote.java
Original file line number Diff line number Diff line change
Expand Up @@ -1874,12 +1874,6 @@ public static class SubscriptionData extends StripeObject {
@SerializedName("end_behavior")
String endBehavior;

/** The id of the subscription schedule that will be updated when the quote is accepted. */
@SerializedName("from_schedule")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<com.stripe.model.SubscriptionSchedule> fromSchedule;

/** The id of the subscription that will be updated when the quote is accepted. */
@SerializedName("from_subscription")
@Getter(lombok.AccessLevel.NONE)
Expand Down Expand Up @@ -1922,26 +1916,6 @@ public static class SubscriptionData extends StripeObject {
@SerializedName("trial_period_days")
Long trialPeriodDays;

/** Get ID of expandable {@code fromSchedule} object. */
public String getFromSchedule() {
return (this.fromSchedule != null) ? this.fromSchedule.getId() : null;
}

public void setFromSchedule(String id) {
this.fromSchedule = ApiResource.setExpandableFieldId(id, this.fromSchedule);
}

/** Get expanded {@code fromSchedule}. */
public com.stripe.model.SubscriptionSchedule getFromScheduleObject() {
return (this.fromSchedule != null) ? this.fromSchedule.getExpanded() : null;
}

public void setFromScheduleObject(com.stripe.model.SubscriptionSchedule expandableObject) {
this.fromSchedule =
new ExpandableField<com.stripe.model.SubscriptionSchedule>(
expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code fromSubscription} object. */
public String getFromSubscription() {
return (this.fromSubscription != null) ? this.fromSubscription.getId() : null;
Expand Down
97 changes: 97 additions & 0 deletions src/main/java/com/stripe/model/QuotePreviewInvoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
import com.stripe.model.billing.CreditBalanceTransaction;
import com.stripe.model.testhelpers.TestClock;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
Expand Down Expand Up @@ -584,6 +585,9 @@ public class QuotePreviewInvoice extends ApiResource implements HasId {
@SerializedName("total_margin_amounts")
List<QuotePreviewInvoice.TotalMarginAmount> totalMarginAmounts;

@SerializedName("total_pretax_credit_amounts")
List<QuotePreviewInvoice.TotalPretaxCreditAmount> totalPretaxCreditAmounts;

/** The aggregate amounts calculated per tax rate for all line items. */
@SerializedName("total_tax_amounts")
List<QuotePreviewInvoice.TotalTaxAmount> totalTaxAmounts;
Expand Down Expand Up @@ -1717,6 +1721,99 @@ public void setMarginObject(Margin expandableObject) {
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class TotalPretaxCreditAmount extends StripeObject {
/** The amount, in cents (or local equivalent), of the pretax credit amount. */
@SerializedName("amount")
Long amount;

/** The credit balance transaction that was applied to get this pretax credit amount. */
@SerializedName("credit_balance_transaction")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<CreditBalanceTransaction> creditBalanceTransaction;

/** The discount that was applied to get this pretax credit amount. */
@SerializedName("discount")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Discount> discount;

/** The margin that was applied to get this pretax credit amount. */
@SerializedName("margin")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Margin> margin;

/**
* Type of the pretax credit amount referenced.
*
* <p>One of {@code credit_balance_transaction}, {@code discount}, or {@code margin}.
*/
@SerializedName("type")
String type;

/** Get ID of expandable {@code creditBalanceTransaction} object. */
public String getCreditBalanceTransaction() {
return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null;
}

public void setCreditBalanceTransaction(String id) {
this.creditBalanceTransaction =
ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction);
}

/** Get expanded {@code creditBalanceTransaction}. */
public CreditBalanceTransaction getCreditBalanceTransactionObject() {
return (this.creditBalanceTransaction != null)
? this.creditBalanceTransaction.getExpanded()
: null;
}

public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) {
this.creditBalanceTransaction =
new ExpandableField<CreditBalanceTransaction>(expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code discount} object. */
public String getDiscount() {
return (this.discount != null) ? this.discount.getId() : null;
}

public void setDiscount(String id) {
this.discount = ApiResource.setExpandableFieldId(id, this.discount);
}

/** Get expanded {@code discount}. */
public Discount getDiscountObject() {
return (this.discount != null) ? this.discount.getExpanded() : null;
}

public void setDiscountObject(Discount expandableObject) {
this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
}

/** Get ID of expandable {@code margin} object. */
public String getMargin() {
return (this.margin != null) ? this.margin.getId() : null;
}

public void setMargin(String id) {
this.margin = ApiResource.setExpandableFieldId(id, this.margin);
}

/** Get expanded {@code margin}. */
public Margin getMarginObject() {
return (this.margin != null) ? this.margin.getExpanded() : null;
}

public void setMarginObject(Margin expandableObject) {
this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
Loading

0 comments on commit a5e173b

Please sign in to comment.