com.squareup.connect.models.Order Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connect Show documentation
Show all versions of connect Show documentation
Java client library for the Square Connect API
/*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Money;
import com.squareup.connect.models.OrderLineItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Contains all information related to a single order to process with Square, including line items that specify the products to purchase
*/
@ApiModel(description = "Contains all information related to a single order to process with Square, including line items that specify the products to purchase")
public class Order {
@JsonProperty("id")
private String id = null;
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("reference_id")
private String referenceId = null;
@JsonProperty("line_items")
private List lineItems = new ArrayList();
@JsonProperty("total_money")
private Money totalMoney = null;
@JsonProperty("total_tax_money")
private Money totalTaxMoney = null;
@JsonProperty("total_discount_money")
private Money totalDiscountMoney = null;
public Order id(String id) {
this.id = id;
return this;
}
/**
* The order's unique ID. This value is only present for Order objects created by the Orders API through the [CreateOrder](#endpoint-createorder) endpoint.
* @return id
**/
@ApiModelProperty(value = "The order's unique ID. This value is only present for Order objects created by the Orders API through the [CreateOrder](#endpoint-createorder) endpoint.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Order locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The ID of the merchant location this order is associated with.
* @return locationId
**/
@ApiModelProperty(required = true, value = "The ID of the merchant location this order is associated with.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Order referenceId(String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* A client specified identifier to associate an entity in another system with this order.
* @return referenceId
**/
@ApiModelProperty(value = "A client specified identifier to associate an entity in another system with this order.")
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public Order lineItems(List lineItems) {
this.lineItems = lineItems;
return this;
}
public Order addLineItemsItem(OrderLineItem lineItemsItem) {
this.lineItems.add(lineItemsItem);
return this;
}
/**
* The line items included in the order. Every order has at least one line item.
* @return lineItems
**/
@ApiModelProperty(required = true, value = "The line items included in the order. Every order has at least one line item.")
public List getLineItems() {
return lineItems;
}
public void setLineItems(List lineItems) {
this.lineItems = lineItems;
}
public Order totalMoney(Money totalMoney) {
this.totalMoney = totalMoney;
return this;
}
/**
* The total amount of money to collect for the order.
* @return totalMoney
**/
@ApiModelProperty(value = "The total amount of money to collect for the order.")
public Money getTotalMoney() {
return totalMoney;
}
public void setTotalMoney(Money totalMoney) {
this.totalMoney = totalMoney;
}
public Order totalTaxMoney(Money totalTaxMoney) {
this.totalTaxMoney = totalTaxMoney;
return this;
}
/**
* The total tax amount of money to collect for the order.
* @return totalTaxMoney
**/
@ApiModelProperty(value = "The total tax amount of money to collect for the order.")
public Money getTotalTaxMoney() {
return totalTaxMoney;
}
public void setTotalTaxMoney(Money totalTaxMoney) {
this.totalTaxMoney = totalTaxMoney;
}
public Order totalDiscountMoney(Money totalDiscountMoney) {
this.totalDiscountMoney = totalDiscountMoney;
return this;
}
/**
* The total discount amount of money to collect for the order.
* @return totalDiscountMoney
**/
@ApiModelProperty(value = "The total discount amount of money to collect for the order.")
public Money getTotalDiscountMoney() {
return totalDiscountMoney;
}
public void setTotalDiscountMoney(Money totalDiscountMoney) {
this.totalDiscountMoney = totalDiscountMoney;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.locationId, order.locationId) &&
Objects.equals(this.referenceId, order.referenceId) &&
Objects.equals(this.lineItems, order.lineItems) &&
Objects.equals(this.totalMoney, order.totalMoney) &&
Objects.equals(this.totalTaxMoney, order.totalTaxMoney) &&
Objects.equals(this.totalDiscountMoney, order.totalDiscountMoney);
}
@Override
public int hashCode() {
return Objects.hash(id, locationId, referenceId, lineItems, totalMoney, totalTaxMoney, totalDiscountMoney);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n");
sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n");
sb.append(" totalMoney: ").append(toIndentedString(totalMoney)).append("\n");
sb.append(" totalTaxMoney: ").append(toIndentedString(totalTaxMoney)).append("\n");
sb.append(" totalDiscountMoney: ").append(toIndentedString(totalDiscountMoney)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}