cl.transbank.onepay.ApiBaseResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transbank-sdk-java Show documentation
Show all versions of transbank-sdk-java Show documentation
Tranbank API integration SDK for Java Projects
package cl.transbank.onepay;
import cl.transbank.onepay.util.*;
import cl.transbank.util.HttpUtil;
import cl.transbank.util.HttpUtilImpl;
import cl.transbank.util.JsonUtil;
import cl.transbank.util.JsonUtilImpl;
import cl.transbank.webpay.exception.TransbankHttpApiException;
import lombok.NonNull;
import java.io.IOException;
import java.net.URL;
public abstract class ApiBaseResource {
private static RequestBuilder requestBuilder = OnepayRequestBuilder.getInstance();
private static JsonUtil jsonUtil = JsonUtilImpl.getInstance();
private static SignUtil signUtil = OnepaySignUtil.getInstance();
private static HttpUtil httpUtil = HttpUtilImpl.getInstance();
protected static RequestBuilder getRequestBuilder() {
return requestBuilder;
}
public static void setRequestBuilder(RequestBuilder requestBuilder) {
ApiBaseResource.requestBuilder = requestBuilder;
}
protected static JsonUtil getJsonUtil() {
return jsonUtil;
}
public static void setJsonUtil(JsonUtil jsonUtil) {
ApiBaseResource.jsonUtil = jsonUtil;
}
protected static SignUtil getSignUtil() {
return signUtil;
}
public static void setSignUtil(SignUtil signUtil) {
ApiBaseResource.signUtil = signUtil;
}
protected static HttpUtil getHttpUtil() {
return httpUtil;
}
public static void setHttpUtil(HttpUtil httpUtil) {
ApiBaseResource.httpUtil = httpUtil;
}
protected static String request(@NonNull URL url, HttpUtilImpl.RequestMethod method, @NonNull String query)
throws IOException, TransbankHttpApiException {
return getHttpUtil().request(url, method, query);
}
public String request(@NonNull URL url, HttpUtilImpl.RequestMethod method, @NonNull String query,
HttpUtil.ContentType contentType) throws IOException, TransbankHttpApiException {
return getHttpUtil().request(url, method, query, contentType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy