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

com.zuora.model.GetPaymentRunSummaryResponse 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.GetPaymentRunSummaryTotalValuesResponse;
import java.io.IOException;
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;

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

  public static final String SERIALIZED_NAME_NUMBER_OF_CREDIT_MEMOS = "numberOfCreditMemos";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_CREDIT_MEMOS)
  private Integer numberOfCreditMemos;

  public static final String SERIALIZED_NAME_NUMBER_OF_DEBIT_MEMOS = "numberOfDebitMemos";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_DEBIT_MEMOS)
  private Integer numberOfDebitMemos;

  public static final String SERIALIZED_NAME_NUMBER_OF_ERROR_INPUT_DATA = "numberOfErrorInputData";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_ERROR_INPUT_DATA)
  private Integer numberOfErrorInputData;

  public static final String SERIALIZED_NAME_NUMBER_OF_ERRORS = "numberOfErrors";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_ERRORS)
  private Integer numberOfErrors;

  public static final String SERIALIZED_NAME_NUMBER_OF_INPUT_DATA = "numberOfInputData";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_INPUT_DATA)
  private Integer numberOfInputData;

  public static final String SERIALIZED_NAME_NUMBER_OF_INVOICES = "numberOfInvoices";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_INVOICES)
  private Integer numberOfInvoices;

  public static final String SERIALIZED_NAME_NUMBER_OF_PAYMENTS = "numberOfPayments";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_PAYMENTS)
  private Integer numberOfPayments;

  public static final String SERIALIZED_NAME_NUMBER_OF_PROCESSED_INPUT_DATA = "numberOfProcessedInputData";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_PROCESSED_INPUT_DATA)
  private Integer numberOfProcessedInputData;

  public static final String SERIALIZED_NAME_NUMBER_OF_RECEIVABLES = "numberOfReceivables";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_RECEIVABLES)
  private Integer numberOfReceivables;

  public static final String SERIALIZED_NAME_NUMBER_OF_UNAPPLIED_PAYMENTS = "numberOfUnappliedPayments";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_UNAPPLIED_PAYMENTS)
  private Integer numberOfUnappliedPayments;

  public static final String SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_DEBIT_MEMOS = "numberOfUnprocessedDebitMemos";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_DEBIT_MEMOS)
  private Integer numberOfUnprocessedDebitMemos;

  public static final String SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_INVOICES = "numberOfUnprocessedInvoices";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_INVOICES)
  private Integer numberOfUnprocessedInvoices;

  public static final String SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_RECEIVABLES = "numberOfUnprocessedReceivables";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_UNPROCESSED_RECEIVABLES)
  private Integer numberOfUnprocessedReceivables;

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

  public static final String SERIALIZED_NAME_TOTAL_VALUES = "totalValues";
  @SerializedName(SERIALIZED_NAME_TOTAL_VALUES)
  private List totalValues;

  public GetPaymentRunSummaryResponse() {
  }

  public GetPaymentRunSummaryResponse numberOfCreditBalanceAdjustments(Integer numberOfCreditBalanceAdjustments) {
    this.numberOfCreditBalanceAdjustments = numberOfCreditBalanceAdjustments;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Credit Balance feature enabled.  The number of credit balance adjustments that are successfully processed in the payment run. 
   * @return numberOfCreditBalanceAdjustments
   */
  @javax.annotation.Nullable
  public Integer getNumberOfCreditBalanceAdjustments() {
    return numberOfCreditBalanceAdjustments;
  }

  public void setNumberOfCreditBalanceAdjustments(Integer numberOfCreditBalanceAdjustments) {
    this.numberOfCreditBalanceAdjustments = numberOfCreditBalanceAdjustments;
  }


  public GetPaymentRunSummaryResponse numberOfCreditMemos(Integer numberOfCreditMemos) {
    this.numberOfCreditMemos = numberOfCreditMemos;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The total number of credit memos that are successfully processed in the payment run. 
   * @return numberOfCreditMemos
   */
  @javax.annotation.Nullable
  public Integer getNumberOfCreditMemos() {
    return numberOfCreditMemos;
  }

  public void setNumberOfCreditMemos(Integer numberOfCreditMemos) {
    this.numberOfCreditMemos = numberOfCreditMemos;
  }


  public GetPaymentRunSummaryResponse numberOfDebitMemos(Integer numberOfDebitMemos) {
    this.numberOfDebitMemos = numberOfDebitMemos;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The total number of debit memos that are picked up for processing in the payment run. 
   * @return numberOfDebitMemos
   */
  @javax.annotation.Nullable
  public Integer getNumberOfDebitMemos() {
    return numberOfDebitMemos;
  }

  public void setNumberOfDebitMemos(Integer numberOfDebitMemos) {
    this.numberOfDebitMemos = numberOfDebitMemos;
  }


  public GetPaymentRunSummaryResponse numberOfErrorInputData(Integer numberOfErrorInputData) {
    this.numberOfErrorInputData = numberOfErrorInputData;
    return this;
  }

  /**
   * The number of input data that are processed with errors. 
   * @return numberOfErrorInputData
   */
  @javax.annotation.Nullable
  public Integer getNumberOfErrorInputData() {
    return numberOfErrorInputData;
  }

  public void setNumberOfErrorInputData(Integer numberOfErrorInputData) {
    this.numberOfErrorInputData = numberOfErrorInputData;
  }


  public GetPaymentRunSummaryResponse numberOfErrors(Integer numberOfErrors) {
    this.numberOfErrors = numberOfErrors;
    return this;
  }

  /**
   * The number of payments with the status of `Error` and `Processing`. 
   * @return numberOfErrors
   */
  @javax.annotation.Nullable
  public Integer getNumberOfErrors() {
    return numberOfErrors;
  }

  public void setNumberOfErrors(Integer numberOfErrors) {
    this.numberOfErrors = numberOfErrors;
  }


  public GetPaymentRunSummaryResponse numberOfInputData(Integer numberOfInputData) {
    this.numberOfInputData = numberOfInputData;
    return this;
  }

  /**
   * The total number of input data. 
   * @return numberOfInputData
   */
  @javax.annotation.Nullable
  public Integer getNumberOfInputData() {
    return numberOfInputData;
  }

  public void setNumberOfInputData(Integer numberOfInputData) {
    this.numberOfInputData = numberOfInputData;
  }


  public GetPaymentRunSummaryResponse numberOfInvoices(Integer numberOfInvoices) {
    this.numberOfInvoices = numberOfInvoices;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The total number of invoices that are picked up for processing in the payment run. 
   * @return numberOfInvoices
   */
  @javax.annotation.Nullable
  public Integer getNumberOfInvoices() {
    return numberOfInvoices;
  }

  public void setNumberOfInvoices(Integer numberOfInvoices) {
    this.numberOfInvoices = numberOfInvoices;
  }


  public GetPaymentRunSummaryResponse numberOfPayments(Integer numberOfPayments) {
    this.numberOfPayments = numberOfPayments;
    return this;
  }

  /**
   * The number of payments that are successfully processed in the payment run. 
   * @return numberOfPayments
   */
  @javax.annotation.Nullable
  public Integer getNumberOfPayments() {
    return numberOfPayments;
  }

  public void setNumberOfPayments(Integer numberOfPayments) {
    this.numberOfPayments = numberOfPayments;
  }


  public GetPaymentRunSummaryResponse numberOfProcessedInputData(Integer numberOfProcessedInputData) {
    this.numberOfProcessedInputData = numberOfProcessedInputData;
    return this;
  }

  /**
   * The number of input data that are successfully processed. 
   * @return numberOfProcessedInputData
   */
  @javax.annotation.Nullable
  public Integer getNumberOfProcessedInputData() {
    return numberOfProcessedInputData;
  }

  public void setNumberOfProcessedInputData(Integer numberOfProcessedInputData) {
    this.numberOfProcessedInputData = numberOfProcessedInputData;
  }


  public GetPaymentRunSummaryResponse numberOfReceivables(Integer numberOfReceivables) {
    this.numberOfReceivables = numberOfReceivables;
    return this;
  }

  /**
   * The total number of receivables that are picked up for processing in the payment run.  The value of this field is the sum of the value of the `numberOfInvoices` field and that of the `numberOfDebitMemos` field. 
   * @return numberOfReceivables
   */
  @javax.annotation.Nullable
  public Integer getNumberOfReceivables() {
    return numberOfReceivables;
  }

  public void setNumberOfReceivables(Integer numberOfReceivables) {
    this.numberOfReceivables = numberOfReceivables;
  }


  public GetPaymentRunSummaryResponse numberOfUnappliedPayments(Integer numberOfUnappliedPayments) {
    this.numberOfUnappliedPayments = numberOfUnappliedPayments;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The number of unapplied payments that are successfully processed in the payment run. 
   * @return numberOfUnappliedPayments
   */
  @javax.annotation.Nullable
  public Integer getNumberOfUnappliedPayments() {
    return numberOfUnappliedPayments;
  }

  public void setNumberOfUnappliedPayments(Integer numberOfUnappliedPayments) {
    this.numberOfUnappliedPayments = numberOfUnappliedPayments;
  }


  public GetPaymentRunSummaryResponse numberOfUnprocessedDebitMemos(Integer numberOfUnprocessedDebitMemos) {
    this.numberOfUnprocessedDebitMemos = numberOfUnprocessedDebitMemos;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The number of debit memos with remaining positive balances after the payment run is completed. 
   * @return numberOfUnprocessedDebitMemos
   */
  @javax.annotation.Nullable
  public Integer getNumberOfUnprocessedDebitMemos() {
    return numberOfUnprocessedDebitMemos;
  }

  public void setNumberOfUnprocessedDebitMemos(Integer numberOfUnprocessedDebitMemos) {
    this.numberOfUnprocessedDebitMemos = numberOfUnprocessedDebitMemos;
  }


  public GetPaymentRunSummaryResponse numberOfUnprocessedInvoices(Integer numberOfUnprocessedInvoices) {
    this.numberOfUnprocessedInvoices = numberOfUnprocessedInvoices;
    return this;
  }

  /**
   * **Note:** This field is only available if you have the Invoice Settlement feature enabled.  The number of invoices with remaining positive balances after the payment run is completed. 
   * @return numberOfUnprocessedInvoices
   */
  @javax.annotation.Nullable
  public Integer getNumberOfUnprocessedInvoices() {
    return numberOfUnprocessedInvoices;
  }

  public void setNumberOfUnprocessedInvoices(Integer numberOfUnprocessedInvoices) {
    this.numberOfUnprocessedInvoices = numberOfUnprocessedInvoices;
  }


  public GetPaymentRunSummaryResponse numberOfUnprocessedReceivables(Integer numberOfUnprocessedReceivables) {
    this.numberOfUnprocessedReceivables = numberOfUnprocessedReceivables;
    return this;
  }

  /**
   * The number of receivables with remaining positive balances after the payment run is completed. 
   * @return numberOfUnprocessedReceivables
   */
  @javax.annotation.Nullable
  public Integer getNumberOfUnprocessedReceivables() {
    return numberOfUnprocessedReceivables;
  }

  public void setNumberOfUnprocessedReceivables(Integer numberOfUnprocessedReceivables) {
    this.numberOfUnprocessedReceivables = numberOfUnprocessedReceivables;
  }


  public GetPaymentRunSummaryResponse 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 GetPaymentRunSummaryResponse totalValues(List totalValues) {
    this.totalValues = totalValues;
    return this;
  }

  public GetPaymentRunSummaryResponse addTotalValuesItem(GetPaymentRunSummaryTotalValuesResponse totalValuesItem) {
    if (this.totalValues == null) {
      this.totalValues = new ArrayList<>();
    }
    this.totalValues.add(totalValuesItem);
    return this;
  }

  /**
   * Container for total values. 
   * @return totalValues
   */
  @javax.annotation.Nullable
  public List getTotalValues() {
    return totalValues;
  }

  public void setTotalValues(List totalValues) {
    this.totalValues = totalValues;
  }

  /**
   * 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 GetPaymentRunSummaryResponse instance itself
   */
  public GetPaymentRunSummaryResponse 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;
    }
    GetPaymentRunSummaryResponse getPaymentRunSummaryResponse = (GetPaymentRunSummaryResponse) o;
    return Objects.equals(this.numberOfCreditBalanceAdjustments, getPaymentRunSummaryResponse.numberOfCreditBalanceAdjustments) &&
        Objects.equals(this.numberOfCreditMemos, getPaymentRunSummaryResponse.numberOfCreditMemos) &&
        Objects.equals(this.numberOfDebitMemos, getPaymentRunSummaryResponse.numberOfDebitMemos) &&
        Objects.equals(this.numberOfErrorInputData, getPaymentRunSummaryResponse.numberOfErrorInputData) &&
        Objects.equals(this.numberOfErrors, getPaymentRunSummaryResponse.numberOfErrors) &&
        Objects.equals(this.numberOfInputData, getPaymentRunSummaryResponse.numberOfInputData) &&
        Objects.equals(this.numberOfInvoices, getPaymentRunSummaryResponse.numberOfInvoices) &&
        Objects.equals(this.numberOfPayments, getPaymentRunSummaryResponse.numberOfPayments) &&
        Objects.equals(this.numberOfProcessedInputData, getPaymentRunSummaryResponse.numberOfProcessedInputData) &&
        Objects.equals(this.numberOfReceivables, getPaymentRunSummaryResponse.numberOfReceivables) &&
        Objects.equals(this.numberOfUnappliedPayments, getPaymentRunSummaryResponse.numberOfUnappliedPayments) &&
        Objects.equals(this.numberOfUnprocessedDebitMemos, getPaymentRunSummaryResponse.numberOfUnprocessedDebitMemos) &&
        Objects.equals(this.numberOfUnprocessedInvoices, getPaymentRunSummaryResponse.numberOfUnprocessedInvoices) &&
        Objects.equals(this.numberOfUnprocessedReceivables, getPaymentRunSummaryResponse.numberOfUnprocessedReceivables) &&
        Objects.equals(this.success, getPaymentRunSummaryResponse.success) &&
        Objects.equals(this.totalValues, getPaymentRunSummaryResponse.totalValues)&&
        Objects.equals(this.additionalProperties, getPaymentRunSummaryResponse.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(numberOfCreditBalanceAdjustments, numberOfCreditMemos, numberOfDebitMemos, numberOfErrorInputData, numberOfErrors, numberOfInputData, numberOfInvoices, numberOfPayments, numberOfProcessedInputData, numberOfReceivables, numberOfUnappliedPayments, numberOfUnprocessedDebitMemos, numberOfUnprocessedInvoices, numberOfUnprocessedReceivables, success, totalValues, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class GetPaymentRunSummaryResponse {\n");
    sb.append("    numberOfCreditBalanceAdjustments: ").append(toIndentedString(numberOfCreditBalanceAdjustments)).append("\n");
    sb.append("    numberOfCreditMemos: ").append(toIndentedString(numberOfCreditMemos)).append("\n");
    sb.append("    numberOfDebitMemos: ").append(toIndentedString(numberOfDebitMemos)).append("\n");
    sb.append("    numberOfErrorInputData: ").append(toIndentedString(numberOfErrorInputData)).append("\n");
    sb.append("    numberOfErrors: ").append(toIndentedString(numberOfErrors)).append("\n");
    sb.append("    numberOfInputData: ").append(toIndentedString(numberOfInputData)).append("\n");
    sb.append("    numberOfInvoices: ").append(toIndentedString(numberOfInvoices)).append("\n");
    sb.append("    numberOfPayments: ").append(toIndentedString(numberOfPayments)).append("\n");
    sb.append("    numberOfProcessedInputData: ").append(toIndentedString(numberOfProcessedInputData)).append("\n");
    sb.append("    numberOfReceivables: ").append(toIndentedString(numberOfReceivables)).append("\n");
    sb.append("    numberOfUnappliedPayments: ").append(toIndentedString(numberOfUnappliedPayments)).append("\n");
    sb.append("    numberOfUnprocessedDebitMemos: ").append(toIndentedString(numberOfUnprocessedDebitMemos)).append("\n");
    sb.append("    numberOfUnprocessedInvoices: ").append(toIndentedString(numberOfUnprocessedInvoices)).append("\n");
    sb.append("    numberOfUnprocessedReceivables: ").append(toIndentedString(numberOfUnprocessedReceivables)).append("\n");
    sb.append("    success: ").append(toIndentedString(success)).append("\n");
    sb.append("    totalValues: ").append(toIndentedString(totalValues)).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("numberOfCreditBalanceAdjustments");
    openapiFields.add("numberOfCreditMemos");
    openapiFields.add("numberOfDebitMemos");
    openapiFields.add("numberOfErrorInputData");
    openapiFields.add("numberOfErrors");
    openapiFields.add("numberOfInputData");
    openapiFields.add("numberOfInvoices");
    openapiFields.add("numberOfPayments");
    openapiFields.add("numberOfProcessedInputData");
    openapiFields.add("numberOfReceivables");
    openapiFields.add("numberOfUnappliedPayments");
    openapiFields.add("numberOfUnprocessedDebitMemos");
    openapiFields.add("numberOfUnprocessedInvoices");
    openapiFields.add("numberOfUnprocessedReceivables");
    openapiFields.add("success");
    openapiFields.add("totalValues");

    // 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 GetPaymentRunSummaryResponse
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!GetPaymentRunSummaryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in GetPaymentRunSummaryResponse is not found in the empty JSON string", GetPaymentRunSummaryResponse.openapiRequiredFields.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if (jsonObj.get("totalValues") != null && !jsonObj.get("totalValues").isJsonNull()) {
        JsonArray jsonArraytotalValues = jsonObj.getAsJsonArray("totalValues");
        if (jsonArraytotalValues != null) {
          // ensure the json data is an array
          if (!jsonObj.get("totalValues").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `totalValues` to be an array in the JSON string but got `%s`", jsonObj.get("totalValues").toString()));
          }

          // validate the optional field `totalValues` (array)
          for (int i = 0; i < jsonArraytotalValues.size(); i++) {
            GetPaymentRunSummaryTotalValuesResponse.validateJsonElement(jsonArraytotalValues.get(i));
          };
        }
      }
  }

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

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

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





© 2015 - 2025 Weber Informatics LLC | Privacy Policy