| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.http.HttpStatus; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | /** |
| | | * UDUN API Gateway |
| | | */ |
| | | private final String gateway = "https://sig11.udun.io"; |
| | | private final String gateway = "https://sig10.udun.io"; |
| | | |
| | | /** |
| | | * UDUN Merchant Key |
| | | */ |
| | | private final String merchantKey = "7161e42ff45204dca8b9c4e203b24f63"; |
| | | private final String merchantKey = "ced10252df2ffad4e9d3059924ece9b0"; |
| | | |
| | | /** |
| | | * UDUN Merchant Number |
| | | */ |
| | | private final String merchantId = "321176"; |
| | | private final String merchantId = "322571"; |
| | | |
| | | /** |
| | | * Callback 充值 |
| | | */ |
| | | private final String defaultCallBackUrl = "https://api.stakecube-pro.com/api/channelBlockchain!rechargeCallback.action"; |
| | | private final String defaultCallBackUrl = Constants.API_HTTP + "api/channelBlockchain!rechargeCallback.action"; |
| | | |
| | | /** |
| | | * Callback 提币 |
| | | */ |
| | | private final String withdrawCallBackUrl = "https://api.stakecube-pro.com/api/withdraw/withdrawCallback.action"; |
| | | private final String withdrawCallBackUrl = Constants.API_HTTP + "api/withdraw/withdrawCallback.action"; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return JSONUtil.toList(JSONUtil.parseArray(result.getData()), Coin.class); |
| | | } |
| | | |
| | | public boolean checkSign(String timestamp, String nonce, String body, String sign) { |
| | | String checkSign = UdunUtils.sign(merchantKey, timestamp, nonce, body); |
| | | return checkSign.equals(sign); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("merchantId", 322571); |
| | | params.put("showBalance", false); |
| | | ResultMsg result = JSONUtil.toBean(UdunUtils.post("https://sig10.udun.io", "ced10252df2ffad4e9d3059924ece9b0", ApiPath.SUPPORT_COIN, JSONUtil.toJsonStr(params)), ResultMsg.class); |
| | | if (result.getCode() != HttpStatus.HTTP_OK) { |
| | | Console.error(JSONUtil.toJsonStr(result)); |
| | | } |
| | | List<Coin> coinList = JSONUtil.toList(JSONUtil.parseArray(result.getData()), Coin.class); |
| | | System.out.println(coinList); |
| | | } |
| | | } |