}
@Override
public String digestParams(RestInvocation restInvocation) {
final Params params = restInvocation.getParamsMap().get(FormParam.class);
final Map<String, String> nameValueMap = params.asHttpHeaders();
nameValueMap.remove("sign");
nameValueMap.put("partner", partner);
// odd requirements for buy/sell market orders
if (nameValueMap.containsKey("type") && nameValueMap.get("type").contains("market")) {
if (nameValueMap.get("type").equals("buy_market")) {
nameValueMap.remove("amount");
}
else if (nameValueMap.get("type").equals("sell_market")) {
nameValueMap.remove("rate");
}
}
final List<Map.Entry<String, String>> nameValueList = new ArrayList<Map.Entry<String, String>>(nameValueMap.entrySet());
Collections.sort(nameValueList, comparator);
final Params newParams = Params.of();
for (int i = 0; i < nameValueList.size(); i++) {
Map.Entry<String, String> param = nameValueList.get(i);
newParams.add(param.getKey(), param.getValue());
}
final String message = newParams.asQueryString() + secretKey;
try {
md.reset();
byte[] digest = md.digest(message.getBytes("UTF-8"));