// Path: src/main/java/com/wepay/model/data/HeaderData.java
// public class HeaderData {
//     public String accessToken;
//     public String riskToken;
//     public String clientIP;
// }
// 
// Path: src/main/java/com/wepay/exception/WePayException.java
// public class WePayException extends Exception {
// 
// 	private class ErrorDetail {
// 		private List<String> target;
// 		private String targetType;
// 		private String reasonCode;
// 		private String message;
// 
// 		public List<String> getTarget() {
// 		    return target;
// 		}
// 
// 		public String getTargetType() {
// 		    return targetType;
// 		}
// 
// 		public String getReasonCode() {
// 		    return reasonCode;
// 		}
// 
// 		public String getMessage() {
// 		    return message;
// 		}
// 
// 	}
// 
// 	private String error;
// 	private String errorDescription;
// 	private Integer errorCode;
// 	private List<ErrorDetail> details;
// 	private String documentationUrl;
// 
// 	public WePayException(String message) {
// 		super(message);
// 	}
// 
// 	public WePayException(String message, Throwable throwable) {
// 		super(message, throwable);
// 	}
// 
// 	public String getError() {
// 		return error;
// 	}
// 
// 	public String getErrorDescription() {
// 		return errorDescription;
// 	}
// 
// 	public Integer getErrorCode() {
// 		return errorCode;
// 	}
// 
// 	public List<ErrorDetail> getDetails() {
// 	    return details;
// 	}
// 
// 	public String getDocumentationUrl() {
// 		return documentationUrl;
// 	}
// 
// 	public String getMessage() {
// 		return WePayResource.gson.toJson(this);
// 	}
// 
// }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import javax.net.ssl.HttpsURLConnection;
import com.google.gson.JsonSyntaxException;
import com.wepay.model.data.HeaderData;
import org.json.JSONObject;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.wepay.exception.WePayException;
import com.wepay.model.data.deserialization.WepayExclusionStrategy;
package com.wepay.net;






public class WePayResource {

	public static final int defaultConnectionTimeoutSecs = 30;
	public static final int defaultReadTimeoutSecs = 120;

	public static String apiEndpoint;
	public static String uiEndpoint;
	protected final static String STAGE_API_ENDPOINT = "https://stage.wepayapi.com/v2";
	protected final static String STAGE_UI_ENDPOINT = "https://stage.wepay.com/v2";
	protected final static String PRODUCTION_API_ENDPOINT = "https://wepayapi.com/v2";
	protected final static String PRODUCTION_UI_ENDPOINT = "https://www.wepay.com/v2";
	
	public static final Gson gson = new GsonBuilder()
			.addDeserializationExclusionStrategy(new WepayExclusionStrategy())
			.setPrettyPrinting()
			.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
			.create();

	public static void initializeWePayResource(Boolean useStageEnv) {
		if (useStageEnv) {
			apiEndpoint = STAGE_API_ENDPOINT;
			uiEndpoint = STAGE_UI_ENDPOINT;
		} else {
			apiEndpoint = PRODUCTION_API_ENDPOINT;
			uiEndpoint = PRODUCTION_UI_ENDPOINT;
		}
	}

// Path: src/main/java/com/wepay/model/data/HeaderData.java
// public class HeaderData {
//     public String accessToken;
//     public String riskToken;
//     public String clientIP;
// }
// 
// Path: src/main/java/com/wepay/exception/WePayException.java
// public class WePayException extends Exception {
// 
// 	private class ErrorDetail {
// 		private List<String> target;
// 		private String targetType;
// 		private String reasonCode;
// 		private String message;
// 
// 		public List<String> getTarget() {
// 		    return target;
// 		}
// 
// 		public String getTargetType() {
// 		    return targetType;
// 		}
// 
// 		public String getReasonCode() {
// 		    return reasonCode;
// 		}
// 
// 		public String getMessage() {
// 		    return message;
// 		}
// 
// 	}
// 
// 	private String error;
// 	private String errorDescription;
// 	private Integer errorCode;
// 	private List<ErrorDetail> details;
// 	private String documentationUrl;
// 
// 	public WePayException(String message) {
// 		super(message);
// 	}
// 
// 	public WePayException(String message, Throwable throwable) {
// 		super(message, throwable);
// 	}
// 
// 	public String getError() {
// 		return error;
// 	}
// 
// 	public String getErrorDescription() {
// 		return errorDescription;
// 	}
// 
// 	public Integer getErrorCode() {
// 		return errorCode;
// 	}
// 
// 	public List<ErrorDetail> getDetails() {
// 	    return details;
// 	}
// 
// 	public String getDocumentationUrl() {
// 		return documentationUrl;
// 	}
// 
// 	public String getMessage() {
// 		return WePayResource.gson.toJson(this);
// 	}
// 
// }


// Path: src/main/java/com/wepay/net/WePayResource.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import javax.net.ssl.HttpsURLConnection;
import com.google.gson.JsonSyntaxException;
import com.wepay.model.data.HeaderData;
import org.json.JSONObject;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.wepay.exception.WePayException;
import com.wepay.model.data.deserialization.WepayExclusionStrategy;

package com.wepay.net;






public class WePayResource {

	public static final int defaultConnectionTimeoutSecs = 30;
	public static final int defaultReadTimeoutSecs = 120;

	public static String apiEndpoint;
	public static String uiEndpoint;
	protected final static String STAGE_API_ENDPOINT = "https://stage.wepayapi.com/v2";
	protected final static String STAGE_UI_ENDPOINT = "https://stage.wepay.com/v2";
	protected final static String PRODUCTION_API_ENDPOINT = "https://wepayapi.com/v2";
	protected final static String PRODUCTION_UI_ENDPOINT = "https://www.wepay.com/v2";
	
	public static final Gson gson = new GsonBuilder()
			.addDeserializationExclusionStrategy(new WepayExclusionStrategy())
			.setPrettyPrinting()
			.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
			.create();

	public static void initializeWePayResource(Boolean useStageEnv) {
		if (useStageEnv) {
			apiEndpoint = STAGE_API_ENDPOINT;
			uiEndpoint = STAGE_UI_ENDPOINT;
		} else {
			apiEndpoint = PRODUCTION_API_ENDPOINT;
			uiEndpoint = PRODUCTION_UI_ENDPOINT;
		}
	}

	protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, HeaderData headerData) throws IOException {