package com.eactive.eai.custom.adapter.http.client.impl.filter;

import java.util.Properties;

import com.eactive.eai.adapter.http.client.impl.filter.HttpClientAdapterFilter;
import com.eactive.eai.adapter.http.client.impl.filter.OutCryptoFilter;
/**
 * 제주은행 Open API 기본 암복호화 필더
 */
public class EncFieldOutCryptoFilter implements HttpClientAdapterFilter {

	private final OutCryptoFilter filter = new OutCryptoFilter();

	protected Properties setProp(Properties p) {
		p.setProperty(OutCryptoFilter.PROP_DEC_FROM_PATH, "/encryptedData");
		p.setProperty(OutCryptoFilter.PROP_ENC_TO_PATH, "/encryptedData");
		return p;
	}

	@Override
	public Object doPreFilter(String adptGrpName, String adptName, Properties prop, Object message, Properties tempProp)
			throws Exception {
		return filter.doPreFilter(adptGrpName, adptName, prop, message, setProp(tempProp));
	}

	@Override
	public Object doPostFilter(String adptGrpName, String adptName, Properties prop, Object message,
			Properties tempProp) throws Exception {
		return filter.doPostFilter(adptGrpName, adptName, prop, message, setProp(tempProp));
	}
}
