Package si.mazi.rescu

Examples of si.mazi.rescu.Params


  }

  @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("secret_key", secretKey);

    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();

    try {
      md.reset();

      byte[] digest = md.digest(message.getBytes("UTF-8"));
View Full Code Here


  }

  @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"));
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public String digestParams(RestInvocation restInvocation) {

    Params params = restInvocation.getParamsMap().get(FormParam.class);
    Map<String, String> nameValues = params.asHttpHeaders();
    nameValues.remove("signature");

    Params newParams = Params.of();
    for (Map.Entry<String, String> nameValue : nameValues.entrySet()) {
      newParams.add(nameValue.getKey(), nameValue.getValue());
    }

    String message = newParams.asQueryString();

    Mac mac = getMac();
    mac.update(message.getBytes());

    return String.format("%064x", new BigInteger(1, mac.doFinal()));
View Full Code Here

TOP

Related Classes of si.mazi.rescu.Params

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.