com.zuora.model.UpdateDebitMemoTaxItemRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zuora-sdk-java Show documentation
Show all versions of zuora-sdk-java Show documentation
The SDK of JAVA language for Zuora pricing system
/*
* Zuora API Reference
* REST API reference for the Zuora Billing, Payments, and Central Platform! Check out the [REST API Overview](https://www.zuora.com/developer/api-references/api/overview/).
*
* The version of the OpenAPI document: 2024-05-20
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.zuora.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.zuora.model.TaxRateType;
import com.zuora.model.UpdateDebitMemoTaxItemFinanceInformation;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.zuora.JSON;
/**
* UpdateDebitMemoTaxItemRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class UpdateDebitMemoTaxItemRequest {
public static final String SERIALIZED_NAME_AMOUNT = "amount";
@SerializedName(SERIALIZED_NAME_AMOUNT)
private BigDecimal amount;
public static final String SERIALIZED_NAME_FINANCE_INFORMATION = "financeInformation";
@SerializedName(SERIALIZED_NAME_FINANCE_INFORMATION)
private UpdateDebitMemoTaxItemFinanceInformation financeInformation;
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_JURISDICTION = "jurisdiction";
@SerializedName(SERIALIZED_NAME_JURISDICTION)
private String jurisdiction;
public static final String SERIALIZED_NAME_LOCATION_CODE = "locationCode";
@SerializedName(SERIALIZED_NAME_LOCATION_CODE)
private String locationCode;
public static final String SERIALIZED_NAME_TAX_CODE = "taxCode";
@SerializedName(SERIALIZED_NAME_TAX_CODE)
private String taxCode;
public static final String SERIALIZED_NAME_TAX_CODE_DESCRIPTION = "taxCodeDescription";
@SerializedName(SERIALIZED_NAME_TAX_CODE_DESCRIPTION)
private String taxCodeDescription;
public static final String SERIALIZED_NAME_TAX_DATE = "taxDate";
@SerializedName(SERIALIZED_NAME_TAX_DATE)
private LocalDate taxDate;
public static final String SERIALIZED_NAME_TAX_EXEMPT_AMOUNT = "taxExemptAmount";
@SerializedName(SERIALIZED_NAME_TAX_EXEMPT_AMOUNT)
private BigDecimal taxExemptAmount;
public static final String SERIALIZED_NAME_TAX_NAME = "taxName";
@SerializedName(SERIALIZED_NAME_TAX_NAME)
private String taxName;
public static final String SERIALIZED_NAME_TAX_RATE = "taxRate";
@SerializedName(SERIALIZED_NAME_TAX_RATE)
private BigDecimal taxRate;
public static final String SERIALIZED_NAME_TAX_RATE_DESCRIPTION = "taxRateDescription";
@SerializedName(SERIALIZED_NAME_TAX_RATE_DESCRIPTION)
private String taxRateDescription;
public static final String SERIALIZED_NAME_TAX_RATE_TYPE = "taxRateType";
@SerializedName(SERIALIZED_NAME_TAX_RATE_TYPE)
private TaxRateType taxRateType;
public UpdateDebitMemoTaxItemRequest() {
}
public UpdateDebitMemoTaxItemRequest amount(BigDecimal amount) {
this.amount = amount;
return this;
}
/**
* The amount of the taxation item in the debit memo item.
* @return amount
*/
@javax.annotation.Nullable
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public UpdateDebitMemoTaxItemRequest financeInformation(UpdateDebitMemoTaxItemFinanceInformation financeInformation) {
this.financeInformation = financeInformation;
return this;
}
/**
* Get financeInformation
* @return financeInformation
*/
@javax.annotation.Nullable
public UpdateDebitMemoTaxItemFinanceInformation getFinanceInformation() {
return financeInformation;
}
public void setFinanceInformation(UpdateDebitMemoTaxItemFinanceInformation financeInformation) {
this.financeInformation = financeInformation;
}
public UpdateDebitMemoTaxItemRequest id(String id) {
this.id = id;
return this;
}
/**
* The ID of the taxation item in the debit memo item.
* @return id
*/
@javax.annotation.Nonnull
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public UpdateDebitMemoTaxItemRequest jurisdiction(String jurisdiction) {
this.jurisdiction = jurisdiction;
return this;
}
/**
* The jurisdiction that applies the tax or VAT. This value is typically a state, province, county, or city.
* @return jurisdiction
*/
@javax.annotation.Nullable
public String getJurisdiction() {
return jurisdiction;
}
public void setJurisdiction(String jurisdiction) {
this.jurisdiction = jurisdiction;
}
public UpdateDebitMemoTaxItemRequest locationCode(String locationCode) {
this.locationCode = locationCode;
return this;
}
/**
* The identifier for the location based on the value of the `taxCode` field.
* @return locationCode
*/
@javax.annotation.Nullable
public String getLocationCode() {
return locationCode;
}
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public UpdateDebitMemoTaxItemRequest taxCode(String taxCode) {
this.taxCode = taxCode;
return this;
}
/**
* The tax code identifies which tax rules and tax rates to apply to a specific debit memo.
* @return taxCode
*/
@javax.annotation.Nullable
public String getTaxCode() {
return taxCode;
}
public void setTaxCode(String taxCode) {
this.taxCode = taxCode;
}
public UpdateDebitMemoTaxItemRequest taxCodeDescription(String taxCodeDescription) {
this.taxCodeDescription = taxCodeDescription;
return this;
}
/**
* The description of the tax code.
* @return taxCodeDescription
*/
@javax.annotation.Nullable
public String getTaxCodeDescription() {
return taxCodeDescription;
}
public void setTaxCodeDescription(String taxCodeDescription) {
this.taxCodeDescription = taxCodeDescription;
}
public UpdateDebitMemoTaxItemRequest taxDate(LocalDate taxDate) {
this.taxDate = taxDate;
return this;
}
/**
* The date that the tax is applied to the debit memo, in `yyyy-mm-dd` format.
* @return taxDate
*/
@javax.annotation.Nullable
public LocalDate getTaxDate() {
return taxDate;
}
public void setTaxDate(LocalDate taxDate) {
this.taxDate = taxDate;
}
public UpdateDebitMemoTaxItemRequest taxExemptAmount(BigDecimal taxExemptAmount) {
this.taxExemptAmount = taxExemptAmount;
return this;
}
/**
* The calculated tax amount excluded due to the exemption.
* @return taxExemptAmount
*/
@javax.annotation.Nullable
public BigDecimal getTaxExemptAmount() {
return taxExemptAmount;
}
public void setTaxExemptAmount(BigDecimal taxExemptAmount) {
this.taxExemptAmount = taxExemptAmount;
}
public UpdateDebitMemoTaxItemRequest taxName(String taxName) {
this.taxName = taxName;
return this;
}
/**
* The name of taxation.
* @return taxName
*/
@javax.annotation.Nullable
public String getTaxName() {
return taxName;
}
public void setTaxName(String taxName) {
this.taxName = taxName;
}
public UpdateDebitMemoTaxItemRequest taxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
return this;
}
/**
* The tax rate applied to the debit memo.
* @return taxRate
*/
@javax.annotation.Nullable
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
public UpdateDebitMemoTaxItemRequest taxRateDescription(String taxRateDescription) {
this.taxRateDescription = taxRateDescription;
return this;
}
/**
* The description of the tax rate.
* @return taxRateDescription
*/
@javax.annotation.Nullable
public String getTaxRateDescription() {
return taxRateDescription;
}
public void setTaxRateDescription(String taxRateDescription) {
this.taxRateDescription = taxRateDescription;
}
public UpdateDebitMemoTaxItemRequest taxRateType(TaxRateType taxRateType) {
this.taxRateType = taxRateType;
return this;
}
/**
* Get taxRateType
* @return taxRateType
*/
@javax.annotation.Nullable
public TaxRateType getTaxRateType() {
return taxRateType;
}
public void setTaxRateType(TaxRateType taxRateType) {
this.taxRateType = taxRateType;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the UpdateDebitMemoTaxItemRequest instance itself
*/
public UpdateDebitMemoTaxItemRequest putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateDebitMemoTaxItemRequest updateDebitMemoTaxItemRequest = (UpdateDebitMemoTaxItemRequest) o;
return Objects.equals(this.amount, updateDebitMemoTaxItemRequest.amount) &&
Objects.equals(this.financeInformation, updateDebitMemoTaxItemRequest.financeInformation) &&
Objects.equals(this.id, updateDebitMemoTaxItemRequest.id) &&
Objects.equals(this.jurisdiction, updateDebitMemoTaxItemRequest.jurisdiction) &&
Objects.equals(this.locationCode, updateDebitMemoTaxItemRequest.locationCode) &&
Objects.equals(this.taxCode, updateDebitMemoTaxItemRequest.taxCode) &&
Objects.equals(this.taxCodeDescription, updateDebitMemoTaxItemRequest.taxCodeDescription) &&
Objects.equals(this.taxDate, updateDebitMemoTaxItemRequest.taxDate) &&
Objects.equals(this.taxExemptAmount, updateDebitMemoTaxItemRequest.taxExemptAmount) &&
Objects.equals(this.taxName, updateDebitMemoTaxItemRequest.taxName) &&
Objects.equals(this.taxRate, updateDebitMemoTaxItemRequest.taxRate) &&
Objects.equals(this.taxRateDescription, updateDebitMemoTaxItemRequest.taxRateDescription) &&
Objects.equals(this.taxRateType, updateDebitMemoTaxItemRequest.taxRateType)&&
Objects.equals(this.additionalProperties, updateDebitMemoTaxItemRequest.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(amount, financeInformation, id, jurisdiction, locationCode, taxCode, taxCodeDescription, taxDate, taxExemptAmount, taxName, taxRate, taxRateDescription, taxRateType, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdateDebitMemoTaxItemRequest {\n");
sb.append(" amount: ").append(toIndentedString(amount)).append("\n");
sb.append(" financeInformation: ").append(toIndentedString(financeInformation)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" jurisdiction: ").append(toIndentedString(jurisdiction)).append("\n");
sb.append(" locationCode: ").append(toIndentedString(locationCode)).append("\n");
sb.append(" taxCode: ").append(toIndentedString(taxCode)).append("\n");
sb.append(" taxCodeDescription: ").append(toIndentedString(taxCodeDescription)).append("\n");
sb.append(" taxDate: ").append(toIndentedString(taxDate)).append("\n");
sb.append(" taxExemptAmount: ").append(toIndentedString(taxExemptAmount)).append("\n");
sb.append(" taxName: ").append(toIndentedString(taxName)).append("\n");
sb.append(" taxRate: ").append(toIndentedString(taxRate)).append("\n");
sb.append(" taxRateDescription: ").append(toIndentedString(taxRateDescription)).append("\n");
sb.append(" taxRateType: ").append(toIndentedString(taxRateType)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("amount");
openapiFields.add("financeInformation");
openapiFields.add("id");
openapiFields.add("jurisdiction");
openapiFields.add("locationCode");
openapiFields.add("taxCode");
openapiFields.add("taxCodeDescription");
openapiFields.add("taxDate");
openapiFields.add("taxExemptAmount");
openapiFields.add("taxName");
openapiFields.add("taxRate");
openapiFields.add("taxRateDescription");
openapiFields.add("taxRateType");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("id");
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to UpdateDebitMemoTaxItemRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UpdateDebitMemoTaxItemRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDebitMemoTaxItemRequest is not found in the empty JSON string", UpdateDebitMemoTaxItemRequest.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : UpdateDebitMemoTaxItemRequest.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `financeInformation`
if (jsonObj.get("financeInformation") != null && !jsonObj.get("financeInformation").isJsonNull()) {
UpdateDebitMemoTaxItemFinanceInformation.validateJsonElement(jsonObj.get("financeInformation"));
}
if (!jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("jurisdiction") != null && !jsonObj.get("jurisdiction").isJsonNull()) && !jsonObj.get("jurisdiction").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `jurisdiction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jurisdiction").toString()));
}
if ((jsonObj.get("locationCode") != null && !jsonObj.get("locationCode").isJsonNull()) && !jsonObj.get("locationCode").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `locationCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("locationCode").toString()));
}
if ((jsonObj.get("taxCode") != null && !jsonObj.get("taxCode").isJsonNull()) && !jsonObj.get("taxCode").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `taxCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxCode").toString()));
}
if ((jsonObj.get("taxCodeDescription") != null && !jsonObj.get("taxCodeDescription").isJsonNull()) && !jsonObj.get("taxCodeDescription").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `taxCodeDescription` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxCodeDescription").toString()));
}
if ((jsonObj.get("taxName") != null && !jsonObj.get("taxName").isJsonNull()) && !jsonObj.get("taxName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `taxName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxName").toString()));
}
if ((jsonObj.get("taxRateDescription") != null && !jsonObj.get("taxRateDescription").isJsonNull()) && !jsonObj.get("taxRateDescription").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `taxRateDescription` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxRateDescription").toString()));
}
if ((jsonObj.get("taxRateType") != null && !jsonObj.get("taxRateType").isJsonNull()) && !jsonObj.get("taxRateType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `taxRateType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxRateType").toString()));
}
// validate the optional field `taxRateType`
if (jsonObj.get("taxRateType") != null && !jsonObj.get("taxRateType").isJsonNull()) {
TaxRateType.validateJsonElement(jsonObj.get("taxRateType"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!UpdateDebitMemoTaxItemRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UpdateDebitMemoTaxItemRequest' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UpdateDebitMemoTaxItemRequest.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, UpdateDebitMemoTaxItemRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// support null values
out.beginObject();
Iterator iterator = obj.entrySet().iterator();
while(iterator.hasNext()) {
Map.Entry e = (Map.Entry) iterator.next();
out.name((String)e.getKey());
elementAdapter.write(out, e.getValue());
}
// end
// serialize additional properties
if (value.getAdditionalProperties() != null) {
// support null values
boolean oldSerializeNulls = out.getSerializeNulls();
out.setSerializeNulls(true); //force serialize
// end
for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else if (entry.getValue() == null)
obj.add(entry.getKey(), null);
else {
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
if (jsonElement.isJsonArray()) {
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
} else {
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
}
}
out.name((String)entry.getKey());
elementAdapter.write(out, obj.get(entry.getKey()));
}
out.setSerializeNulls(oldSerializeNulls); //restore
}
out.endObject();
}
@Override
public UpdateDebitMemoTaxItemRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
UpdateDebitMemoTaxItemRequest instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();
}
}
/**
* Create an instance of UpdateDebitMemoTaxItemRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of UpdateDebitMemoTaxItemRequest
* @throws IOException if the JSON string is invalid with respect to UpdateDebitMemoTaxItemRequest
*/
public static UpdateDebitMemoTaxItemRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UpdateDebitMemoTaxItemRequest.class);
}
/**
* Convert an instance of UpdateDebitMemoTaxItemRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy