记得上下班打卡 | git大法好,push需谨慎

Commit 661ff465 authored by 胡佳晨's avatar 胡佳晨

dragon - 退款返回错误内容

parent 00a41d21
......@@ -158,6 +158,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
String sign = PayWepayUtils.getInstance().createSign(parameters);
parameters.put("sign", sign);
String data = PayWepayUtils.getInstance().getRequestXml(parameters);
String refundError = "";
try {
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund");
httpost.setEntity(new StringEntity(data, "UTF-8"));
......@@ -170,7 +171,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
WePayRefundReturnDto wePayRefundReturnDto = XmlUtil.toBean(jsonStr, WePayRefundReturnDto.class);
if (wePayRefundReturnDto.getErrCodeDes() != null) {
channelDto.setResult("error");
channelDto.setMessage(paymentType + " refund error: " + wePayRefundReturnDto.getErrCodeDes());
channelDto.setMessage( wePayRefundReturnDto.getErrCodeDes());
contentDto.setRequest(data);
contentDto.setResponse(jsonStr);
channelDto.setContent(contentDto);
......@@ -178,7 +179,6 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
}
if (!wePayRefundReturnDto.getReturnCode().equalsIgnoreCase("SUCCESS") || wePayRefundReturnDto.getReturnCode() == null) {
try {
String refundError = "";
refundStatus = DragonConstant.RefundStatusEnum.STATUS_ERROR.getCode();
if (null == wePayRefundReturnDto.getReturnMsg()) {
refundError = "退款失败,原因未知";
......@@ -203,7 +203,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return channelDto;
}
channelDto.setResult("error");
channelDto.setMessage(paymentType + " refund error: ");
channelDto.setMessage(refundError);
contentDto.setRequest(data);
contentDto.setResponse(jsonStr);
channelDto.setContent(contentDto);
......@@ -262,6 +262,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
RefundContentDto contentDto = new RefundContentDto();
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();//创建API对应的request类
try {
String refundError = "";
request.setBizContent("{" +
"\"out_trade_no\":\"" + code + "\"," +
"\"trade_no\":\"" + paymentId + "\"," +
......@@ -269,9 +270,8 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
"\"refund_reason\":\"" + reason + "\"," +
"\"refund_amount\":\"" + price.doubleValue() + "\"}"); //设置业务参数
AlipayTradeRefundResponse response = PayAlipayUtils.getInstance().getHttpClient().execute(request);
if (response.getFundChange().equals("N") || response.getFundChange() == null) {
if (response.getFundChange() == null || response.getFundChange().equals("N")) {
try {
String refundError = "";
refundStatus = DragonConstant.RefundStatusEnum.STATUS_ERROR.getCode();
if (null == response.getSubMsg()) {
refundError = "退款失败,原因未知";
......@@ -296,7 +296,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return channelDto;
}
channelDto.setResult("error");
channelDto.setMessage(paymentType + " refund error: ");
channelDto.setMessage(refundError);
contentDto.setRequest(JSON.toJSONString(response.getParams()));
contentDto.setResponse(response.getBody());
channelDto.setContent(contentDto);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment