HF支付示例

	public static void main(String[] args) throws UnsupportedEncodingException {
	/*	StringBuilder signSb = new StringBuilder("fxid=xxxxx");
		String currentDate14 = DateUtil.getCurrentDate14();
		signSb.append("&fxddh=" + currentDate14);
		signSb.append("&fxdesc=" + URLEncoder.encode("bbb", "utf8"));
		signSb.append("&fxfee=0.01"); // 支付方式
		signSb.append("&fxnotifyurl=https://www.hao123.com");
		signSb.append("&fxbackurl=https://www.baidu.com");
		signSb.append("&fxpay=jdwap");
		signSb.append("&fxsign=" + MD5Utils.string2MD5(
				"2018108" + currentDate14 + "0.01" + "https://www.hao123.com" + "hNGvhjDZSuTEZAnbVXWvIkkgYRUResWw"));
		signSb.append("&fxip=113.246.154.152");
		String requestUrl = "http://api.147258.xyz/Pay/";
		System.out.println("请求的URL" + requestUrl + "?" + signSb.toString());
		System.out.println("请求的参数" + signSb.toString());
		String result = RequestUtils.sendGet(requestUrl + "?" + signSb.toString(), null);
		JSONObject respMap = JSONObject.fromObject(result);
		System.out.println(respMap);
		System.out.println("下单成功返回的ID" + respMap.get("orderid"));
		System.out.println("下单成功返回的状态" + respMap.get("status"));
		System.out.println("调用弹出的支付界面" + respMap.get("payurl"));
		System.out.println("调用弹出的支付界面" + respMap.get("cpid"));*/

		/*
		  TreeMap<String, String> params = new TreeMap<>(); params.put("fxid",
		  HFConstants.HF_Pay_fxid); params.put("fxddh", "2018417094430");
		  params.put("fxaction", "orderquery");
 // 数字签名 签名【md5(商务号+商户订单号+商户查询动作+商户秘钥)】
		  String string2md5 = MD5Utils .string2MD5(HFConstants.HF_Pay_fxid +
		  "2018417094430" + "orderquery"
		  +ConfigConstants.getPayValue(HFConstants.KEY_HF_Pay_Thekey));
		  params.put("fxsign", "" + string2md5); String payQuery =
		  ConfigConstants.getPayValue(HFConstants.KEY_HF_Pay_requestUrl);
		  System.out.println("请求地址:" + payQuery); 
          System.out.println("请求参数:" +params);
		  String response = RequestUtils.doPostHttp(payQuery, params, "utf-8");
		  System.out.println(response);
		  JSONObject responseJson = JSONObject.fromObject(response);
		  System.out.println(responseJson.get("fxstatus"));
		  System.out.println(responseJson.get("fxddh"));
		  System.out.println(responseJson.get("fxorder"));
		 */
	}

猜你喜欢

转载自my.oschina.net/u/3784129/blog/1796861