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

com.zuora.model.ExpandedRefund 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.ExpandedAccount;
import com.zuora.model.ExpandedPaymentMethod;
import com.zuora.model.ExpandedRefundApplication;
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;

/**
 * ExpandedRefund
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class ExpandedRefund {
  public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_ID)
  private String accountId;

  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_ACCOUNTING_CODE = "accountingCode";
  @SerializedName(SERIALIZED_NAME_ACCOUNTING_CODE)
  private String accountingCode;

  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_CURRENCY = "currency";
  @SerializedName(SERIALIZED_NAME_CURRENCY)
  private String currency;

  public static final String SERIALIZED_NAME_GATEWAY_RECONCILIATION_REASON = "gatewayReconciliationReason";
  @SerializedName(SERIALIZED_NAME_GATEWAY_RECONCILIATION_REASON)
  private String gatewayReconciliationReason;

  public static final String SERIALIZED_NAME_GATEWAY_RECONCILIATION_STATUS = "gatewayReconciliationStatus";
  @SerializedName(SERIALIZED_NAME_GATEWAY_RECONCILIATION_STATUS)
  private String gatewayReconciliationStatus;

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

  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 String 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_PAYOUT_ID = "payoutId";
  @SerializedName(SERIALIZED_NAME_PAYOUT_ID)
  private String payoutId;

  public static final String SERIALIZED_NAME_REASON_CODE = "reasonCode";
  @SerializedName(SERIALIZED_NAME_REASON_CODE)
  private String reasonCode;

  public static final String SERIALIZED_NAME_REFERENCE_I_D = "referenceID";
  @SerializedName(SERIALIZED_NAME_REFERENCE_I_D)
  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_REFUND_NUMBER = "refundNumber";
  @SerializedName(SERIALIZED_NAME_REFUND_NUMBER)
  private String refundNumber;

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

  public static final String SERIALIZED_NAME_SOURCE_TYPE = "sourceType";
  @SerializedName(SERIALIZED_NAME_SOURCE_TYPE)
  private String sourceType;

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

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

  public static final String SERIALIZED_NAME_TRANSFERRED_TO_ACCOUNTING = "transferredToAccounting";
  @SerializedName(SERIALIZED_NAME_TRANSFERRED_TO_ACCOUNTING)
  private String transferredToAccounting;

  public static final String SERIALIZED_NAME_TYPE = "type";
  @SerializedName(SERIALIZED_NAME_TYPE)
  private String type;

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

  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_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 static final String SERIALIZED_NAME_ASSOCIATED_TRANSACTION_NUMBER = "associatedTransactionNumber";
  @SerializedName(SERIALIZED_NAME_ASSOCIATED_TRANSACTION_NUMBER)
  private String associatedTransactionNumber;

  public static final String SERIALIZED_NAME_GATEWAY = "gateway";
  @SerializedName(SERIALIZED_NAME_GATEWAY)
  private String gateway;

  public static final String SERIALIZED_NAME_ACCOUNT = "account";
  @SerializedName(SERIALIZED_NAME_ACCOUNT)
  private ExpandedAccount account;

  public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod";
  @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD)
  private ExpandedPaymentMethod paymentMethod;

  public static final String SERIALIZED_NAME_REFUND_APPLICATIONS = "refundApplications";
  @SerializedName(SERIALIZED_NAME_REFUND_APPLICATIONS)
  private List refundApplications;

  public ExpandedRefund() {
  }

  public ExpandedRefund accountId(String accountId) {
    this.accountId = accountId;
    return this;
  }

  /**
   * Get accountId
   * @return accountId
   */
  @javax.annotation.Nullable
  public String getAccountId() {
    return accountId;
  }

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


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

  /**
   * Get paymentMethodSnapshotId
   * @return paymentMethodSnapshotId
   */
  @javax.annotation.Nullable
  public String getPaymentMethodSnapshotId() {
    return paymentMethodSnapshotId;
  }

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


  public ExpandedRefund accountingCode(String accountingCode) {
    this.accountingCode = accountingCode;
    return this;
  }

  /**
   * Get accountingCode
   * @return accountingCode
   */
  @javax.annotation.Nullable
  public String getAccountingCode() {
    return accountingCode;
  }

  public void setAccountingCode(String accountingCode) {
    this.accountingCode = accountingCode;
  }


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

  /**
   * Get amount
   * @return amount
   */
  @javax.annotation.Nullable
  public BigDecimal getAmount() {
    return amount;
  }

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


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

  /**
   * Get cancelledOn
   * @return cancelledOn
   */
  @javax.annotation.Nullable
  public String getCancelledOn() {
    return cancelledOn;
  }

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


  public ExpandedRefund comment(String comment) {
    this.comment = comment;
    return this;
  }

  /**
   * Get comment
   * @return comment
   */
  @javax.annotation.Nullable
  public String getComment() {
    return comment;
  }

  public void setComment(String comment) {
    this.comment = comment;
  }


  public ExpandedRefund currency(String currency) {
    this.currency = currency;
    return this;
  }

  /**
   * Get currency
   * @return currency
   */
  @javax.annotation.Nullable
  public String getCurrency() {
    return currency;
  }

  public void setCurrency(String currency) {
    this.currency = currency;
  }


  public ExpandedRefund gatewayReconciliationReason(String gatewayReconciliationReason) {
    this.gatewayReconciliationReason = gatewayReconciliationReason;
    return this;
  }

  /**
   * Get gatewayReconciliationReason
   * @return gatewayReconciliationReason
   */
  @javax.annotation.Nullable
  public String getGatewayReconciliationReason() {
    return gatewayReconciliationReason;
  }

  public void setGatewayReconciliationReason(String gatewayReconciliationReason) {
    this.gatewayReconciliationReason = gatewayReconciliationReason;
  }


  public ExpandedRefund gatewayReconciliationStatus(String gatewayReconciliationStatus) {
    this.gatewayReconciliationStatus = gatewayReconciliationStatus;
    return this;
  }

  /**
   * Get gatewayReconciliationStatus
   * @return gatewayReconciliationStatus
   */
  @javax.annotation.Nullable
  public String getGatewayReconciliationStatus() {
    return gatewayReconciliationStatus;
  }

  public void setGatewayReconciliationStatus(String gatewayReconciliationStatus) {
    this.gatewayReconciliationStatus = gatewayReconciliationStatus;
  }


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

  /**
   * Get gatewayResponse
   * @return gatewayResponse
   */
  @javax.annotation.Nullable
  public String getGatewayResponse() {
    return gatewayResponse;
  }

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


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

  /**
   * Get gatewayResponseCode
   * @return gatewayResponseCode
   */
  @javax.annotation.Nullable
  public String getGatewayResponseCode() {
    return gatewayResponseCode;
  }

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


  public ExpandedRefund gatewayState(String gatewayState) {
    this.gatewayState = gatewayState;
    return this;
  }

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

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


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

  /**
   * Get markedForSubmissionOn
   * @return markedForSubmissionOn
   */
  @javax.annotation.Nullable
  public String getMarkedForSubmissionOn() {
    return markedForSubmissionOn;
  }

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


  public ExpandedRefund methodType(String methodType) {
    this.methodType = methodType;
    return this;
  }

  /**
   * Get methodType
   * @return methodType
   */
  @javax.annotation.Nullable
  public String getMethodType() {
    return methodType;
  }

  public void setMethodType(String methodType) {
    this.methodType = methodType;
  }


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

  /**
   * Get paymentMethodId
   * @return paymentMethodId
   */
  @javax.annotation.Nullable
  public String getPaymentMethodId() {
    return paymentMethodId;
  }

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


  public ExpandedRefund payoutId(String payoutId) {
    this.payoutId = payoutId;
    return this;
  }

  /**
   * Get payoutId
   * @return payoutId
   */
  @javax.annotation.Nullable
  public String getPayoutId() {
    return payoutId;
  }

  public void setPayoutId(String payoutId) {
    this.payoutId = payoutId;
  }


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

  /**
   * Get reasonCode
   * @return reasonCode
   */
  @javax.annotation.Nullable
  public String getReasonCode() {
    return reasonCode;
  }

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


  public ExpandedRefund referenceID(String referenceID) {
    this.referenceID = referenceID;
    return this;
  }

  /**
   * Get referenceID
   * @return referenceID
   */
  @javax.annotation.Nullable
  public String getReferenceID() {
    return referenceID;
  }

  public void setReferenceID(String referenceID) {
    this.referenceID = referenceID;
  }


  public ExpandedRefund refundDate(LocalDate refundDate) {
    this.refundDate = refundDate;
    return this;
  }

  /**
   * Get refundDate
   * @return refundDate
   */
  @javax.annotation.Nullable
  public LocalDate getRefundDate() {
    return refundDate;
  }

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


  public ExpandedRefund refundNumber(String refundNumber) {
    this.refundNumber = refundNumber;
    return this;
  }

  /**
   * Get refundNumber
   * @return refundNumber
   */
  @javax.annotation.Nullable
  public String getRefundNumber() {
    return refundNumber;
  }

  public void setRefundNumber(String refundNumber) {
    this.refundNumber = refundNumber;
  }


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

  /**
   * Get refundTransactionTime
   * @return refundTransactionTime
   */
  @javax.annotation.Nullable
  public String getRefundTransactionTime() {
    return refundTransactionTime;
  }

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


  public ExpandedRefund secondRefundReferenceId(String secondRefundReferenceId) {
    this.secondRefundReferenceId = secondRefundReferenceId;
    return this;
  }

  /**
   * Get secondRefundReferenceId
   * @return secondRefundReferenceId
   */
  @javax.annotation.Nullable
  public String getSecondRefundReferenceId() {
    return secondRefundReferenceId;
  }

  public void setSecondRefundReferenceId(String secondRefundReferenceId) {
    this.secondRefundReferenceId = secondRefundReferenceId;
  }


  public ExpandedRefund settledOn(String settledOn) {
    this.settledOn = settledOn;
    return this;
  }

  /**
   * Get settledOn
   * @return settledOn
   */
  @javax.annotation.Nullable
  public String getSettledOn() {
    return settledOn;
  }

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


  public ExpandedRefund softDescriptor(String softDescriptor) {
    this.softDescriptor = softDescriptor;
    return this;
  }

  /**
   * Get softDescriptor
   * @return softDescriptor
   */
  @javax.annotation.Nullable
  public String getSoftDescriptor() {
    return softDescriptor;
  }

  public void setSoftDescriptor(String softDescriptor) {
    this.softDescriptor = softDescriptor;
  }


  public ExpandedRefund softDescriptorPhone(String softDescriptorPhone) {
    this.softDescriptorPhone = softDescriptorPhone;
    return this;
  }

  /**
   * Get softDescriptorPhone
   * @return softDescriptorPhone
   */
  @javax.annotation.Nullable
  public String getSoftDescriptorPhone() {
    return softDescriptorPhone;
  }

  public void setSoftDescriptorPhone(String softDescriptorPhone) {
    this.softDescriptorPhone = softDescriptorPhone;
  }


  public ExpandedRefund sourceType(String sourceType) {
    this.sourceType = sourceType;
    return this;
  }

  /**
   * Get sourceType
   * @return sourceType
   */
  @javax.annotation.Nullable
  public String getSourceType() {
    return sourceType;
  }

  public void setSourceType(String sourceType) {
    this.sourceType = sourceType;
  }


  public ExpandedRefund status(String status) {
    this.status = status;
    return this;
  }

  /**
   * Get status
   * @return status
   */
  @javax.annotation.Nullable
  public String getStatus() {
    return status;
  }

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


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

  /**
   * Get submittedOn
   * @return submittedOn
   */
  @javax.annotation.Nullable
  public String getSubmittedOn() {
    return submittedOn;
  }

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


  public ExpandedRefund transferredToAccounting(String transferredToAccounting) {
    this.transferredToAccounting = transferredToAccounting;
    return this;
  }

  /**
   * Get transferredToAccounting
   * @return transferredToAccounting
   */
  @javax.annotation.Nullable
  public String getTransferredToAccounting() {
    return transferredToAccounting;
  }

  public void setTransferredToAccounting(String transferredToAccounting) {
    this.transferredToAccounting = transferredToAccounting;
  }


  public ExpandedRefund type(String type) {
    this.type = type;
    return this;
  }

  /**
   * Get type
   * @return type
   */
  @javax.annotation.Nullable
  public String getType() {
    return type;
  }

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


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

  /**
   * Get id
   * @return id
   */
  @javax.annotation.Nullable
  public String getId() {
    return id;
  }

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


  public ExpandedRefund createdById(String createdById) {
    this.createdById = createdById;
    return this;
  }

  /**
   * Get createdById
   * @return createdById
   */
  @javax.annotation.Nullable
  public String getCreatedById() {
    return createdById;
  }

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


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

  /**
   * Get createdDate
   * @return createdDate
   */
  @javax.annotation.Nullable
  public String getCreatedDate() {
    return createdDate;
  }

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


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

  /**
   * Get updatedById
   * @return updatedById
   */
  @javax.annotation.Nullable
  public String getUpdatedById() {
    return updatedById;
  }

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


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

  /**
   * Get updatedDate
   * @return updatedDate
   */
  @javax.annotation.Nullable
  public String getUpdatedDate() {
    return updatedDate;
  }

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


  public ExpandedRefund associatedTransactionNumber(String associatedTransactionNumber) {
    this.associatedTransactionNumber = associatedTransactionNumber;
    return this;
  }

  /**
   * Get associatedTransactionNumber
   * @return associatedTransactionNumber
   */
  @javax.annotation.Nullable
  public String getAssociatedTransactionNumber() {
    return associatedTransactionNumber;
  }

  public void setAssociatedTransactionNumber(String associatedTransactionNumber) {
    this.associatedTransactionNumber = associatedTransactionNumber;
  }


  public ExpandedRefund gateway(String gateway) {
    this.gateway = gateway;
    return this;
  }

  /**
   * Get gateway
   * @return gateway
   */
  @javax.annotation.Nullable
  public String getGateway() {
    return gateway;
  }

  public void setGateway(String gateway) {
    this.gateway = gateway;
  }


  public ExpandedRefund account(ExpandedAccount account) {
    this.account = account;
    return this;
  }

  /**
   * Get account
   * @return account
   */
  @javax.annotation.Nullable
  public ExpandedAccount getAccount() {
    return account;
  }

  public void setAccount(ExpandedAccount account) {
    this.account = account;
  }


  public ExpandedRefund paymentMethod(ExpandedPaymentMethod paymentMethod) {
    this.paymentMethod = paymentMethod;
    return this;
  }

  /**
   * Get paymentMethod
   * @return paymentMethod
   */
  @javax.annotation.Nullable
  public ExpandedPaymentMethod getPaymentMethod() {
    return paymentMethod;
  }

  public void setPaymentMethod(ExpandedPaymentMethod paymentMethod) {
    this.paymentMethod = paymentMethod;
  }


  public ExpandedRefund refundApplications(List refundApplications) {
    this.refundApplications = refundApplications;
    return this;
  }

  public ExpandedRefund addRefundApplicationsItem(ExpandedRefundApplication refundApplicationsItem) {
    if (this.refundApplications == null) {
      this.refundApplications = new ArrayList<>();
    }
    this.refundApplications.add(refundApplicationsItem);
    return this;
  }

  /**
   * Get refundApplications
   * @return refundApplications
   */
  @javax.annotation.Nullable
  public List getRefundApplications() {
    return refundApplications;
  }

  public void setRefundApplications(List refundApplications) {
    this.refundApplications = refundApplications;
  }

  /**
   * 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 ExpandedRefund instance itself
   */
  public ExpandedRefund 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;
    }
    ExpandedRefund expandedRefund = (ExpandedRefund) o;
    return Objects.equals(this.accountId, expandedRefund.accountId) &&
        Objects.equals(this.paymentMethodSnapshotId, expandedRefund.paymentMethodSnapshotId) &&
        Objects.equals(this.accountingCode, expandedRefund.accountingCode) &&
        Objects.equals(this.amount, expandedRefund.amount) &&
        Objects.equals(this.cancelledOn, expandedRefund.cancelledOn) &&
        Objects.equals(this.comment, expandedRefund.comment) &&
        Objects.equals(this.currency, expandedRefund.currency) &&
        Objects.equals(this.gatewayReconciliationReason, expandedRefund.gatewayReconciliationReason) &&
        Objects.equals(this.gatewayReconciliationStatus, expandedRefund.gatewayReconciliationStatus) &&
        Objects.equals(this.gatewayResponse, expandedRefund.gatewayResponse) &&
        Objects.equals(this.gatewayResponseCode, expandedRefund.gatewayResponseCode) &&
        Objects.equals(this.gatewayState, expandedRefund.gatewayState) &&
        Objects.equals(this.markedForSubmissionOn, expandedRefund.markedForSubmissionOn) &&
        Objects.equals(this.methodType, expandedRefund.methodType) &&
        Objects.equals(this.paymentMethodId, expandedRefund.paymentMethodId) &&
        Objects.equals(this.payoutId, expandedRefund.payoutId) &&
        Objects.equals(this.reasonCode, expandedRefund.reasonCode) &&
        Objects.equals(this.referenceID, expandedRefund.referenceID) &&
        Objects.equals(this.refundDate, expandedRefund.refundDate) &&
        Objects.equals(this.refundNumber, expandedRefund.refundNumber) &&
        Objects.equals(this.refundTransactionTime, expandedRefund.refundTransactionTime) &&
        Objects.equals(this.secondRefundReferenceId, expandedRefund.secondRefundReferenceId) &&
        Objects.equals(this.settledOn, expandedRefund.settledOn) &&
        Objects.equals(this.softDescriptor, expandedRefund.softDescriptor) &&
        Objects.equals(this.softDescriptorPhone, expandedRefund.softDescriptorPhone) &&
        Objects.equals(this.sourceType, expandedRefund.sourceType) &&
        Objects.equals(this.status, expandedRefund.status) &&
        Objects.equals(this.submittedOn, expandedRefund.submittedOn) &&
        Objects.equals(this.transferredToAccounting, expandedRefund.transferredToAccounting) &&
        Objects.equals(this.type, expandedRefund.type) &&
        Objects.equals(this.id, expandedRefund.id) &&
        Objects.equals(this.createdById, expandedRefund.createdById) &&
        Objects.equals(this.createdDate, expandedRefund.createdDate) &&
        Objects.equals(this.updatedById, expandedRefund.updatedById) &&
        Objects.equals(this.updatedDate, expandedRefund.updatedDate) &&
        Objects.equals(this.associatedTransactionNumber, expandedRefund.associatedTransactionNumber) &&
        Objects.equals(this.gateway, expandedRefund.gateway) &&
        Objects.equals(this.account, expandedRefund.account) &&
        Objects.equals(this.paymentMethod, expandedRefund.paymentMethod) &&
        Objects.equals(this.refundApplications, expandedRefund.refundApplications)&&
        Objects.equals(this.additionalProperties, expandedRefund.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(accountId, paymentMethodSnapshotId, accountingCode, amount, cancelledOn, comment, currency, gatewayReconciliationReason, gatewayReconciliationStatus, gatewayResponse, gatewayResponseCode, gatewayState, markedForSubmissionOn, methodType, paymentMethodId, payoutId, reasonCode, referenceID, refundDate, refundNumber, refundTransactionTime, secondRefundReferenceId, settledOn, softDescriptor, softDescriptorPhone, sourceType, status, submittedOn, transferredToAccounting, type, id, createdById, createdDate, updatedById, updatedDate, associatedTransactionNumber, gateway, account, paymentMethod, refundApplications, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ExpandedRefund {\n");
    sb.append("    accountId: ").append(toIndentedString(accountId)).append("\n");
    sb.append("    paymentMethodSnapshotId: ").append(toIndentedString(paymentMethodSnapshotId)).append("\n");
    sb.append("    accountingCode: ").append(toIndentedString(accountingCode)).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("    currency: ").append(toIndentedString(currency)).append("\n");
    sb.append("    gatewayReconciliationReason: ").append(toIndentedString(gatewayReconciliationReason)).append("\n");
    sb.append("    gatewayReconciliationStatus: ").append(toIndentedString(gatewayReconciliationStatus)).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("    markedForSubmissionOn: ").append(toIndentedString(markedForSubmissionOn)).append("\n");
    sb.append("    methodType: ").append(toIndentedString(methodType)).append("\n");
    sb.append("    paymentMethodId: ").append(toIndentedString(paymentMethodId)).append("\n");
    sb.append("    payoutId: ").append(toIndentedString(payoutId)).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("    refundNumber: ").append(toIndentedString(refundNumber)).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("    sourceType: ").append(toIndentedString(sourceType)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    submittedOn: ").append(toIndentedString(submittedOn)).append("\n");
    sb.append("    transferredToAccounting: ").append(toIndentedString(transferredToAccounting)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    createdById: ").append(toIndentedString(createdById)).append("\n");
    sb.append("    createdDate: ").append(toIndentedString(createdDate)).append("\n");
    sb.append("    updatedById: ").append(toIndentedString(updatedById)).append("\n");
    sb.append("    updatedDate: ").append(toIndentedString(updatedDate)).append("\n");
    sb.append("    associatedTransactionNumber: ").append(toIndentedString(associatedTransactionNumber)).append("\n");
    sb.append("    gateway: ").append(toIndentedString(gateway)).append("\n");
    sb.append("    account: ").append(toIndentedString(account)).append("\n");
    sb.append("    paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n");
    sb.append("    refundApplications: ").append(toIndentedString(refundApplications)).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("accountId");
    openapiFields.add("paymentMethodSnapshotId");
    openapiFields.add("accountingCode");
    openapiFields.add("amount");
    openapiFields.add("cancelledOn");
    openapiFields.add("comment");
    openapiFields.add("currency");
    openapiFields.add("gatewayReconciliationReason");
    openapiFields.add("gatewayReconciliationStatus");
    openapiFields.add("gatewayResponse");
    openapiFields.add("gatewayResponseCode");
    openapiFields.add("gatewayState");
    openapiFields.add("markedForSubmissionOn");
    openapiFields.add("methodType");
    openapiFields.add("paymentMethodId");
    openapiFields.add("payoutId");
    openapiFields.add("reasonCode");
    openapiFields.add("referenceID");
    openapiFields.add("refundDate");
    openapiFields.add("refundNumber");
    openapiFields.add("refundTransactionTime");
    openapiFields.add("secondRefundReferenceId");
    openapiFields.add("settledOn");
    openapiFields.add("softDescriptor");
    openapiFields.add("softDescriptorPhone");
    openapiFields.add("sourceType");
    openapiFields.add("status");
    openapiFields.add("submittedOn");
    openapiFields.add("transferredToAccounting");
    openapiFields.add("type");
    openapiFields.add("id");
    openapiFields.add("createdById");
    openapiFields.add("createdDate");
    openapiFields.add("updatedById");
    openapiFields.add("updatedDate");
    openapiFields.add("associatedTransactionNumber");
    openapiFields.add("gateway");
    openapiFields.add("account");
    openapiFields.add("paymentMethod");
    openapiFields.add("refundApplications");

    // 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 ExpandedRefund
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!ExpandedRefund.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in ExpandedRefund is not found in the empty JSON string", ExpandedRefund.openapiRequiredFields.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      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("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("accountingCode") != null && !jsonObj.get("accountingCode").isJsonNull()) && !jsonObj.get("accountingCode").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `accountingCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountingCode").toString()));
      }
      if ((jsonObj.get("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("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString()));
      }
      if ((jsonObj.get("gatewayReconciliationReason") != null && !jsonObj.get("gatewayReconciliationReason").isJsonNull()) && !jsonObj.get("gatewayReconciliationReason").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gatewayReconciliationReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayReconciliationReason").toString()));
      }
      if ((jsonObj.get("gatewayReconciliationStatus") != null && !jsonObj.get("gatewayReconciliationStatus").isJsonNull()) && !jsonObj.get("gatewayReconciliationStatus").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gatewayReconciliationStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gatewayReconciliationStatus").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()));
      }
      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()));
      }
      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("payoutId") != null && !jsonObj.get("payoutId").isJsonNull()) && !jsonObj.get("payoutId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `payoutId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("payoutId").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("refundNumber") != null && !jsonObj.get("refundNumber").isJsonNull()) && !jsonObj.get("refundNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `refundNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refundNumber").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("settledOn") != null && !jsonObj.get("settledOn").isJsonNull()) && !jsonObj.get("settledOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `settledOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("settledOn").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("sourceType") != null && !jsonObj.get("sourceType").isJsonNull()) && !jsonObj.get("sourceType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `sourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceType").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()));
      }
      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("transferredToAccounting") != null && !jsonObj.get("transferredToAccounting").isJsonNull()) && !jsonObj.get("transferredToAccounting").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `transferredToAccounting` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferredToAccounting").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()));
      }
      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("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("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()));
      }
      if ((jsonObj.get("associatedTransactionNumber") != null && !jsonObj.get("associatedTransactionNumber").isJsonNull()) && !jsonObj.get("associatedTransactionNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `associatedTransactionNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("associatedTransactionNumber").toString()));
      }
      if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) && !jsonObj.get("gateway").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gateway").toString()));
      }
      // ensure the optional json data is an array if present
      if (jsonObj.get("refundApplications") != null && !jsonObj.get("refundApplications").isJsonNull() && !jsonObj.get("refundApplications").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `refundApplications` to be an array in the JSON string but got `%s`", jsonObj.get("refundApplications").toString()));
      }
  }

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

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

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





© 2015 - 2025 Weber Informatics LLC | Privacy Policy