com.stripe.model.OrderReturn Maven / Gradle / Ivy
// Generated by delombok at Fri Jan 24 09:51:02 PST 2020
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.OrderReturnListParams;
import com.stripe.param.OrderReturnRetrieveParams;
import java.util.List;
import java.util.Map;
public class OrderReturn extends ApiResource implements HasId {
/**
* A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1,
* Japanese Yen being a zero-decimal currency) representing the total amount for the returned line
* item.
*/
@SerializedName("amount")
Long amount;
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
@SerializedName("created")
Long created;
/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
* lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
@SerializedName("currency")
String currency;
/**
* Unique identifier for the object.
*/
@SerializedName("id")
String id;
/**
* The items included in this order return.
*/
@SerializedName("items")
List items;
/**
* Has the value `true` if the object exists in live mode or the value `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 `order_return`.
*/
@SerializedName("object")
String object;
/**
* The order that this return includes items from.
*/
@SerializedName("order")
ExpandableField order;
/**
* The ID of the refund issued for this return.
*/
@SerializedName("refund")
ExpandableField refund;
/**
* Get id of expandable `order` object.
*/
public String getOrder() {
return (this.order != null) ? this.order.getId() : null;
}
public void setOrder(String id) {
this.order = ApiResource.setExpandableFieldId(id, this.order);
}
/**
* Get expanded `order`.
*/
public Order getOrderObject() {
return (this.order != null) ? this.order.getExpanded() : null;
}
public void setOrderObject(Order expandableObject) {
this.order = new ExpandableField(expandableObject.getId(), expandableObject);
}
/**
* Get id of expandable `refund` object.
*/
public String getRefund() {
return (this.refund != null) ? this.refund.getId() : null;
}
public void setRefund(String id) {
this.refund = ApiResource.setExpandableFieldId(id, this.refund);
}
/**
* Get expanded `refund`.
*/
public Refund getRefundObject() {
return (this.refund != null) ? this.refund.getExpanded() : null;
}
public void setRefundObject(Refund expandableObject) {
this.refund = new ExpandableField(expandableObject.getId(), expandableObject);
}
/**
* Returns a list of your order returns. The returns are returned sorted by creation date, with
* the most recently created return appearing first.
*/
public static OrderReturnCollection list(Map params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of your order returns. The returns are returned sorted by creation date, with
* the most recently created return appearing first.
*/
public static OrderReturnCollection list(Map params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/order_returns");
return ApiResource.requestCollection(url, params, OrderReturnCollection.class, options);
}
/**
* Returns a list of your order returns. The returns are returned sorted by creation date, with
* the most recently created return appearing first.
*/
public static OrderReturnCollection list(OrderReturnListParams params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of your order returns. The returns are returned sorted by creation date, with
* the most recently created return appearing first.
*/
public static OrderReturnCollection list(OrderReturnListParams params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/order_returns");
return ApiResource.requestCollection(url, params, OrderReturnCollection.class, options);
}
/**
* Retrieves the details of an existing order return. Supply the unique order ID from either an
* order return creation request or the order return list, and Stripe will return the
* corresponding order information.
*/
public static OrderReturn retrieve(String id) throws StripeException {
return retrieve(id, (Map) null, (RequestOptions) null);
}
/**
* Retrieves the details of an existing order return. Supply the unique order ID from either an
* order return creation request or the order return list, and Stripe will return the
* corresponding order information.
*/
public static OrderReturn retrieve(String id, RequestOptions options) throws StripeException {
return retrieve(id, (Map) null, options);
}
/**
* Retrieves the details of an existing order return. Supply the unique order ID from either an
* order return creation request or the order return list, and Stripe will return the
* corresponding order information.
*/
public static OrderReturn retrieve(String id, Map params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/order_returns/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(ApiResource.RequestMethod.GET, url, params, OrderReturn.class, options);
}
/**
* Retrieves the details of an existing order return. Supply the unique order ID from either an
* order return creation request or the order return list, and Stripe will return the
* corresponding order information.
*/
public static OrderReturn retrieve(String id, OrderReturnRetrieveParams params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/order_returns/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(ApiResource.RequestMethod.GET, url, params, OrderReturn.class, options);
}
/**
* A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1,
* Japanese Yen being a zero-decimal currency) representing the total amount for the returned line
* item.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Long getAmount() {
return this.amount;
}
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Long getCreated() {
return this.created;
}
/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
* lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getCurrency() {
return this.currency;
}
/**
* The items included in this order return.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public List getItems() {
return this.items;
}
/**
* Has the value `true` if the object exists in live mode or the value `false` if the object
* exists in test mode.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Boolean getLivemode() {
return this.livemode;
}
/**
* String representing the object's type. Objects of the same type share the same value.
*
* Equal to `order_return`.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getObject() {
return this.object;
}
/**
* A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1,
* Japanese Yen being a zero-decimal currency) representing the total amount for the returned line
* item.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setAmount(final Long amount) {
this.amount = amount;
}
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setCreated(final Long created) {
this.created = created;
}
/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
* lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setCurrency(final String currency) {
this.currency = currency;
}
/**
* Unique identifier for the object.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setId(final String id) {
this.id = id;
}
/**
* The items included in this order return.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setItems(final List items) {
this.items = items;
}
/**
* Has the value `true` if the object exists in live mode or the value `false` if the object
* exists in test mode.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setLivemode(final Boolean livemode) {
this.livemode = livemode;
}
/**
* String representing the object's type. Objects of the same type share the same value.
*
* Equal to `order_return`.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setObject(final String object) {
this.object = object;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof OrderReturn)) return false;
final OrderReturn other = (OrderReturn) o;
if (!other.canEqual((java.lang.Object) this)) return false;
final java.lang.Object this$amount = this.getAmount();
final java.lang.Object other$amount = other.getAmount();
if (this$amount == null ? other$amount != null : !this$amount.equals(other$amount)) return false;
final java.lang.Object this$created = this.getCreated();
final java.lang.Object other$created = other.getCreated();
if (this$created == null ? other$created != null : !this$created.equals(other$created)) return false;
final java.lang.Object this$currency = this.getCurrency();
final java.lang.Object other$currency = other.getCurrency();
if (this$currency == null ? other$currency != null : !this$currency.equals(other$currency)) return false;
final java.lang.Object this$id = this.getId();
final java.lang.Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false;
final java.lang.Object this$items = this.getItems();
final java.lang.Object other$items = other.getItems();
if (this$items == null ? other$items != null : !this$items.equals(other$items)) return false;
final java.lang.Object this$livemode = this.getLivemode();
final java.lang.Object other$livemode = other.getLivemode();
if (this$livemode == null ? other$livemode != null : !this$livemode.equals(other$livemode)) return false;
final java.lang.Object this$object = this.getObject();
final java.lang.Object other$object = other.getObject();
if (this$object == null ? other$object != null : !this$object.equals(other$object)) return false;
final java.lang.Object this$order = this.getOrder();
final java.lang.Object other$order = other.getOrder();
if (this$order == null ? other$order != null : !this$order.equals(other$order)) return false;
final java.lang.Object this$refund = this.getRefund();
final java.lang.Object other$refund = other.getRefund();
if (this$refund == null ? other$refund != null : !this$refund.equals(other$refund)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof OrderReturn;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
final java.lang.Object $amount = this.getAmount();
result = result * PRIME + ($amount == null ? 43 : $amount.hashCode());
final java.lang.Object $created = this.getCreated();
result = result * PRIME + ($created == null ? 43 : $created.hashCode());
final java.lang.Object $currency = this.getCurrency();
result = result * PRIME + ($currency == null ? 43 : $currency.hashCode());
final java.lang.Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
final java.lang.Object $items = this.getItems();
result = result * PRIME + ($items == null ? 43 : $items.hashCode());
final java.lang.Object $livemode = this.getLivemode();
result = result * PRIME + ($livemode == null ? 43 : $livemode.hashCode());
final java.lang.Object $object = this.getObject();
result = result * PRIME + ($object == null ? 43 : $object.hashCode());
final java.lang.Object $order = this.getOrder();
result = result * PRIME + ($order == null ? 43 : $order.hashCode());
final java.lang.Object $refund = this.getRefund();
result = result * PRIME + ($refund == null ? 43 : $refund.hashCode());
return result;
}
/**
* Unique identifier for the object.
*/
@Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getId() {
return this.id;
}
}