public static String wxCloseOrder(Order o) { Map<String, Object> map = new HashMap<String, Object>(); map.put("appid", Constant.W_APP_ID); map.put("mch_id", Constant.W_MCH_ID); map.put("nonce_str", Constant.wxRandomString()); map.put("out_trade_no", String.format("%032d", o.getOrderId())); String sign = Constant.wxSign(map); map.put("sign", sign); return Json.xml2json( Web.sendPost( Constant.W_CLOSE_ORDER_URL, new HashMap<String, String>(), Json.json2xml(map))); }
public static String wxUnifiedorder(Order o, String openId, String userIp) { Map<String, Object> map = new HashMap<String, Object>(); map.put("appid", Constant.W_APP_ID); map.put("mch_id", Constant.W_MCH_ID); map.put("nonce_str", Constant.wxRandomString()); map.put("body", "夕食餐饮订单"); map.put("out_trade_no", String.format("%032d", o.getOrderId())); map.put("total_fee", (int) o.getTotalPrice() * 100); System.out.println(map.get("total_fee")); map.put("spbill_create_ip", userIp); map.put("notify_url", Constant.W_PAY_NOTIFY_URL); map.put("trade_type", "JSAPI"); map.put("openid", openId); String sign = Constant.wxSign(map); map.put("sign", sign); return Json.xml2json( Web.sendPost( Constant.W_UNIFIED_ORDER_URL, new HashMap<String, String>(), Json.json2xml(map))); }