Skip to content

Commit 261a7e7

Browse files
committed
Codegen for openapi 4bd4c01
1 parent 7578153 commit 261a7e7

File tree

2 files changed

+274
-0
lines changed

2 files changed

+274
-0
lines changed

src/main/java/com/stripe/model/Payout.java

+137
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.stripe.param.PayoutCreateParams;
1111
import com.stripe.param.PayoutListParams;
1212
import com.stripe.param.PayoutRetrieveParams;
13+
import com.stripe.param.PayoutReverseParams;
1314
import com.stripe.param.PayoutUpdateParams;
1415
import java.util.Map;
1516
import lombok.EqualsAndHashCode;
@@ -129,6 +130,18 @@ public class Payout extends ApiResource implements MetadataStore<Payout>, Balanc
129130
@SerializedName("object")
130131
String object;
131132

133+
/** If the payout reverses another, this is the ID of the original payout. */
134+
@SerializedName("original_payout")
135+
@Getter(lombok.AccessLevel.NONE)
136+
@Setter(lombok.AccessLevel.NONE)
137+
ExpandableField<Payout> originalPayout;
138+
139+
/** If the payout was reversed, this is the ID of the payout that reverses this payout. */
140+
@SerializedName("reversed_by")
141+
@Getter(lombok.AccessLevel.NONE)
142+
@Setter(lombok.AccessLevel.NONE)
143+
ExpandableField<Payout> reversedBy;
144+
132145
/**
133146
* The source balance this payout came from. One of {@code card}, {@code fpx}, or {@code
134147
* bank_account}.
@@ -214,6 +227,42 @@ public void setFailureBalanceTransactionObject(BalanceTransaction expandableObje
214227
new ExpandableField<BalanceTransaction>(expandableObject.getId(), expandableObject);
215228
}
216229

230+
/** Get ID of expandable {@code originalPayout} object. */
231+
public String getOriginalPayout() {
232+
return (this.originalPayout != null) ? this.originalPayout.getId() : null;
233+
}
234+
235+
public void setOriginalPayout(String id) {
236+
this.originalPayout = ApiResource.setExpandableFieldId(id, this.originalPayout);
237+
}
238+
239+
/** Get expanded {@code originalPayout}. */
240+
public Payout getOriginalPayoutObject() {
241+
return (this.originalPayout != null) ? this.originalPayout.getExpanded() : null;
242+
}
243+
244+
public void setOriginalPayoutObject(Payout expandableObject) {
245+
this.originalPayout = new ExpandableField<Payout>(expandableObject.getId(), expandableObject);
246+
}
247+
248+
/** Get ID of expandable {@code reversedBy} object. */
249+
public String getReversedBy() {
250+
return (this.reversedBy != null) ? this.reversedBy.getId() : null;
251+
}
252+
253+
public void setReversedBy(String id) {
254+
this.reversedBy = ApiResource.setExpandableFieldId(id, this.reversedBy);
255+
}
256+
257+
/** Get expanded {@code reversedBy}. */
258+
public Payout getReversedByObject() {
259+
return (this.reversedBy != null) ? this.reversedBy.getExpanded() : null;
260+
}
261+
262+
public void setReversedByObject(Payout expandableObject) {
263+
this.reversedBy = new ExpandableField<Payout>(expandableObject.getId(), expandableObject);
264+
}
265+
217266
/**
218267
* Retrieves the details of an existing payout. Supply the unique payout ID from either a payout
219268
* creation request or the payout list, and Stripe will return the corresponding payout
@@ -473,4 +522,92 @@ public Payout cancel(PayoutCancelParams params, RequestOptions options) throws S
473522
String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId())));
474523
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options);
475524
}
525+
526+
/**
527+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
528+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
529+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
530+
*
531+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
532+
* authorized signatory of the selected bank account has authorized the debit on the bank account
533+
* and that no other authorization is required.
534+
*/
535+
public Payout reverse() throws StripeException {
536+
return reverse((Map<String, Object>) null, (RequestOptions) null);
537+
}
538+
539+
/**
540+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
541+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
542+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
543+
*
544+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
545+
* authorized signatory of the selected bank account has authorized the debit on the bank account
546+
* and that no other authorization is required.
547+
*/
548+
public Payout reverse(RequestOptions options) throws StripeException {
549+
return reverse((Map<String, Object>) null, options);
550+
}
551+
552+
/**
553+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
554+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
555+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
556+
*
557+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
558+
* authorized signatory of the selected bank account has authorized the debit on the bank account
559+
* and that no other authorization is required.
560+
*/
561+
public Payout reverse(Map<String, Object> params) throws StripeException {
562+
return reverse(params, (RequestOptions) null);
563+
}
564+
565+
/**
566+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
567+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
568+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
569+
*
570+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
571+
* authorized signatory of the selected bank account has authorized the debit on the bank account
572+
* and that no other authorization is required.
573+
*/
574+
public Payout reverse(Map<String, Object> params, RequestOptions options) throws StripeException {
575+
String url =
576+
String.format(
577+
"%s%s",
578+
Stripe.getApiBase(),
579+
String.format("/v1/payouts/%s/reverse", ApiResource.urlEncodeId(this.getId())));
580+
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options);
581+
}
582+
583+
/**
584+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
585+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
586+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
587+
*
588+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
589+
* authorized signatory of the selected bank account has authorized the debit on the bank account
590+
* and that no other authorization is required.
591+
*/
592+
public Payout reverse(PayoutReverseParams params) throws StripeException {
593+
return reverse(params, (RequestOptions) null);
594+
}
595+
596+
/**
597+
* Reverses a payout by debiting the destination bank account. Only payouts for connected accounts
598+
* to US bank accounts may be reversed at this time. If the payout is in the <code>pending</code>
599+
* status, <code>/v1/payouts/:id/cancel</code> should be used instead.
600+
*
601+
* <p>By requesting a reversal via <code>/v1/payouts/:id/reverse</code>, you confirm that the
602+
* authorized signatory of the selected bank account has authorized the debit on the bank account
603+
* and that no other authorization is required.
604+
*/
605+
public Payout reverse(PayoutReverseParams params, RequestOptions options) throws StripeException {
606+
String url =
607+
String.format(
608+
"%s%s",
609+
Stripe.getApiBase(),
610+
String.format("/v1/payouts/%s/reverse", ApiResource.urlEncodeId(this.getId())));
611+
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options);
612+
}
476613
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.param;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.net.ApiRequestParams;
6+
import java.util.ArrayList;
7+
import java.util.HashMap;
8+
import java.util.List;
9+
import java.util.Map;
10+
import lombok.Getter;
11+
12+
@Getter
13+
public class PayoutReverseParams extends ApiRequestParams {
14+
/** Specifies which fields in the response should be expanded. */
15+
@SerializedName("expand")
16+
List<String> expand;
17+
18+
/**
19+
* Map of extra parameters for custom features not available in this client library. The content
20+
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
21+
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
22+
* param object. Effectively, this map is flattened to its parent instance.
23+
*/
24+
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
25+
Map<String, Object> extraParams;
26+
27+
/**
28+
* Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
29+
* to an object. This can be useful for storing additional information about the object in a
30+
* structured format. Individual keys can be unset by posting an empty value to them. All keys can
31+
* be unset by posting an empty value to {@code metadata}.
32+
*/
33+
@SerializedName("metadata")
34+
Map<String, String> metadata;
35+
36+
private PayoutReverseParams(
37+
List<String> expand, Map<String, Object> extraParams, Map<String, String> metadata) {
38+
this.expand = expand;
39+
this.extraParams = extraParams;
40+
this.metadata = metadata;
41+
}
42+
43+
public static Builder builder() {
44+
return new Builder();
45+
}
46+
47+
public static class Builder {
48+
private List<String> expand;
49+
50+
private Map<String, Object> extraParams;
51+
52+
private Map<String, String> metadata;
53+
54+
/** Finalize and obtain parameter instance from this builder. */
55+
public PayoutReverseParams build() {
56+
return new PayoutReverseParams(this.expand, this.extraParams, this.metadata);
57+
}
58+
59+
/**
60+
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
61+
* subsequent calls adds additional elements to the original list. See {@link
62+
* PayoutReverseParams#expand} for the field documentation.
63+
*/
64+
public Builder addExpand(String element) {
65+
if (this.expand == null) {
66+
this.expand = new ArrayList<>();
67+
}
68+
this.expand.add(element);
69+
return this;
70+
}
71+
72+
/**
73+
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
74+
* subsequent calls adds additional elements to the original list. See {@link
75+
* PayoutReverseParams#expand} for the field documentation.
76+
*/
77+
public Builder addAllExpand(List<String> elements) {
78+
if (this.expand == null) {
79+
this.expand = new ArrayList<>();
80+
}
81+
this.expand.addAll(elements);
82+
return this;
83+
}
84+
85+
/**
86+
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
87+
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
88+
* PayoutReverseParams#extraParams} for the field documentation.
89+
*/
90+
public Builder putExtraParam(String key, Object value) {
91+
if (this.extraParams == null) {
92+
this.extraParams = new HashMap<>();
93+
}
94+
this.extraParams.put(key, value);
95+
return this;
96+
}
97+
98+
/**
99+
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
100+
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
101+
* See {@link PayoutReverseParams#extraParams} for the field documentation.
102+
*/
103+
public Builder putAllExtraParam(Map<String, Object> map) {
104+
if (this.extraParams == null) {
105+
this.extraParams = new HashMap<>();
106+
}
107+
this.extraParams.putAll(map);
108+
return this;
109+
}
110+
111+
/**
112+
* Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call,
113+
* and subsequent calls add additional key/value pairs to the original map. See {@link
114+
* PayoutReverseParams#metadata} for the field documentation.
115+
*/
116+
public Builder putMetadata(String key, String value) {
117+
if (this.metadata == null) {
118+
this.metadata = new HashMap<>();
119+
}
120+
this.metadata.put(key, value);
121+
return this;
122+
}
123+
124+
/**
125+
* Add all map key/value pairs to `metadata` map. A map is initialized for the first
126+
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
127+
* See {@link PayoutReverseParams#metadata} for the field documentation.
128+
*/
129+
public Builder putAllMetadata(Map<String, String> map) {
130+
if (this.metadata == null) {
131+
this.metadata = new HashMap<>();
132+
}
133+
this.metadata.putAll(map);
134+
return this;
135+
}
136+
}
137+
}

0 commit comments

Comments
 (0)