Skip to content

Commit

Permalink
API Updates (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored Mar 23, 2022
1 parent 7942c4f commit 9948946
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/stripe/model/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,8 @@ public static class CustomerTaxId extends StripeObject {
* jp_cn}, {@code jp_rn}, {@code li_uid}, {@code my_itn}, {@code us_ein}, {@code kr_brn}, {@code
* ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code
* my_sst}, {@code sg_gst}, {@code ae_trn}, {@code cl_tin}, {@code sa_vat}, {@code id_npwp},
* {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, {@code is_vat}, or {@code
* unknown}.
* {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, {@code is_vat}, {@code
* bg_uic}, {@code hu_tin}, {@code si_tin}, or {@code unknown}.
*/
@SerializedName("type")
String type;
Expand Down
71 changes: 71 additions & 0 deletions src/main/java/com/stripe/model/Refund.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.RefundCancelParams;
import com.stripe.param.RefundCreateParams;
import com.stripe.param.RefundListParams;
import com.stripe.param.RefundRetrieveParams;
Expand Down Expand Up @@ -404,6 +405,76 @@ public Refund update(RefundUpdateParams params, RequestOptions options) throws S
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel() throws StripeException {
return cancel((Map<String, Object>) null, (RequestOptions) null);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel(RequestOptions options) throws StripeException {
return cancel((Map<String, Object>) null, options);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel(Map<String, Object> params) throws StripeException {
return cancel(params, (RequestOptions) null);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel(Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel(RefundCancelParams params) throws StripeException {
return cancel(params, (RequestOptions) null);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* <p>Refunds in other states cannot be canceled, and only refunds for payment methods that
* require customer action will enter the <code>requires_action</code> state.
*/
public Refund cancel(RefundCancelParams params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options);
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/stripe/model/TaxId.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public class TaxId extends ApiResource implements HasId {
String object;

/**
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code br_cnpj},
* {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code
* ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif}, {@code eu_vat},
* {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code id_npwp}, {@code il_vat}, {@code in_gst},
* {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc},
* {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn},
* {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code th_vat}, {@code tw_vat},
* {@code ua_vat}, {@code us_ein}, or {@code za_vat}. Note that some legacy tax IDs have type
* {@code unknown}
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code bg_uic},
* {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
* ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif},
* {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code hu_tin}, {@code id_npwp},
* {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn},
* {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat},
* {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code sg_uen},
* {@code si_tin}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code
* za_vat}. Note that some legacy tax IDs have type {@code unknown}
*/
@SerializedName("type")
String type;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/model/checkout/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ public static class TaxID extends StripeObject {
* kr_brn}, {@code ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code
* ca_pst_sk}, {@code my_sst}, {@code sg_gst}, {@code ae_trn}, {@code cl_tin}, {@code sa_vat},
* {@code id_npwp}, {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, {@code
* is_vat}, or {@code unknown}.
* is_vat}, {@code bg_uic}, {@code hu_tin}, {@code si_tin}, or {@code unknown}.
*/
@SerializedName("type")
String type;
Expand Down
43 changes: 27 additions & 16 deletions src/main/java/com/stripe/param/CustomerCreateParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -1272,14 +1272,15 @@ public static class TaxIdData {
Map<String, Object> extraParams;

/**
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code br_cnpj},
* {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb},
* {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif}, {@code
* eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code id_npwp}, {@code il_vat},
* {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn}, {@code li_uid},
* {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat}, {@code
* nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code sg_uen},
* {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code bg_uic},
* {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
* ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code
* es_cif}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code hu_tin},
* {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code
* jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn},
* {@code my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code
* sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code th_vat}, {@code tw_vat},
* {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
*/
@SerializedName("type")
Type type;
Expand Down Expand Up @@ -1337,14 +1338,15 @@ public Builder putAllExtraParam(Map<String, Object> map) {
}

/**
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code br_cnpj},
* {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb},
* {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif}, {@code
* eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code id_npwp}, {@code il_vat},
* {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn}, {@code
* li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat},
* {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code
* sg_uen}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code bg_uic},
* {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc},
* {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin},
* {@code es_cif}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code
* hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn},
* {@code jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code
* my_itn}, {@code my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code ru_kpp},
* {@code sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code th_vat}, {@code
* tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
*/
public Builder setType(Type type) {
this.type = type;
Expand All @@ -1368,6 +1370,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("au_arn")
AU_ARN("au_arn"),

@SerializedName("bg_uic")
BG_UIC("bg_uic"),

@SerializedName("br_cnpj")
BR_CNPJ("br_cnpj"),

Expand Down Expand Up @@ -1413,6 +1418,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("hk_br")
HK_BR("hk_br"),

@SerializedName("hu_tin")
HU_TIN("hu_tin"),

@SerializedName("id_npwp")
ID_NPWP("id_npwp"),

Expand Down Expand Up @@ -1470,6 +1478,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("sg_uen")
SG_UEN("sg_uen"),

@SerializedName("si_tin")
SI_TIN("si_tin"),

@SerializedName("th_vat")
TH_VAT("th_vat"),

Expand Down
42 changes: 26 additions & 16 deletions src/main/java/com/stripe/param/InvoiceUpcomingParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -1415,14 +1415,15 @@ public static class TaxId {
Map<String, Object> extraParams;

/**
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code br_cnpj},
* {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb},
* {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif}, {@code
* eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code id_npwp}, {@code il_vat},
* {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn}, {@code
* li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat},
* {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code
* sg_uen}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code bg_uic},
* {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc},
* {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin},
* {@code es_cif}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code
* hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn},
* {@code jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code
* my_itn}, {@code my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code ru_kpp},
* {@code sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code th_vat}, {@code
* tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
*/
@SerializedName("type")
Type type;
Expand Down Expand Up @@ -1483,14 +1484,14 @@ public Builder putAllExtraParam(Map<String, Object> map) {

/**
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code
* br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
* ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code
* es_cif}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code id_npwp},
* {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code
* kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst},
* {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code
* sg_gst}, {@code sg_uen}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein},
* or {@code za_vat}.
* bg_uic}, {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code
* ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code
* cl_tin}, {@code es_cif}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br},
* {@code hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code
* jp_cn}, {@code jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp},
* {@code my_itn}, {@code my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code
* ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code th_vat},
* {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code za_vat}.
*/
public Builder setType(Type type) {
this.type = type;
Expand All @@ -1514,6 +1515,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("au_arn")
AU_ARN("au_arn"),

@SerializedName("bg_uic")
BG_UIC("bg_uic"),

@SerializedName("br_cnpj")
BR_CNPJ("br_cnpj"),

Expand Down Expand Up @@ -1559,6 +1563,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("hk_br")
HK_BR("hk_br"),

@SerializedName("hu_tin")
HU_TIN("hu_tin"),

@SerializedName("id_npwp")
ID_NPWP("id_npwp"),

Expand Down Expand Up @@ -1616,6 +1623,9 @@ public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("sg_uen")
SG_UEN("sg_uen"),

@SerializedName("si_tin")
SI_TIN("si_tin"),

@SerializedName("th_vat")
TH_VAT("th_vat"),

Expand Down
25 changes: 23 additions & 2 deletions src/main/java/com/stripe/param/QuoteListParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,30 @@ public class QuoteListParams extends ApiRequestParams {
@SerializedName("status")
Status status;

/**
* Provides a list of quotes that are associated with the specified test clock. The response will
* not include quotes with test clocks if this and the customer parameter is not set.
*/
@SerializedName("test_clock")
String testClock;

private QuoteListParams(
String customer,
String endingBefore,
List<String> expand,
Map<String, Object> extraParams,
Long limit,
String startingAfter,
Status status) {
Status status,
String testClock) {
this.customer = customer;
this.endingBefore = endingBefore;
this.expand = expand;
this.extraParams = extraParams;
this.limit = limit;
this.startingAfter = startingAfter;
this.status = status;
this.testClock = testClock;
}

public static Builder builder() {
Expand All @@ -93,6 +102,8 @@ public static class Builder {

private Status status;

private String testClock;

/** Finalize and obtain parameter instance from this builder. */
public QuoteListParams build() {
return new QuoteListParams(
Expand All @@ -102,7 +113,8 @@ public QuoteListParams build() {
this.extraParams,
this.limit,
this.startingAfter,
this.status);
this.status,
this.testClock);
}

/** The ID of the customer whose quotes will be retrieved. */
Expand Down Expand Up @@ -199,6 +211,15 @@ public Builder setStatus(Status status) {
this.status = status;
return this;
}

/**
* Provides a list of quotes that are associated with the specified test clock. The response
* will not include quotes with test clocks if this and the customer parameter is not set.
*/
public Builder setTestClock(String testClock) {
this.testClock = testClock;
return this;
}
}

public enum Status implements ApiRequestParams.EnumParam {
Expand Down
Loading

0 comments on commit 9948946

Please sign in to comment.