Class AbstractReply

java.lang.Object
com.akraml.satim.reply.AbstractReply
Direct Known Subclasses:
OrderConfirmationReply, OrderStatusReply, PaymentReply, RefundReply

public abstract class AbstractReply extends Object
Base class for all API response types.
  • Constructor Details

    • AbstractReply

      protected AbstractReply(boolean success, int errorCode, @Nullable @Nullable String errorMessage, @NotNull @NotNull com.google.gson.JsonObject rawResponse)
      Constructs a new AbstractReply.
      Parameters:
      success - whether the API call was successful
      errorCode - the error code (0 if successful)
      errorMessage - the error message (null if successful)
      rawResponse - the raw JSON response
  • Method Details

    • isSuccessful

      public boolean isSuccessful()
      Returns whether the API call was successful.
      Returns:
      true if successful, false otherwise
    • getErrorCode

      public int getErrorCode()
      Returns the error code from the response.
      Returns:
      the error code, or 0 if successful
    • getErrorMessage

      @Nullable public @Nullable String getErrorMessage()
      Returns the error message from the response.
      Returns:
      the error message, or null if successful
    • getRawResponse

      @NotNull public @NotNull com.google.gson.JsonObject getRawResponse()
      Returns the raw JSON response.

      This can be used to access fields not directly exposed by the reply class.

      Returns:
      the raw JSON response object
    • getResponse

      @NotNull public @NotNull String getResponse()
      Returns the full response as a JSON string.
      Returns:
      JSON string representation of the response
    • toString

      public String toString()
      Overrides:
      toString in class Object