从微信查询订单状况一般步骤
1建立订单查询对象
2设置公共账号id,商户号等信息
3把订单转换成xml
// 转换成xml
XStream xs = XStreamFactory.init(false);
xs.ignoreUnknownElements();
xs.autodetectAnnotations(true);
xs.alias("xml", PayMessage.class);
String sendXml = xs.toXML(order);
4发送xml到微信请求
String backxml = HttpKit.post(WECHATPAY_QUERY_URL, sendXml); //是上一篇的类中的函数
5 把返回值转换成对象保存到本地db
if (StringUtils.isNotBlank(backxml)) {
back = (PayMessage) xs.fromXML(backxml);
// 保存返回的日志
backlog = new WeChatPayLog();
backlog.setChlCd(Constant.SYSTEM_WECHAT_PAY);
backlog.setLogType(Constant.WECHATPAY_QUERY_ORDER_RESULT);
backlog.setRegiId(Constant.SYSTEM_DIST);
backlog.setXmlVal(backxml);
backlog.setRemark("query order back xml");
backlog.setOurTradNo(out_trade_no);
saveWeChatPayLog(backlog);
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/750077/viewspace-2108808/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/750077/viewspace-2108808/