com.zuora.model.RefundCreditMemoRequest 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.CreateNonRefRefundFinanceInformation;
import com.zuora.model.CustomRates;
import com.zuora.model.GatewayOptions;
import com.zuora.model.PaymentMethodType;
import com.zuora.model.RefundCreditMemoItemRequest;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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;
/**
* RefundCreditMemoRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class RefundCreditMemoRequest {
public static final String SERIALIZED_NAME_INTEGRATION_ID_N_S = "IntegrationId__NS";
@SerializedName(SERIALIZED_NAME_INTEGRATION_ID_N_S)
private String integrationIdNS;
public static final String SERIALIZED_NAME_INTEGRATION_STATUS_N_S = "IntegrationStatus__NS";
@SerializedName(SERIALIZED_NAME_INTEGRATION_STATUS_N_S)
private String integrationStatusNS;
public static final String SERIALIZED_NAME_ORIGIN_N_S = "Origin__NS";
@SerializedName(SERIALIZED_NAME_ORIGIN_N_S)
private String originNS;
public static final String SERIALIZED_NAME_SYNC_DATE_N_S = "SyncDate__NS";
@SerializedName(SERIALIZED_NAME_SYNC_DATE_N_S)
private String syncDateNS;
public static final String SERIALIZED_NAME_SYNCTO_NET_SUITE_N_S = "SynctoNetSuite__NS";
@SerializedName(SERIALIZED_NAME_SYNCTO_NET_SUITE_N_S)
private String synctoNetSuiteNS;
public static final String SERIALIZED_NAME_COMMENT = "comment";
@SerializedName(SERIALIZED_NAME_COMMENT)
private String comment;
public static final String SERIALIZED_NAME_CUSTOM_RATES = "customRates";
@SerializedName(SERIALIZED_NAME_CUSTOM_RATES)
private List customRates;
public static final String SERIALIZED_NAME_FINANCE_INFORMATION = "financeInformation";
@SerializedName(SERIALIZED_NAME_FINANCE_INFORMATION)
private CreateNonRefRefundFinanceInformation financeInformation;
public static final String SERIALIZED_NAME_GATEWAY_ID = "gatewayId";
@SerializedName(SERIALIZED_NAME_GATEWAY_ID)
private String gatewayId;
public static final String SERIALIZED_NAME_GATEWAY_OPTIONS = "gatewayOptions";
@SerializedName(SERIALIZED_NAME_GATEWAY_OPTIONS)
private GatewayOptions gatewayOptions;
public static final String SERIALIZED_NAME_ITEMS = "items";
@SerializedName(SERIALIZED_NAME_ITEMS)
private List items;
public static final String SERIALIZED_NAME_METHOD_TYPE = "methodType";
@SerializedName(SERIALIZED_NAME_METHOD_TYPE)
private PaymentMethodType methodType;
public static final String SERIALIZED_NAME_PAYMENT_METHOD_ID = "paymentMethodId";
@SerializedName(SERIALIZED_NAME_PAYMENT_METHOD_ID)
private String paymentMethodId;
public static final String SERIALIZED_NAME_REASON_CODE = "reasonCode";
@SerializedName(SERIALIZED_NAME_REASON_CODE)
private String reasonCode;
public static final String SERIALIZED_NAME_REFERENCE_ID = "referenceId";
@SerializedName(SERIALIZED_NAME_REFERENCE_ID)
private String referenceId;
public static final String SERIALIZED_NAME_REFUND_DATE = "refundDate";
@SerializedName(SERIALIZED_NAME_REFUND_DATE)
private LocalDate refundDate;
public static final String SERIALIZED_NAME_SECOND_REFUND_REFERENCE_ID = "secondRefundReferenceId";
@SerializedName(SERIALIZED_NAME_SECOND_REFUND_REFERENCE_ID)
private String secondRefundReferenceId;
public static final String SERIALIZED_NAME_SOFT_DESCRIPTOR = "softDescriptor";
@SerializedName(SERIALIZED_NAME_SOFT_DESCRIPTOR)
private String softDescriptor;
public static final String SERIALIZED_NAME_SOFT_DESCRIPTOR_PHONE = "softDescriptorPhone";
@SerializedName(SERIALIZED_NAME_SOFT_DESCRIPTOR_PHONE)
private String softDescriptorPhone;
public static final String SERIALIZED_NAME_TOTAL_AMOUNT = "totalAmount";
@SerializedName(SERIALIZED_NAME_TOTAL_AMOUNT)
private BigDecimal totalAmount;
/**
* The type of the refund.
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
EXTERNAL("External"),
ELECTRONIC("Electronic");
private String value;
TypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TypeEnum fromValue(String value) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TypeEnum.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
TypeEnum.fromValue(value);
}
}
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private TypeEnum type;
public RefundCreditMemoRequest() {
}
public RefundCreditMemoRequest integrationIdNS(String integrationIdNS) {
this.integrationIdNS = integrationIdNS;
return this;
}
/**
* ID of the corresponding object in NetSuite. Only available if you have installed the [Zuora Connector for NetSuite](https://www.zuora.com/connect/app/?appId=265).
* @return integrationIdNS
*/
@javax.annotation.Nullable
public String getIntegrationIdNS() {
return integrationIdNS;
}
public void setIntegrationIdNS(String integrationIdNS) {
this.integrationIdNS = integrationIdNS;
}
public RefundCreditMemoRequest integrationStatusNS(String integrationStatusNS) {
this.integrationStatusNS = integrationStatusNS;
return this;
}
/**
* Status of the refund's synchronization with NetSuite. Only available if you have installed the [Zuora Connector for NetSuite](https://www.zuora.com/connect/app/?appId=265).
* @return integrationStatusNS
*/
@javax.annotation.Nullable
public String getIntegrationStatusNS() {
return integrationStatusNS;
}
public void setIntegrationStatusNS(String integrationStatusNS) {
this.integrationStatusNS = integrationStatusNS;
}
public RefundCreditMemoRequest originNS(String originNS) {
this.originNS = originNS;
return this;
}
/**
* Origin of the corresponding object in NetSuite. Only available if you have installed the [Zuora Connector for NetSuite](https://www.zuora.com/connect/app/?appId=265).
* @return originNS
*/
@javax.annotation.Nullable
public String getOriginNS() {
return originNS;
}
public void setOriginNS(String originNS) {
this.originNS = originNS;
}
public RefundCreditMemoRequest syncDateNS(String syncDateNS) {
this.syncDateNS = syncDateNS;
return this;
}
/**
* Date when the refund was synchronized with NetSuite. Only available if you have installed the [Zuora Connector for NetSuite](https://www.zuora.com/connect/app/?appId=265).
* @return syncDateNS
*/
@javax.annotation.Nullable
public String getSyncDateNS() {
return syncDateNS;
}
public void setSyncDateNS(String syncDateNS) {
this.syncDateNS = syncDateNS;
}
public RefundCreditMemoRequest synctoNetSuiteNS(String synctoNetSuiteNS) {
this.synctoNetSuiteNS = synctoNetSuiteNS;
return this;
}
/**
* Specifies whether the refund should be synchronized with NetSuite. Only available if you have installed the [Zuora Connector for NetSuite](https://www.zuora.com/connect/app/?appId=265).
* @return synctoNetSuiteNS
*/
@javax.annotation.Nullable
public String getSynctoNetSuiteNS() {
return synctoNetSuiteNS;
}
public void setSynctoNetSuiteNS(String synctoNetSuiteNS) {
this.synctoNetSuiteNS = synctoNetSuiteNS;
}
public RefundCreditMemoRequest comment(String comment) {
this.comment = comment;
return this;
}
/**
* Comments about the refund.
* @return comment
*/
@javax.annotation.Nullable
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public RefundCreditMemoRequest customRates(List customRates) {
this.customRates = customRates;
return this;
}
public RefundCreditMemoRequest addCustomRatesItem(CustomRates customRatesItem) {
if (this.customRates == null) {
this.customRates = new ArrayList<>();
}
this.customRates.add(customRatesItem);
return this;
}
/**
* It contains Home currency and Reporting currency custom rates currencies. The maximum number of items is 2 (you can pass the Home currency item, Reporting currency item, or both). **Note**: The API custom rate feature is permission controlled.
* @return customRates
*/
@javax.annotation.Nullable
public List getCustomRates() {
return customRates;
}
public void setCustomRates(List customRates) {
this.customRates = customRates;
}
public RefundCreditMemoRequest financeInformation(CreateNonRefRefundFinanceInformation financeInformation) {
this.financeInformation = financeInformation;
return this;
}
/**
* Get financeInformation
* @return financeInformation
*/
@javax.annotation.Nullable
public CreateNonRefRefundFinanceInformation getFinanceInformation() {
return financeInformation;
}
public void setFinanceInformation(CreateNonRefRefundFinanceInformation financeInformation) {
this.financeInformation = financeInformation;
}
public RefundCreditMemoRequest gatewayId(String gatewayId) {
this.gatewayId = gatewayId;
return this;
}
/**
* The ID of the gateway instance that processes the refund. This field can be specified only for electronic refunds. The ID must be a valid gateway instance ID, and this gateway must support the specific payment method. If no gateway ID is specified, the default gateway in the billing account configuration will be used. If no gateway is specified in the billing account, the default gateway of the corresponding tenant will be used.
* @return gatewayId
*/
@javax.annotation.Nullable
public String getGatewayId() {
return gatewayId;
}
public void setGatewayId(String gatewayId) {
this.gatewayId = gatewayId;
}
public RefundCreditMemoRequest gatewayOptions(GatewayOptions gatewayOptions) {
this.gatewayOptions = gatewayOptions;
return this;
}
/**
* Get gatewayOptions
* @return gatewayOptions
*/
@javax.annotation.Nullable
public GatewayOptions getGatewayOptions() {
return gatewayOptions;
}
public void setGatewayOptions(GatewayOptions gatewayOptions) {
this.gatewayOptions = gatewayOptions;
}
public RefundCreditMemoRequest items(List items) {
this.items = items;
return this;
}
public RefundCreditMemoRequest addItemsItem(RefundCreditMemoItemRequest itemsItem) {
if (this.items == null) {
this.items = new ArrayList<>();
}
this.items.add(itemsItem);
return this;
}
/**
* Container for credit memo items. The maximum number of items is 1,000. **Note:** This field is only available if you have the [Invoice Item Settlement](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/Invoice_Settlement/C_Invoice_Item_Settlement) feature enabled. Invoice Item Settlement must be used together with other Invoice Settlement features (Unapplied Payments, and Credit and Debit memos). If you wish to enable Invoice Settlement, see [Invoice Settlement Enablement and Checklist Guide](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/Invoice_Settlement/Invoice_Settlement_Migration_Checklist_and_Guide) for more information.
* @return items
*/
@javax.annotation.Nullable
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public RefundCreditMemoRequest methodType(PaymentMethodType methodType) {
this.methodType = methodType;
return this;
}
/**
* Get methodType
* @return methodType
*/
@javax.annotation.Nullable
public PaymentMethodType getMethodType() {
return methodType;
}
public void setMethodType(PaymentMethodType methodType) {
this.methodType = methodType;
}
public RefundCreditMemoRequest paymentMethodId(String paymentMethodId) {
this.paymentMethodId = paymentMethodId;
return this;
}
/**
* The ID of the payment method used for the refund. This field is required for an electronic refund, and the value must be an electronic payment method ID. This field must be left empty for an external refund.
* @return paymentMethodId
*/
@javax.annotation.Nullable
public String getPaymentMethodId() {
return paymentMethodId;
}
public void setPaymentMethodId(String paymentMethodId) {
this.paymentMethodId = paymentMethodId;
}
public RefundCreditMemoRequest reasonCode(String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
/**
* A code identifying the reason for the transaction. The value must be an existing reason code or empty. If you do not specify a value, Zuora uses the default reason code.
* @return reasonCode
*/
@javax.annotation.Nullable
public String getReasonCode() {
return reasonCode;
}
public void setReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
}
public RefundCreditMemoRequest referenceId(String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* The transaction ID returned by the payment gateway for an electronic refund. Use this field to reconcile refunds between your gateway and Zuora Payments.
* @return referenceId
*/
@javax.annotation.Nullable
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public RefundCreditMemoRequest refundDate(LocalDate refundDate) {
this.refundDate = refundDate;
return this;
}
/**
* The date when the refund takes effect, in `yyyy-mm-dd` format. The date of the refund cannot be before the credit memo date. Specify this field only for external refunds. Zuora automatically generates this field for electronic refunds.
* @return refundDate
*/
@javax.annotation.Nullable
public LocalDate getRefundDate() {
return refundDate;
}
public void setRefundDate(LocalDate refundDate) {
this.refundDate = refundDate;
}
public RefundCreditMemoRequest secondRefundReferenceId(String secondRefundReferenceId) {
this.secondRefundReferenceId = secondRefundReferenceId;
return this;
}
/**
* The transaction ID returned by the payment gateway if there is an additional transaction for the refund. Use this field to reconcile payments between your gateway and Zuora Payments.
* @return secondRefundReferenceId
*/
@javax.annotation.Nullable
public String getSecondRefundReferenceId() {
return secondRefundReferenceId;
}
public void setSecondRefundReferenceId(String secondRefundReferenceId) {
this.secondRefundReferenceId = secondRefundReferenceId;
}
public RefundCreditMemoRequest softDescriptor(String softDescriptor) {
this.softDescriptor = softDescriptor;
return this;
}
/**
* A payment gateway-specific field that maps to Zuora for the gateways, Orbital, Vantiv and Verifi.
* @return softDescriptor
*/
@javax.annotation.Nullable
public String getSoftDescriptor() {
return softDescriptor;
}
public void setSoftDescriptor(String softDescriptor) {
this.softDescriptor = softDescriptor;
}
public RefundCreditMemoRequest softDescriptorPhone(String softDescriptorPhone) {
this.softDescriptorPhone = softDescriptorPhone;
return this;
}
/**
* A payment gateway-specific field that maps to Zuora for the gateways, Orbital, Vantiv and Verifi.
* @return softDescriptorPhone
*/
@javax.annotation.Nullable
public String getSoftDescriptorPhone() {
return softDescriptorPhone;
}
public void setSoftDescriptorPhone(String softDescriptorPhone) {
this.softDescriptorPhone = softDescriptorPhone;
}
public RefundCreditMemoRequest totalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
return this;
}
/**
* The total amount of the refund. The amount cannot exceed the unapplied amount of the associated credit memo. If the original credit memo was applied to one or more invoices or debit memos, you have to unapply a full or partial credit memo from the invoices or debit memos, and then refund the full or partial unapplied credit memo to your customers.
* @return totalAmount
*/
@javax.annotation.Nonnull
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public RefundCreditMemoRequest type(TypeEnum type) {
this.type = type;
return this;
}
/**
* The type of the refund.
* @return type
*/
@javax.annotation.Nonnull
public TypeEnum getType() {
return type;
}
public void setType(TypeEnum type) {
this.type = type;
}
/**
* 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 RefundCreditMemoRequest instance itself
*/
public RefundCreditMemoRequest 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;
}
RefundCreditMemoRequest refundCreditMemoRequest = (RefundCreditMemoRequest) o;
return Objects.equals(this.integrationIdNS, refundCreditMemoRequest.integrationIdNS) &&
Objects.equals(this.integrationStatusNS, refundCreditMemoRequest.integrationStatusNS) &&
Objects.equals(this.originNS, refundCreditMemoRequest.originNS) &&
Objects.equals(this.syncDateNS, refundCreditMemoRequest.syncDateNS) &&
Objects.equals(this.synctoNetSuiteNS, refundCreditMemoRequest.synctoNetSuiteNS) &&
Objects.equals(this.comment, refundCreditMemoRequest.comment) &&
Objects.equals(this.customRates, refundCreditMemoRequest.customRates) &&
Objects.equals(this.financeInformation, refundCreditMemoRequest.financeInformation) &&
Objects.equals(this.gatewayId, refundCreditMemoRequest.gatewayId) &&
Objects.equals(this.gatewayOptions, refundCreditMemoRequest.gatewayOptions) &&
Objects.equals(this.items, refundCreditMemoRequest.items) &&
Objects.equals(this.methodType, refundCreditMemoRequest.methodType) &&
Objects.equals(this.paymentMethodId, refundCreditMemoRequest.paymentMethodId) &&
Objects.equals(this.reasonCode, refundCreditMemoRequest.reasonCode) &&
Objects.equals(this.referenceId, refundCreditMemoRequest.referenceId) &&
Objects.equals(this.refundDate, refundCreditMemoRequest.refundDate) &&
Objects.equals(this.secondRefundReferenceId, refundCreditMemoRequest.secondRefundReferenceId) &&
Objects.equals(this.softDescriptor, refundCreditMemoRequest.softDescriptor) &&
Objects.equals(this.softDescriptorPhone, refundCreditMemoRequest.softDescriptorPhone) &&
Objects.equals(this.totalAmount, refundCreditMemoRequest.totalAmount) &&
Objects.equals(this.type, refundCreditMemoRequest.type)&&
Objects.equals(this.additionalProperties, refundCreditMemoRequest.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(integrationIdNS, integrationStatusNS, originNS, syncDateNS, synctoNetSuiteNS, comment, customRates, financeInformation, gatewayId, gatewayOptions, items, methodType, paymentMethodId, reasonCode, referenceId, refundDate, secondRefundReferenceId, softDescriptor, softDescriptorPhone, totalAmount, type, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RefundCreditMemoRequest {\n");
sb.append(" integrationIdNS: ").append(toIndentedString(integrationIdNS)).append("\n");
sb.append(" integrationStatusNS: ").append(toIndentedString(integrationStatusNS)).append("\n");
sb.append(" originNS: ").append(toIndentedString(originNS)).append("\n");
sb.append(" syncDateNS: ").append(toIndentedString(syncDateNS)).append("\n");
sb.append(" synctoNetSuiteNS: ").append(toIndentedString(synctoNetSuiteNS)).append("\n");
sb.append(" comment: ").append(toIndentedString(comment)).append("\n");
sb.append(" customRates: ").append(toIndentedString(customRates)).append("\n");
sb.append(" financeInformation: ").append(toIndentedString(financeInformation)).append("\n");
sb.append(" gatewayId: ").append(toIndentedString(gatewayId)).append("\n");
sb.append(" gatewayOptions: ").append(toIndentedString(gatewayOptions)).append("\n");
sb.append(" items: ").append(toIndentedString(items)).append("\n");
sb.append(" methodType: ").append(toIndentedString(methodType)).append("\n");
sb.append(" paymentMethodId: ").append(toIndentedString(paymentMethodId)).append("\n");
sb.append(" reasonCode: ").append(toIndentedString(reasonCode)).append("\n");
sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n");
sb.append(" refundDate: ").append(toIndentedString(refundDate)).append("\n");
sb.append(" secondRefundReferenceId: ").append(toIndentedString(secondRefundReferenceId)).append("\n");
sb.append(" softDescriptor: ").append(toIndentedString(softDescriptor)).append("\n");
sb.append(" softDescriptorPhone: ").append(toIndentedString(softDescriptorPhone)).append("\n");
sb.append(" totalAmount: ").append(toIndentedString(totalAmount)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).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("IntegrationId__NS");
openapiFields.add("IntegrationStatus__NS");
openapiFields.add("Origin__NS");
openapiFields.add("SyncDate__NS");
openapiFields.add("SynctoNetSuite__NS");
openapiFields.add("comment");
openapiFields.add("customRates");
openapiFields.add("financeInformation");
openapiFields.add("gatewayId");
openapiFields.add("gatewayOptions");
openapiFields.add("items");
openapiFields.add("methodType");
openapiFields.add("paymentMethodId");
openapiFields.add("reasonCode");
openapiFields.add("referenceId");
openapiFields.add("refundDate");
openapiFields.add("secondRefundReferenceId");
openapiFields.add("softDescriptor");
openapiFields.add("softDescriptorPhone");
openapiFields.add("totalAmount");
openapiFields.add("type");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("totalAmount");
openapiRequiredFields.add("type");
}
/**
* 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 RefundCreditMemoRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RefundCreditMemoRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RefundCreditMemoRequest is not found in the empty JSON string", RefundCreditMemoRequest.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : RefundCreditMemoRequest.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("IntegrationId__NS") != null && !jsonObj.get("IntegrationId__NS").isJsonNull()) && !jsonObj.get("IntegrationId__NS").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `IntegrationId__NS` to be a primitive type in the JSON string but got `%s`", jsonObj.get("IntegrationId__NS").toString()));
}
if ((jsonObj.get("IntegrationStatus__NS") != null && !jsonObj.get("IntegrationStatus__NS").isJsonNull()) && !jsonObj.get("IntegrationStatus__NS").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `IntegrationStatus__NS` to be a primitive type in the JSON string but got `%s`", jsonObj.get("IntegrationStatus__NS").toString()));
}
if ((jsonObj.get("Origin__NS") != null && !jsonObj.get("Origin__NS").isJsonNull()) && !jsonObj.get("Origin__NS").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `Origin__NS` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Origin__NS").toString()));
}
if ((jsonObj.get("SyncDate__NS") != null && !jsonObj.get("SyncDate__NS").isJsonNull()) && !jsonObj.get("SyncDate__NS").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `SyncDate__NS` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SyncDate__NS").toString()));
}
if ((jsonObj.get("SynctoNetSuite__NS") != null && !jsonObj.get("SynctoNetSuite__NS").isJsonNull()) && !jsonObj.get("SynctoNetSuite__NS").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `SynctoNetSuite__NS` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SynctoNetSuite__NS").toString()));
}
if ((jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) && !jsonObj.get("comment").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `comment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comment").toString()));
}
if (jsonObj.get("customRates") != null && !jsonObj.get("customRates").isJsonNull()) {
JsonArray jsonArraycustomRates = jsonObj.getAsJsonArray("customRates");
if (jsonArraycustomRates != null) {
// ensure the json data is an array
if (!jsonObj.get("customRates").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `customRates` to be an array in the JSON string but got `%s`", jsonObj.get("customRates").toString()));
}
// validate the optional field `customRates` (array)
for (int i = 0; i < jsonArraycustomRates.size(); i++) {
CustomRates.validateJsonElement(jsonArraycustomRates.get(i));
};
}
}
// validate the optional field `financeInformation`
if (jsonObj.get("financeInformation") != null && !jsonObj.get("financeInformation").isJsonNull()) {
CreateNonRefRefundFinanceInformation.validateJsonElement(jsonObj.get("financeInformation"));
}
if ((jsonObj.get("gatewayId") != null && !jsonObj.get("gatewayId").isJsonNull()) && !jsonObj.get("gatewayId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `gatewayId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayId").toString()));
}
// validate the optional field `gatewayOptions`
if (jsonObj.get("gatewayOptions") != null && !jsonObj.get("gatewayOptions").isJsonNull()) {
GatewayOptions.validateJsonElement(jsonObj.get("gatewayOptions"));
}
if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) {
JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items");
if (jsonArrayitems != null) {
// ensure the json data is an array
if (!jsonObj.get("items").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString()));
}
// validate the optional field `items` (array)
for (int i = 0; i < jsonArrayitems.size(); i++) {
RefundCreditMemoItemRequest.validateJsonElement(jsonArrayitems.get(i));
};
}
}
if ((jsonObj.get("methodType") != null && !jsonObj.get("methodType").isJsonNull()) && !jsonObj.get("methodType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `methodType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("methodType").toString()));
}
// validate the optional field `methodType`
if (jsonObj.get("methodType") != null && !jsonObj.get("methodType").isJsonNull()) {
PaymentMethodType.validateJsonElement(jsonObj.get("methodType"));
}
if ((jsonObj.get("paymentMethodId") != null && !jsonObj.get("paymentMethodId").isJsonNull()) && !jsonObj.get("paymentMethodId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `paymentMethodId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethodId").toString()));
}
if ((jsonObj.get("reasonCode") != null && !jsonObj.get("reasonCode").isJsonNull()) && !jsonObj.get("reasonCode").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `reasonCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasonCode").toString()));
}
if ((jsonObj.get("referenceId") != null && !jsonObj.get("referenceId").isJsonNull()) && !jsonObj.get("referenceId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `referenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceId").toString()));
}
if ((jsonObj.get("secondRefundReferenceId") != null && !jsonObj.get("secondRefundReferenceId").isJsonNull()) && !jsonObj.get("secondRefundReferenceId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `secondRefundReferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secondRefundReferenceId").toString()));
}
if ((jsonObj.get("softDescriptor") != null && !jsonObj.get("softDescriptor").isJsonNull()) && !jsonObj.get("softDescriptor").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `softDescriptor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("softDescriptor").toString()));
}
if ((jsonObj.get("softDescriptorPhone") != null && !jsonObj.get("softDescriptorPhone").isJsonNull()) && !jsonObj.get("softDescriptorPhone").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `softDescriptorPhone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("softDescriptorPhone").toString()));
}
if (!jsonObj.get("type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
}
// validate the required field `type`
TypeEnum.validateJsonElement(jsonObj.get("type"));
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!RefundCreditMemoRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RefundCreditMemoRequest' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RefundCreditMemoRequest.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, RefundCreditMemoRequest 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 RefundCreditMemoRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
RefundCreditMemoRequest 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 RefundCreditMemoRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of RefundCreditMemoRequest
* @throws IOException if the JSON string is invalid with respect to RefundCreditMemoRequest
*/
public static RefundCreditMemoRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RefundCreditMemoRequest.class);
}
/**
* Convert an instance of RefundCreditMemoRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy