/** * 异步资产发放 * * @param currentString 随机字符串,不长于32位 * @param accPwd 资产转出方的账户密码 * @param tradeNo 开发者内部的凭据号,如:2015121822992 * @param assetCode 资产CODE,转出方给转入方转让的资产标识(全网唯一) * @param assetAmount 资产转移数量,参数不带小数点 * @param fromBubiId 资产转出方布比账号地址 * @param toBubiId 资产转入方布比账号地址 * @param assetDetails 资产明细 * @param metadata 扩展字段 * @return * @throws Exception */ public String grantAssetAsync( String currentString, String accPwd, String tradeNo, String assetCode, String assetAmount, String fromBubiId, String toBubiId, List<Detail> assetDetails, String metadata) throws Exception { String url = Constants.ASSET_GRANT_ASYNC_URL + "?access_token=" + access_token; Map<String, Object> sParaTemp = new HashMap<String, Object>(); sParaTemp.put("current_string", currentString); sParaTemp.put("trade_no", tradeNo); sParaTemp.put("asset_code", assetCode); sParaTemp.put("asset_amount", assetAmount); sParaTemp.put("from_bubi_address", fromBubiId); sParaTemp.put("to_bubi_address", toBubiId); // [必填]签名,签名原理详见API文档中的"签名算法" sParaTemp.put("sign", Tools.buildRequestMySign(sParaTemp)); sParaTemp.put("password", accPwd); sParaTemp.put("details", assetDetails); sParaTemp.put("metadata", metadata); return HttpKit.post(url, JSON.toJSONString(sParaTemp)); }
/** * 消费者资产转移接口 * * @param currentString 随机字符串,不长于32位 * @param redirectUri 回调地址 * @param tradeNo 开发者内部的凭据号,如:2015121822992 * @param assetName 资产名称,带中文,请用utf-8进行url解码 * @param assetUnit 资产单位,带中文,请用utf-8进行url解码 * @param assetCode 资产CODE,转出方给转入方转让的资产标识(全网唯一) * @param assetAmount 资产转移数量,参数不带小数点 * @param fromBubiId 资产转出方布比账号地址 * @param toBubiId 资产转入方布比账号地址 * @param body 资产描述或交易摘要,不长于50位(可选项) * @return * @throws Exception */ public void consumerSend( String currentString, String redirectUri, String tradeNo, String assetName, String assetUnit, String assetCode, String assetAmount, String fromBubiId, String toBubiId, String body) throws Exception { Map<String, Object> sParaTemp = new HashMap<String, Object>(); sParaTemp.put("current_string", currentString); sParaTemp.put("trade_no", tradeNo); sParaTemp.put("asset_code", assetCode); sParaTemp.put("asset_amount", assetAmount); sParaTemp.put("from_bubi_address", fromBubiId); sParaTemp.put("to_bubi_address", toBubiId); // [必填]签名 ,签名原理详见API文档中的"签名算法" String sign = Tools.buildRequestMySign(sParaTemp); String url = Constants.Consumer_ASSET_SEND_URL + "?access_token=" + access_token + "¤t_string=" + currentString + "&body=" + body + "&trade_no=" + tradeNo + "&asset_name=" + assetName + "&asset_unit=" + assetUnit + "&asset_code=" + assetCode + "&asset_amount=" + assetAmount + "&from_bubi_address=" + fromBubiId + "&to_bubi_address=" + toBubiId + "&sign=" + sign + "&redirect_uri=" + redirectUri; System.out.println(url); try { Tools.browse(url); } catch (Exception e) { e.printStackTrace(); } }