对相应数据进行判断,及时抛出异常

This commit is contained in:
Binary Wang 2016-09-25 00:35:19 +08:00
parent b13d3c9e6d
commit e70c539465

View File

@ -439,7 +439,13 @@ public class WxMpPayServiceImpl implements WxMpPayService {
} }
String responseContent = this.wxMpService.post(url, xstream.toXML(request)); String responseContent = this.wxMpService.post(url, xstream.toXML(request));
return (WxRedpackResult) xstream.fromXML(responseContent); WxRedpackResult redpackResult = (WxRedpackResult) xstream.fromXML(responseContent);
if("FAIL".equals(redpackResult.getResultCode())){
throw new WxErrorException(
WxError.newBuilder().setErrorMsg(redpackResult.getErrCode() + ":" + redpackResult.getErrCodeDes()).build());
}
return redpackResult;
} }
private Map<String, String> xmlBean2Map(Object bean) { private Map<String, String> xmlBean2Map(Object bean) {
@ -465,7 +471,7 @@ public class WxMpPayServiceImpl implements WxMpPayService {
} }
/** /**
* 微信公众号支付签名算法(详见:http://pay.weixin.qq.com/wiki/doc/api/index.php?chapter=4_3) * 微信公众号支付签名算法(详见:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=4_3)
* @param packageParams 原始参数 * @param packageParams 原始参数
* @param signKey 加密Key( 商户Key) * @param signKey 加密Key( 商户Key)
* @return 签名字符串 * @return 签名字符串