com.zuora.model.ProxyCreateTaxationItemRequest 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 java.io.IOException;
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;
/**
* ProxyCreateTaxationItemRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class ProxyCreateTaxationItemRequest {
public static final String SERIALIZED_NAME_ACCOUNTING_CODE = "AccountingCode";
@SerializedName(SERIALIZED_NAME_ACCOUNTING_CODE)
private String accountingCode;
public static final String SERIALIZED_NAME_EXEMPT_AMOUNT = "ExemptAmount";
@SerializedName(SERIALIZED_NAME_EXEMPT_AMOUNT)
private Double exemptAmount;
public static final String SERIALIZED_NAME_INVOICE_ITEM_ID = "InvoiceItemId";
@SerializedName(SERIALIZED_NAME_INVOICE_ITEM_ID)
private String invoiceItemId;
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_NAME = "Name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_TAX_AMOUNT = "TaxAmount";
@SerializedName(SERIALIZED_NAME_TAX_AMOUNT)
private Double taxAmount;
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_RATE = "TaxRate";
@SerializedName(SERIALIZED_NAME_TAX_RATE)
private Double 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 String taxRateType;
public ProxyCreateTaxationItemRequest() {
}
public ProxyCreateTaxationItemRequest accountingCode(String accountingCode) {
this.accountingCode = accountingCode;
return this;
}
/**
* The Chart of Accounts
* @return accountingCode
*/
@javax.annotation.Nullable
public String getAccountingCode() {
return accountingCode;
}
public void setAccountingCode(String accountingCode) {
this.accountingCode = accountingCode;
}
public ProxyCreateTaxationItemRequest exemptAmount(Double exemptAmount) {
this.exemptAmount = exemptAmount;
return this;
}
/**
* The calculated tax amount excluded due to the exemption. **Character limit**: 16 **Values**: a decimal value
* @return exemptAmount
*/
@javax.annotation.Nullable
public Double getExemptAmount() {
return exemptAmount;
}
public void setExemptAmount(Double exemptAmount) {
this.exemptAmount = exemptAmount;
}
public ProxyCreateTaxationItemRequest invoiceItemId(String invoiceItemId) {
this.invoiceItemId = invoiceItemId;
return this;
}
/**
* The ID of the specific invoice item that the taxation information applies to. **Character limit**: 32 **Values**: a valid invoice item ID
* @return invoiceItemId
*/
@javax.annotation.Nonnull
public String getInvoiceItemId() {
return invoiceItemId;
}
public void setInvoiceItemId(String invoiceItemId) {
this.invoiceItemId = invoiceItemId;
}
public ProxyCreateTaxationItemRequest 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. **Character limit**: 32 **Values**: a string of 32 characterrs or fewer
* @return jurisdiction
*/
@javax.annotation.Nonnull
public String getJurisdiction() {
return jurisdiction;
}
public void setJurisdiction(String jurisdiction) {
this.jurisdiction = jurisdiction;
}
public ProxyCreateTaxationItemRequest locationCode(String locationCode) {
this.locationCode = locationCode;
return this;
}
/**
* The identifier for the location based on the value of the `TaxCode` field. **Character limit**: 32 **Values**: automatically generated
* @return locationCode
*/
@javax.annotation.Nullable
public String getLocationCode() {
return locationCode;
}
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public ProxyCreateTaxationItemRequest name(String name) {
this.name = name;
return this;
}
/**
* The name of the tax rate, such as sales tax or GST. This name is displayed on invoices. **Character limit**: 128 **Values**: a string of 128 characters or fewer
* @return name
*/
@javax.annotation.Nonnull
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ProxyCreateTaxationItemRequest taxAmount(Double taxAmount) {
this.taxAmount = taxAmount;
return this;
}
/**
* The amount of the tax applied to the charge. **Character limit**: 16 **Values**: a decimal value
* @return taxAmount
*/
@javax.annotation.Nonnull
public Double getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(Double taxAmount) {
this.taxAmount = taxAmount;
}
public ProxyCreateTaxationItemRequest taxCode(String taxCode) {
this.taxCode = taxCode;
return this;
}
/**
* The tax code identifies which tax rules and tax rates to apply to a specific charge. **Character limit**: 32 **Values**: a string of 32 characters or fewer
* @return taxCode
*/
@javax.annotation.Nullable
public String getTaxCode() {
return taxCode;
}
public void setTaxCode(String taxCode) {
this.taxCode = taxCode;
}
public ProxyCreateTaxationItemRequest taxCodeDescription(String taxCodeDescription) {
this.taxCodeDescription = taxCodeDescription;
return this;
}
/**
* The description for the tax code. **Character limit**: 255 **Values**: a string of 255 characters or fewer
* @return taxCodeDescription
*/
@javax.annotation.Nullable
public String getTaxCodeDescription() {
return taxCodeDescription;
}
public void setTaxCodeDescription(String taxCodeDescription) {
this.taxCodeDescription = taxCodeDescription;
}
public ProxyCreateTaxationItemRequest taxDate(LocalDate taxDate) {
this.taxDate = taxDate;
return this;
}
/**
* The date that the tax is applied to the charge, in `yyyy-mm-dd` format. **Character limit**: 29
* @return taxDate
*/
@javax.annotation.Nonnull
public LocalDate getTaxDate() {
return taxDate;
}
public void setTaxDate(LocalDate taxDate) {
this.taxDate = taxDate;
}
public ProxyCreateTaxationItemRequest taxRate(Double taxRate) {
this.taxRate = taxRate;
return this;
}
/**
* The tax rate applied to the charge. **Character limit**: 16 **Values**: a valid decimal value
* @return taxRate
*/
@javax.annotation.Nonnull
public Double getTaxRate() {
return taxRate;
}
public void setTaxRate(Double taxRate) {
this.taxRate = taxRate;
}
public ProxyCreateTaxationItemRequest taxRateDescription(String taxRateDescription) {
this.taxRateDescription = taxRateDescription;
return this;
}
/**
* The description of the tax rate. **Character limit**: 255 **Values**: a string of 255 characters or fewer
* @return taxRateDescription
*/
@javax.annotation.Nullable
public String getTaxRateDescription() {
return taxRateDescription;
}
public void setTaxRateDescription(String taxRateDescription) {
this.taxRateDescription = taxRateDescription;
}
public ProxyCreateTaxationItemRequest taxRateType(String taxRateType) {
this.taxRateType = taxRateType;
return this;
}
/**
* The type of the tax rate applied to the charge. **Character limit**: 10 **Values**: `Percentage`, `FlatFee`
* @return taxRateType
*/
@javax.annotation.Nonnull
public String getTaxRateType() {
return taxRateType;
}
public void setTaxRateType(String 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 ProxyCreateTaxationItemRequest instance itself
*/
public ProxyCreateTaxationItemRequest 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;
}
ProxyCreateTaxationItemRequest proxyCreateTaxationItemRequest = (ProxyCreateTaxationItemRequest) o;
return Objects.equals(this.accountingCode, proxyCreateTaxationItemRequest.accountingCode) &&
Objects.equals(this.exemptAmount, proxyCreateTaxationItemRequest.exemptAmount) &&
Objects.equals(this.invoiceItemId, proxyCreateTaxationItemRequest.invoiceItemId) &&
Objects.equals(this.jurisdiction, proxyCreateTaxationItemRequest.jurisdiction) &&
Objects.equals(this.locationCode, proxyCreateTaxationItemRequest.locationCode) &&
Objects.equals(this.name, proxyCreateTaxationItemRequest.name) &&
Objects.equals(this.taxAmount, proxyCreateTaxationItemRequest.taxAmount) &&
Objects.equals(this.taxCode, proxyCreateTaxationItemRequest.taxCode) &&
Objects.equals(this.taxCodeDescription, proxyCreateTaxationItemRequest.taxCodeDescription) &&
Objects.equals(this.taxDate, proxyCreateTaxationItemRequest.taxDate) &&
Objects.equals(this.taxRate, proxyCreateTaxationItemRequest.taxRate) &&
Objects.equals(this.taxRateDescription, proxyCreateTaxationItemRequest.taxRateDescription) &&
Objects.equals(this.taxRateType, proxyCreateTaxationItemRequest.taxRateType)&&
Objects.equals(this.additionalProperties, proxyCreateTaxationItemRequest.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(accountingCode, exemptAmount, invoiceItemId, jurisdiction, locationCode, name, taxAmount, taxCode, taxCodeDescription, taxDate, taxRate, taxRateDescription, taxRateType, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ProxyCreateTaxationItemRequest {\n");
sb.append(" accountingCode: ").append(toIndentedString(accountingCode)).append("\n");
sb.append(" exemptAmount: ").append(toIndentedString(exemptAmount)).append("\n");
sb.append(" invoiceItemId: ").append(toIndentedString(invoiceItemId)).append("\n");
sb.append(" jurisdiction: ").append(toIndentedString(jurisdiction)).append("\n");
sb.append(" locationCode: ").append(toIndentedString(locationCode)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" taxAmount: ").append(toIndentedString(taxAmount)).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(" 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("AccountingCode");
openapiFields.add("ExemptAmount");
openapiFields.add("InvoiceItemId");
openapiFields.add("Jurisdiction");
openapiFields.add("LocationCode");
openapiFields.add("Name");
openapiFields.add("TaxAmount");
openapiFields.add("TaxCode");
openapiFields.add("TaxCodeDescription");
openapiFields.add("TaxDate");
openapiFields.add("TaxRate");
openapiFields.add("TaxRateDescription");
openapiFields.add("TaxRateType");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("InvoiceItemId");
openapiRequiredFields.add("Jurisdiction");
openapiRequiredFields.add("Name");
openapiRequiredFields.add("TaxAmount");
openapiRequiredFields.add("TaxDate");
openapiRequiredFields.add("TaxRate");
openapiRequiredFields.add("TaxRateType");
}
/**
* 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 ProxyCreateTaxationItemRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProxyCreateTaxationItemRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProxyCreateTaxationItemRequest is not found in the empty JSON string", ProxyCreateTaxationItemRequest.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : ProxyCreateTaxationItemRequest.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();
if ((jsonObj.get("AccountingCode") != null && !jsonObj.get("AccountingCode").isJsonNull()) && !jsonObj.get("AccountingCode").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `AccountingCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("AccountingCode").toString()));
}
if (!jsonObj.get("InvoiceItemId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `InvoiceItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("InvoiceItemId").toString()));
}
if (!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("Name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `Name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Name").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("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").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()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!ProxyCreateTaxationItemRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProxyCreateTaxationItemRequest' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProxyCreateTaxationItemRequest.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, ProxyCreateTaxationItemRequest 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 ProxyCreateTaxationItemRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
ProxyCreateTaxationItemRequest 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 ProxyCreateTaxationItemRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProxyCreateTaxationItemRequest
* @throws IOException if the JSON string is invalid with respect to ProxyCreateTaxationItemRequest
*/
public static ProxyCreateTaxationItemRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProxyCreateTaxationItemRequest.class);
}
/**
* Convert an instance of ProxyCreateTaxationItemRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy