|
10 | 10 | import com.stripe.param.PayoutCreateParams;
|
11 | 11 | import com.stripe.param.PayoutListParams;
|
12 | 12 | import com.stripe.param.PayoutRetrieveParams;
|
| 13 | +import com.stripe.param.PayoutReverseParams; |
13 | 14 | import com.stripe.param.PayoutUpdateParams;
|
14 | 15 | import java.util.Map;
|
15 | 16 | import lombok.EqualsAndHashCode;
|
@@ -129,6 +130,18 @@ public class Payout extends ApiResource implements MetadataStore<Payout>, Balanc
|
129 | 130 | @SerializedName("object")
|
130 | 131 | String object;
|
131 | 132 |
|
| 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 | + |
132 | 145 | /**
|
133 | 146 | * The source balance this payout came from. One of {@code card}, {@code fpx}, or {@code
|
134 | 147 | * bank_account}.
|
@@ -214,6 +227,42 @@ public void setFailureBalanceTransactionObject(BalanceTransaction expandableObje
|
214 | 227 | new ExpandableField<BalanceTransaction>(expandableObject.getId(), expandableObject);
|
215 | 228 | }
|
216 | 229 |
|
| 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 | + |
217 | 266 | /**
|
218 | 267 | * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout
|
219 | 268 | * 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
|
473 | 522 | String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId())));
|
474 | 523 | return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options);
|
475 | 524 | }
|
| 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 | + } |
476 | 613 | }
|
0 commit comments