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

com.payu.sdk.api.util.ResponseUtils Maven / Gradle / Ivy

The newest version!
package com.payu.sdk.api.util;

import com.payu.sdk.api.exceptions.PayUException;
import com.payu.sdk.api.exceptions.SDKException;
import com.payu.sdk.api.model.response.Response;
import com.payu.sdk.api.model.response.ResponseCode;
import com.payu.sdk.base.Preconditions;

public final class ResponseUtils {

  private ResponseUtils() {
  }

  public static void validateResponse(Response response) throws PayUException {
    if (!Preconditions.isNull(response)) {
      if (!Preconditions.isNull(response.getCode())) {
        if (ResponseCode.ERROR.equals(response.getCode())) {
          throw new PayUException(SDKException.ErrorCode.API_ERROR, response.getError());
        }
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy