All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zuora.model.RefundCreditMemoResponse Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
 * 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.GatewayState;
import com.zuora.model.GetRefundCreditMemoFinanceInformation;
import com.zuora.model.PaymentMethodType;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
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;

/**
 * RefundCreditMemoResponse
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class RefundCreditMemoResponse {
  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_ACCOUNT_ID = "accountId";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_ID)
  private String accountId;

  public static final String SERIALIZED_NAME_AMOUNT = "amount";
  @SerializedName(SERIALIZED_NAME_AMOUNT)
  private BigDecimal amount;

  public static final String SERIALIZED_NAME_CANCELLED_ON = "cancelledOn";
  @SerializedName(SERIALIZED_NAME_CANCELLED_ON)
  private String cancelledOn;

  public static final String SERIALIZED_NAME_COMMENT = "comment";
  @SerializedName(SERIALIZED_NAME_COMMENT)
  private String comment;

  public static final String SERIALIZED_NAME_CREATED_BY_ID = "createdById";
  @SerializedName(SERIALIZED_NAME_CREATED_BY_ID)
  private String createdById;

  public static final String SERIALIZED_NAME_CREATED_DATE = "createdDate";
  @SerializedName(SERIALIZED_NAME_CREATED_DATE)
  private String createdDate;

  public static final String SERIALIZED_NAME_CREDIT_MEMO_ID = "creditMemoId";
  @SerializedName(SERIALIZED_NAME_CREDIT_MEMO_ID)
  private String creditMemoId;

  public static final String SERIALIZED_NAME_FINANCE_INFORMATION = "financeInformation";
  @SerializedName(SERIALIZED_NAME_FINANCE_INFORMATION)
  private GetRefundCreditMemoFinanceInformation 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_RESPONSE = "gatewayResponse";
  @SerializedName(SERIALIZED_NAME_GATEWAY_RESPONSE)
  private String gatewayResponse;

  public static final String SERIALIZED_NAME_GATEWAY_RESPONSE_CODE = "gatewayResponseCode";
  @SerializedName(SERIALIZED_NAME_GATEWAY_RESPONSE_CODE)
  private String gatewayResponseCode;

  public static final String SERIALIZED_NAME_GATEWAY_STATE = "gatewayState";
  @SerializedName(SERIALIZED_NAME_GATEWAY_STATE)
  private GatewayState gatewayState;

  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  private String id;

  public static final String SERIALIZED_NAME_MARKED_FOR_SUBMISSION_ON = "markedForSubmissionOn";
  @SerializedName(SERIALIZED_NAME_MARKED_FOR_SUBMISSION_ON)
  private String markedForSubmissionOn;

  public static final String SERIALIZED_NAME_METHOD_TYPE = "methodType";
  @SerializedName(SERIALIZED_NAME_METHOD_TYPE)
  private PaymentMethodType methodType;

  public static final String SERIALIZED_NAME_NUMBER = "number";
  @SerializedName(SERIALIZED_NAME_NUMBER)
  private String number;

  public static final String SERIALIZED_NAME_PAYMENT_ID = "paymentId";
  @SerializedName(SERIALIZED_NAME_PAYMENT_ID)
  private String paymentId;

  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_PAYMENT_METHOD_SNAPSHOT_ID = "paymentMethodSnapshotId";
  @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD_SNAPSHOT_ID)
  private String paymentMethodSnapshotId;

  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 String refundDate;

  public static final String SERIALIZED_NAME_REFUND_TRANSACTION_TIME = "refundTransactionTime";
  @SerializedName(SERIALIZED_NAME_REFUND_TRANSACTION_TIME)
  private String refundTransactionTime;

  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_SETTLED_ON = "settledOn";
  @SerializedName(SERIALIZED_NAME_SETTLED_ON)
  private OffsetDateTime settledOn;

  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;

  /**
   * The status of the refund.
   */
  @JsonAdapter(StatusEnum.Adapter.class)
  public enum StatusEnum {
    PROCESSED("Processed"),
    
    CANCELED("Canceled"),
    
    ERROR("Error"),
    
    PROCESSING("Processing");

    private String value;

    StatusEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static StatusEnum fromValue(String value) {
      for (StatusEnum b : StatusEnum.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 StatusEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public StatusEnum read(final JsonReader jsonReader) throws IOException {
        String value =  jsonReader.nextString();
        return StatusEnum.fromValue(value);
      }
    }

    public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      String value = jsonElement.getAsString();
      StatusEnum.fromValue(value);
    }
  }

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private StatusEnum status;

  public static final String SERIALIZED_NAME_SUBMITTED_ON = "submittedOn";
  @SerializedName(SERIALIZED_NAME_SUBMITTED_ON)
  private String submittedOn;

  public static final String SERIALIZED_NAME_SUCCESS = "success";
  @SerializedName(SERIALIZED_NAME_SUCCESS)
  private Boolean success;

  /**
   * 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 static final String SERIALIZED_NAME_UPDATED_BY_ID = "updatedById";
  @SerializedName(SERIALIZED_NAME_UPDATED_BY_ID)
  private String updatedById;

  public static final String SERIALIZED_NAME_UPDATED_DATE = "updatedDate";
  @SerializedName(SERIALIZED_NAME_UPDATED_DATE)
  private String updatedDate;

  public RefundCreditMemoResponse() {
  }

  public RefundCreditMemoResponse 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 RefundCreditMemoResponse 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 RefundCreditMemoResponse 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 RefundCreditMemoResponse 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 RefundCreditMemoResponse 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 RefundCreditMemoResponse accountId(String accountId) {
    this.accountId = accountId;
    return this;
  }

  /**
   * The ID of the account associated with this refund. Zuora associates the refund automatically with the account from the associated payment.
   * @return accountId
   */
  @javax.annotation.Nullable
  public String getAccountId() {
    return accountId;
  }

  public void setAccountId(String accountId) {
    this.accountId = accountId;
  }


  public RefundCreditMemoResponse amount(BigDecimal amount) {
    this.amount = amount;
    return this;
  }

  /**
   * The total amount of the refund.
   * @return amount
   */
  @javax.annotation.Nullable
  public BigDecimal getAmount() {
    return amount;
  }

  public void setAmount(BigDecimal amount) {
    this.amount = amount;
  }


  public RefundCreditMemoResponse cancelledOn(String cancelledOn) {
    this.cancelledOn = cancelledOn;
    return this;
  }

  /**
   * The date and time when the refund was cancelled, in `yyyy-mm-dd hh:mm:ss` format.
   * @return cancelledOn
   */
  @javax.annotation.Nullable
  public String getCancelledOn() {
    return cancelledOn;
  }

  public void setCancelledOn(String cancelledOn) {
    this.cancelledOn = cancelledOn;
  }


  public RefundCreditMemoResponse 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 RefundCreditMemoResponse createdById(String createdById) {
    this.createdById = createdById;
    return this;
  }

  /**
   * The ID of the Zuora user who created the refund.
   * @return createdById
   */
  @javax.annotation.Nullable
  public String getCreatedById() {
    return createdById;
  }

  public void setCreatedById(String createdById) {
    this.createdById = createdById;
  }


  public RefundCreditMemoResponse createdDate(String createdDate) {
    this.createdDate = createdDate;
    return this;
  }

  /**
   * The date and time when the refund was created, in `yyyy-mm-dd hh:mm:ss` format. For example, 2017-03-06 15:31:10.
   * @return createdDate
   */
  @javax.annotation.Nullable
  public String getCreatedDate() {
    return createdDate;
  }

  public void setCreatedDate(String createdDate) {
    this.createdDate = createdDate;
  }


  public RefundCreditMemoResponse creditMemoId(String creditMemoId) {
    this.creditMemoId = creditMemoId;
    return this;
  }

  /**
   * The ID of the credit memo that is refunded.
   * @return creditMemoId
   */
  @javax.annotation.Nullable
  public String getCreditMemoId() {
    return creditMemoId;
  }

  public void setCreditMemoId(String creditMemoId) {
    this.creditMemoId = creditMemoId;
  }


  public RefundCreditMemoResponse financeInformation(GetRefundCreditMemoFinanceInformation financeInformation) {
    this.financeInformation = financeInformation;
    return this;
  }

  /**
   * Get financeInformation
   * @return financeInformation
   */
  @javax.annotation.Nullable
  public GetRefundCreditMemoFinanceInformation getFinanceInformation() {
    return financeInformation;
  }

  public void setFinanceInformation(GetRefundCreditMemoFinanceInformation financeInformation) {
    this.financeInformation = financeInformation;
  }


  public RefundCreditMemoResponse gatewayId(String gatewayId) {
    this.gatewayId = gatewayId;
    return this;
  }

  /**
   * The ID of the gateway instance that processes the refund.
   * @return gatewayId
   */
  @javax.annotation.Nullable
  public String getGatewayId() {
    return gatewayId;
  }

  public void setGatewayId(String gatewayId) {
    this.gatewayId = gatewayId;
  }


  public RefundCreditMemoResponse gatewayResponse(String gatewayResponse) {
    this.gatewayResponse = gatewayResponse;
    return this;
  }

  /**
   * The message returned from the payment gateway for the refund. This message is gateway-dependent.
   * @return gatewayResponse
   */
  @javax.annotation.Nullable
  public String getGatewayResponse() {
    return gatewayResponse;
  }

  public void setGatewayResponse(String gatewayResponse) {
    this.gatewayResponse = gatewayResponse;
  }


  public RefundCreditMemoResponse gatewayResponseCode(String gatewayResponseCode) {
    this.gatewayResponseCode = gatewayResponseCode;
    return this;
  }

  /**
   * The response code returned from the payment gateway for the refund. This code is gateway-dependent.
   * @return gatewayResponseCode
   */
  @javax.annotation.Nullable
  public String getGatewayResponseCode() {
    return gatewayResponseCode;
  }

  public void setGatewayResponseCode(String gatewayResponseCode) {
    this.gatewayResponseCode = gatewayResponseCode;
  }


  public RefundCreditMemoResponse gatewayState(GatewayState gatewayState) {
    this.gatewayState = gatewayState;
    return this;
  }

  /**
   * Get gatewayState
   * @return gatewayState
   */
  @javax.annotation.Nullable
  public GatewayState getGatewayState() {
    return gatewayState;
  }

  public void setGatewayState(GatewayState gatewayState) {
    this.gatewayState = gatewayState;
  }


  public RefundCreditMemoResponse id(String id) {
    this.id = id;
    return this;
  }

  /**
   * The ID of the created refund.
   * @return id
   */
  @javax.annotation.Nullable
  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }


  public RefundCreditMemoResponse markedForSubmissionOn(String markedForSubmissionOn) {
    this.markedForSubmissionOn = markedForSubmissionOn;
    return this;
  }

  /**
   * The date and time when a refund was marked and waiting for batch submission to the payment process, in `yyyy-mm-dd hh:mm:ss` format.
   * @return markedForSubmissionOn
   */
  @javax.annotation.Nullable
  public String getMarkedForSubmissionOn() {
    return markedForSubmissionOn;
  }

  public void setMarkedForSubmissionOn(String markedForSubmissionOn) {
    this.markedForSubmissionOn = markedForSubmissionOn;
  }


  public RefundCreditMemoResponse 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 RefundCreditMemoResponse number(String number) {
    this.number = number;
    return this;
  }

  /**
   * The unique identification number of the refund.
   * @return number
   */
  @javax.annotation.Nullable
  public String getNumber() {
    return number;
  }

  public void setNumber(String number) {
    this.number = number;
  }


  public RefundCreditMemoResponse paymentId(String paymentId) {
    this.paymentId = paymentId;
    return this;
  }

  /**
   * The ID of the payment associated with the refund.
   * @return paymentId
   */
  @javax.annotation.Nullable
  public String getPaymentId() {
    return paymentId;
  }

  public void setPaymentId(String paymentId) {
    this.paymentId = paymentId;
  }


  public RefundCreditMemoResponse paymentMethodId(String paymentMethodId) {
    this.paymentMethodId = paymentMethodId;
    return this;
  }

  /**
   * The unique ID of the payment method that the customer used to make the refund.
   * @return paymentMethodId
   */
  @javax.annotation.Nullable
  public String getPaymentMethodId() {
    return paymentMethodId;
  }

  public void setPaymentMethodId(String paymentMethodId) {
    this.paymentMethodId = paymentMethodId;
  }


  public RefundCreditMemoResponse paymentMethodSnapshotId(String paymentMethodSnapshotId) {
    this.paymentMethodSnapshotId = paymentMethodSnapshotId;
    return this;
  }

  /**
   * The unique ID of the payment method snapshot, which is a copy of the particular payment method used in a transaction.
   * @return paymentMethodSnapshotId
   */
  @javax.annotation.Nullable
  public String getPaymentMethodSnapshotId() {
    return paymentMethodSnapshotId;
  }

  public void setPaymentMethodSnapshotId(String paymentMethodSnapshotId) {
    this.paymentMethodSnapshotId = paymentMethodSnapshotId;
  }


  public RefundCreditMemoResponse reasonCode(String reasonCode) {
    this.reasonCode = reasonCode;
    return this;
  }

  /**
   * A code identifying the reason for the transaction.
   * @return reasonCode
   */
  @javax.annotation.Nullable
  public String getReasonCode() {
    return reasonCode;
  }

  public void setReasonCode(String reasonCode) {
    this.reasonCode = reasonCode;
  }


  public RefundCreditMemoResponse 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 RefundCreditMemoResponse refundDate(String refundDate) {
    this.refundDate = refundDate;
    return this;
  }

  /**
   * The date when the refund takes effect, in yyyy-mm-dd format.
   * @return refundDate
   */
  @javax.annotation.Nullable
  public String getRefundDate() {
    return refundDate;
  }

  public void setRefundDate(String refundDate) {
    this.refundDate = refundDate;
  }


  public RefundCreditMemoResponse refundTransactionTime(String refundTransactionTime) {
    this.refundTransactionTime = refundTransactionTime;
    return this;
  }

  /**
   * The date and time when the refund was issued, in `yyyy-mm-dd hh:mm:ss` format.
   * @return refundTransactionTime
   */
  @javax.annotation.Nullable
  public String getRefundTransactionTime() {
    return refundTransactionTime;
  }

  public void setRefundTransactionTime(String refundTransactionTime) {
    this.refundTransactionTime = refundTransactionTime;
  }


  public RefundCreditMemoResponse 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 RefundCreditMemoResponse settledOn(OffsetDateTime settledOn) {
    this.settledOn = settledOn;
    return this;
  }

  /**
   * The date and time when the refund was settled in the payment processor, in `yyyy-mm-dd hh:mm:ss` format. This field is used by the Spectrum gateway only and not applicable to other gateways.
   * @return settledOn
   */
  @javax.annotation.Nullable
  public OffsetDateTime getSettledOn() {
    return settledOn;
  }

  public void setSettledOn(OffsetDateTime settledOn) {
    this.settledOn = settledOn;
  }


  public RefundCreditMemoResponse 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 RefundCreditMemoResponse 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 RefundCreditMemoResponse status(StatusEnum status) {
    this.status = status;
    return this;
  }

  /**
   * The status of the refund.
   * @return status
   */
  @javax.annotation.Nullable
  public StatusEnum getStatus() {
    return status;
  }

  public void setStatus(StatusEnum status) {
    this.status = status;
  }


  public RefundCreditMemoResponse submittedOn(String submittedOn) {
    this.submittedOn = submittedOn;
    return this;
  }

  /**
   * The date and time when the refund was submitted, in `yyyy-mm-dd hh:mm:ss` format.
   * @return submittedOn
   */
  @javax.annotation.Nullable
  public String getSubmittedOn() {
    return submittedOn;
  }

  public void setSubmittedOn(String submittedOn) {
    this.submittedOn = submittedOn;
  }


  public RefundCreditMemoResponse success(Boolean success) {
    this.success = success;
    return this;
  }

  /**
   * Returns `true` if the request was processed successfully.
   * @return success
   */
  @javax.annotation.Nullable
  public Boolean getSuccess() {
    return success;
  }

  public void setSuccess(Boolean success) {
    this.success = success;
  }


  public RefundCreditMemoResponse type(TypeEnum type) {
    this.type = type;
    return this;
  }

  /**
   * The type of the refund.
   * @return type
   */
  @javax.annotation.Nullable
  public TypeEnum getType() {
    return type;
  }

  public void setType(TypeEnum type) {
    this.type = type;
  }


  public RefundCreditMemoResponse updatedById(String updatedById) {
    this.updatedById = updatedById;
    return this;
  }

  /**
   * The ID of the Zuora user who last updated the refund.
   * @return updatedById
   */
  @javax.annotation.Nullable
  public String getUpdatedById() {
    return updatedById;
  }

  public void setUpdatedById(String updatedById) {
    this.updatedById = updatedById;
  }


  public RefundCreditMemoResponse updatedDate(String updatedDate) {
    this.updatedDate = updatedDate;
    return this;
  }

  /**
   * The date and time when the refund was last updated, in `yyyy-mm-dd hh:mm:ss` format. For example, 2017-03-07 15:36:10.
   * @return updatedDate
   */
  @javax.annotation.Nullable
  public String getUpdatedDate() {
    return updatedDate;
  }

  public void setUpdatedDate(String updatedDate) {
    this.updatedDate = updatedDate;
  }

  /**
   * 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 RefundCreditMemoResponse instance itself
   */
  public RefundCreditMemoResponse 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;
    }
    RefundCreditMemoResponse refundCreditMemoResponse = (RefundCreditMemoResponse) o;
    return Objects.equals(this.integrationIdNS, refundCreditMemoResponse.integrationIdNS) &&
        Objects.equals(this.integrationStatusNS, refundCreditMemoResponse.integrationStatusNS) &&
        Objects.equals(this.originNS, refundCreditMemoResponse.originNS) &&
        Objects.equals(this.syncDateNS, refundCreditMemoResponse.syncDateNS) &&
        Objects.equals(this.synctoNetSuiteNS, refundCreditMemoResponse.synctoNetSuiteNS) &&
        Objects.equals(this.accountId, refundCreditMemoResponse.accountId) &&
        Objects.equals(this.amount, refundCreditMemoResponse.amount) &&
        Objects.equals(this.cancelledOn, refundCreditMemoResponse.cancelledOn) &&
        Objects.equals(this.comment, refundCreditMemoResponse.comment) &&
        Objects.equals(this.createdById, refundCreditMemoResponse.createdById) &&
        Objects.equals(this.createdDate, refundCreditMemoResponse.createdDate) &&
        Objects.equals(this.creditMemoId, refundCreditMemoResponse.creditMemoId) &&
        Objects.equals(this.financeInformation, refundCreditMemoResponse.financeInformation) &&
        Objects.equals(this.gatewayId, refundCreditMemoResponse.gatewayId) &&
        Objects.equals(this.gatewayResponse, refundCreditMemoResponse.gatewayResponse) &&
        Objects.equals(this.gatewayResponseCode, refundCreditMemoResponse.gatewayResponseCode) &&
        Objects.equals(this.gatewayState, refundCreditMemoResponse.gatewayState) &&
        Objects.equals(this.id, refundCreditMemoResponse.id) &&
        Objects.equals(this.markedForSubmissionOn, refundCreditMemoResponse.markedForSubmissionOn) &&
        Objects.equals(this.methodType, refundCreditMemoResponse.methodType) &&
        Objects.equals(this.number, refundCreditMemoResponse.number) &&
        Objects.equals(this.paymentId, refundCreditMemoResponse.paymentId) &&
        Objects.equals(this.paymentMethodId, refundCreditMemoResponse.paymentMethodId) &&
        Objects.equals(this.paymentMethodSnapshotId, refundCreditMemoResponse.paymentMethodSnapshotId) &&
        Objects.equals(this.reasonCode, refundCreditMemoResponse.reasonCode) &&
        Objects.equals(this.referenceId, refundCreditMemoResponse.referenceId) &&
        Objects.equals(this.refundDate, refundCreditMemoResponse.refundDate) &&
        Objects.equals(this.refundTransactionTime, refundCreditMemoResponse.refundTransactionTime) &&
        Objects.equals(this.secondRefundReferenceId, refundCreditMemoResponse.secondRefundReferenceId) &&
        Objects.equals(this.settledOn, refundCreditMemoResponse.settledOn) &&
        Objects.equals(this.softDescriptor, refundCreditMemoResponse.softDescriptor) &&
        Objects.equals(this.softDescriptorPhone, refundCreditMemoResponse.softDescriptorPhone) &&
        Objects.equals(this.status, refundCreditMemoResponse.status) &&
        Objects.equals(this.submittedOn, refundCreditMemoResponse.submittedOn) &&
        Objects.equals(this.success, refundCreditMemoResponse.success) &&
        Objects.equals(this.type, refundCreditMemoResponse.type) &&
        Objects.equals(this.updatedById, refundCreditMemoResponse.updatedById) &&
        Objects.equals(this.updatedDate, refundCreditMemoResponse.updatedDate)&&
        Objects.equals(this.additionalProperties, refundCreditMemoResponse.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(integrationIdNS, integrationStatusNS, originNS, syncDateNS, synctoNetSuiteNS, accountId, amount, cancelledOn, comment, createdById, createdDate, creditMemoId, financeInformation, gatewayId, gatewayResponse, gatewayResponseCode, gatewayState, id, markedForSubmissionOn, methodType, number, paymentId, paymentMethodId, paymentMethodSnapshotId, reasonCode, referenceId, refundDate, refundTransactionTime, secondRefundReferenceId, settledOn, softDescriptor, softDescriptorPhone, status, submittedOn, success, type, updatedById, updatedDate, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class RefundCreditMemoResponse {\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("    accountId: ").append(toIndentedString(accountId)).append("\n");
    sb.append("    amount: ").append(toIndentedString(amount)).append("\n");
    sb.append("    cancelledOn: ").append(toIndentedString(cancelledOn)).append("\n");
    sb.append("    comment: ").append(toIndentedString(comment)).append("\n");
    sb.append("    createdById: ").append(toIndentedString(createdById)).append("\n");
    sb.append("    createdDate: ").append(toIndentedString(createdDate)).append("\n");
    sb.append("    creditMemoId: ").append(toIndentedString(creditMemoId)).append("\n");
    sb.append("    financeInformation: ").append(toIndentedString(financeInformation)).append("\n");
    sb.append("    gatewayId: ").append(toIndentedString(gatewayId)).append("\n");
    sb.append("    gatewayResponse: ").append(toIndentedString(gatewayResponse)).append("\n");
    sb.append("    gatewayResponseCode: ").append(toIndentedString(gatewayResponseCode)).append("\n");
    sb.append("    gatewayState: ").append(toIndentedString(gatewayState)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    markedForSubmissionOn: ").append(toIndentedString(markedForSubmissionOn)).append("\n");
    sb.append("    methodType: ").append(toIndentedString(methodType)).append("\n");
    sb.append("    number: ").append(toIndentedString(number)).append("\n");
    sb.append("    paymentId: ").append(toIndentedString(paymentId)).append("\n");
    sb.append("    paymentMethodId: ").append(toIndentedString(paymentMethodId)).append("\n");
    sb.append("    paymentMethodSnapshotId: ").append(toIndentedString(paymentMethodSnapshotId)).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("    refundTransactionTime: ").append(toIndentedString(refundTransactionTime)).append("\n");
    sb.append("    secondRefundReferenceId: ").append(toIndentedString(secondRefundReferenceId)).append("\n");
    sb.append("    settledOn: ").append(toIndentedString(settledOn)).append("\n");
    sb.append("    softDescriptor: ").append(toIndentedString(softDescriptor)).append("\n");
    sb.append("    softDescriptorPhone: ").append(toIndentedString(softDescriptorPhone)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    submittedOn: ").append(toIndentedString(submittedOn)).append("\n");
    sb.append("    success: ").append(toIndentedString(success)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    updatedById: ").append(toIndentedString(updatedById)).append("\n");
    sb.append("    updatedDate: ").append(toIndentedString(updatedDate)).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("accountId");
    openapiFields.add("amount");
    openapiFields.add("cancelledOn");
    openapiFields.add("comment");
    openapiFields.add("createdById");
    openapiFields.add("createdDate");
    openapiFields.add("creditMemoId");
    openapiFields.add("financeInformation");
    openapiFields.add("gatewayId");
    openapiFields.add("gatewayResponse");
    openapiFields.add("gatewayResponseCode");
    openapiFields.add("gatewayState");
    openapiFields.add("id");
    openapiFields.add("markedForSubmissionOn");
    openapiFields.add("methodType");
    openapiFields.add("number");
    openapiFields.add("paymentId");
    openapiFields.add("paymentMethodId");
    openapiFields.add("paymentMethodSnapshotId");
    openapiFields.add("reasonCode");
    openapiFields.add("referenceId");
    openapiFields.add("refundDate");
    openapiFields.add("refundTransactionTime");
    openapiFields.add("secondRefundReferenceId");
    openapiFields.add("settledOn");
    openapiFields.add("softDescriptor");
    openapiFields.add("softDescriptorPhone");
    openapiFields.add("status");
    openapiFields.add("submittedOn");
    openapiFields.add("success");
    openapiFields.add("type");
    openapiFields.add("updatedById");
    openapiFields.add("updatedDate");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

  /**
   * 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 RefundCreditMemoResponse
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!RefundCreditMemoResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in RefundCreditMemoResponse is not found in the empty JSON string", RefundCreditMemoResponse.openapiRequiredFields.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("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString()));
      }
      if ((jsonObj.get("cancelledOn") != null && !jsonObj.get("cancelledOn").isJsonNull()) && !jsonObj.get("cancelledOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `cancelledOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cancelledOn").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("createdById") != null && !jsonObj.get("createdById").isJsonNull()) && !jsonObj.get("createdById").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `createdById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdById").toString()));
      }
      if ((jsonObj.get("createdDate") != null && !jsonObj.get("createdDate").isJsonNull()) && !jsonObj.get("createdDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `createdDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdDate").toString()));
      }
      if ((jsonObj.get("creditMemoId") != null && !jsonObj.get("creditMemoId").isJsonNull()) && !jsonObj.get("creditMemoId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `creditMemoId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditMemoId").toString()));
      }
      // validate the optional field `financeInformation`
      if (jsonObj.get("financeInformation") != null && !jsonObj.get("financeInformation").isJsonNull()) {
        GetRefundCreditMemoFinanceInformation.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()));
      }
      if ((jsonObj.get("gatewayResponse") != null && !jsonObj.get("gatewayResponse").isJsonNull()) && !jsonObj.get("gatewayResponse").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gatewayResponse` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayResponse").toString()));
      }
      if ((jsonObj.get("gatewayResponseCode") != null && !jsonObj.get("gatewayResponseCode").isJsonNull()) && !jsonObj.get("gatewayResponseCode").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gatewayResponseCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayResponseCode").toString()));
      }
      if ((jsonObj.get("gatewayState") != null && !jsonObj.get("gatewayState").isJsonNull()) && !jsonObj.get("gatewayState").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gatewayState` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayState").toString()));
      }
      // validate the optional field `gatewayState`
      if (jsonObj.get("gatewayState") != null && !jsonObj.get("gatewayState").isJsonNull()) {
        GatewayState.validateJsonElement(jsonObj.get("gatewayState"));
      }
      if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !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("markedForSubmissionOn") != null && !jsonObj.get("markedForSubmissionOn").isJsonNull()) && !jsonObj.get("markedForSubmissionOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `markedForSubmissionOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("markedForSubmissionOn").toString()));
      }
      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("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString()));
      }
      if ((jsonObj.get("paymentId") != null && !jsonObj.get("paymentId").isJsonNull()) && !jsonObj.get("paymentId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `paymentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentId").toString()));
      }
      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("paymentMethodSnapshotId") != null && !jsonObj.get("paymentMethodSnapshotId").isJsonNull()) && !jsonObj.get("paymentMethodSnapshotId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `paymentMethodSnapshotId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethodSnapshotId").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("refundDate") != null && !jsonObj.get("refundDate").isJsonNull()) && !jsonObj.get("refundDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `refundDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refundDate").toString()));
      }
      if ((jsonObj.get("refundTransactionTime") != null && !jsonObj.get("refundTransactionTime").isJsonNull()) && !jsonObj.get("refundTransactionTime").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `refundTransactionTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refundTransactionTime").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("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
      }
      // validate the optional field `status`
      if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) {
        StatusEnum.validateJsonElement(jsonObj.get("status"));
      }
      if ((jsonObj.get("submittedOn") != null && !jsonObj.get("submittedOn").isJsonNull()) && !jsonObj.get("submittedOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `submittedOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("submittedOn").toString()));
      }
      if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !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 optional field `type`
      if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) {
        TypeEnum.validateJsonElement(jsonObj.get("type"));
      }
      if ((jsonObj.get("updatedById") != null && !jsonObj.get("updatedById").isJsonNull()) && !jsonObj.get("updatedById").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `updatedById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedById").toString()));
      }
      if ((jsonObj.get("updatedDate") != null && !jsonObj.get("updatedDate").isJsonNull()) && !jsonObj.get("updatedDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `updatedDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedDate").toString()));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!RefundCreditMemoResponse.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'RefundCreditMemoResponse' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(RefundCreditMemoResponse.class));

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, RefundCreditMemoResponse 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 RefundCreditMemoResponse read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             JsonObject jsonObj = jsonElement.getAsJsonObject();
             // store additional fields in the deserialized instance
             RefundCreditMemoResponse 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 RefundCreditMemoResponse given an JSON string
   *
   * @param jsonString JSON string
   * @return An instance of RefundCreditMemoResponse
   * @throws IOException if the JSON string is invalid with respect to RefundCreditMemoResponse
   */
  public static RefundCreditMemoResponse fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, RefundCreditMemoResponse.class);
  }

  /**
   * Convert an instance of RefundCreditMemoResponse to an JSON string
   *
   * @return JSON string
   */
  public String toJson() {
    return JSON.getGson().toJson(this);
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy