|
|
@@ -396,10 +396,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { |
|
|
} |
|
|
} |
|
|
if (!"SUCCESS".equals(paramMap.get("return_code"))) { |
|
|
if (!"SUCCESS".equals(paramMap.get("return_code"))) { |
|
|
logger.warn("notify order, wxpay status not success, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay status not success, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "订单状态码非SUCCESS"); |
|
|
resultMap.put("return_msg", "订单状态码非SUCCESS"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String payOrderNo = paramMap.get("out_trade_no"); |
|
|
String payOrderNo = paramMap.get("out_trade_no"); |
|
|
@@ -407,59 +407,62 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { |
|
|
WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); |
|
|
WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); |
|
|
if (payOrder == null) { |
|
|
if (payOrder == null) { |
|
|
logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "订单不存在"); |
|
|
resultMap.put("return_msg", "订单不存在"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
// 验证支付金额 |
|
|
// 验证支付金额 |
|
|
if(!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { |
|
|
if(!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { |
|
|
logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "订单总金额不一致"); |
|
|
resultMap.put("return_msg", "订单总金额不一致"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
String refundOrderNo = paramMap.get("out_refund_no"); |
|
|
String refundOrderNo = paramMap.get("out_refund_no"); |
|
|
Long refundOrderId = Long.valueOf(refundOrderNo); |
|
|
Long refundOrderId = Long.valueOf(refundOrderNo); |
|
|
WxRefundOrder refundOrder = wxRefundOrderMapper.selectByPrimaryKey(refundOrderId); |
|
|
WxRefundOrder refundOrder = wxRefundOrderMapper.selectByPrimaryKey(refundOrderId); |
|
|
if (refundOrder == null) { |
|
|
if (refundOrder == null) { |
|
|
logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "退款订单不存在"); |
|
|
resultMap.put("return_msg", "退款订单不存在"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
// 验证支付金额 |
|
|
// 验证支付金额 |
|
|
if(!paramMap.get("total_fee").equals(refundOrder.getTotalFee().toString())) { |
|
|
if(!paramMap.get("total_fee").equals(refundOrder.getTotalFee().toString())) { |
|
|
logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "订单总金额不一致"); |
|
|
resultMap.put("return_msg", "订单总金额不一致"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
// 验证退款金额 |
|
|
// 验证退款金额 |
|
|
if(!paramMap.get("refund_fee").equals(refundOrder.getRefundFee().toString())) { |
|
|
if(!paramMap.get("refund_fee").equals(refundOrder.getRefundFee().toString())) { |
|
|
logger.warn("notify order, wxpay check refund_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.warn("notify order, wxpay check refund_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_code", "FAIL"); |
|
|
resultMap.put("return_msg", "退款总金额不一致"); |
|
|
resultMap.put("return_msg", "退款总金额不一致"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理支付成功 |
|
|
// 处理支付成功 |
|
|
handleRefundSuccess(refundOrder, paramMap.get("transaction_id"), paramMap.get("refund_id")); |
|
|
handleRefundSuccess(refundOrder, paramMap.get("transaction_id"), paramMap.get("refund_id")); |
|
|
logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); |
|
|
Map<String, String> resultMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
resultMap.put("return_code", "SUCCESS"); |
|
|
resultMap.put("return_code", "SUCCESS"); |
|
|
resultMap.put("return_msg", "OK"); |
|
|
resultMap.put("return_msg", "OK"); |
|
|
return XmlUtil.parseDto2Xml(resultMap, ""); |
|
|
|
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
} catch (RuntimeException e) { |
|
|
} catch (RuntimeException e) { |
|
|
logger.warn("notify order, alipay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); |
|
|
logger.warn("notify order, alipay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); |
|
|
throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); |
|
|
|
|
|
|
|
|
throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); |
|
|
} |
|
|
} |
|
|
return ""; |
|
|
|
|
|
|
|
|
SortedMap resultMap = new TreeMap(); |
|
|
|
|
|
resultMap.put("return_code", "FAIL"); |
|
|
|
|
|
resultMap.put("return_msg", "FAILED"); |
|
|
|
|
|
return XmlUtil.getRequestXml(resultMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|