|
@@ -14,6 +14,7 @@ import com.yami.shop.bean.bo.PayInfoBo;
|
|
|
import com.yami.shop.wx.config.CombinePayUrlEnum;
|
|
|
import com.yami.shop.wx.config.WechatPayServiceConfig;
|
|
|
import com.yami.shop.wx.po.JsapiPayInfoPo;
|
|
|
+import com.yami.shop.wx.po.RefundInfoPo;
|
|
|
import com.yami.shop.wx.service.WxProviderService;
|
|
|
import com.yami.shop.wx.utils.CullenUtils;
|
|
|
import com.yami.shop.wx.utils.OrderUtils;
|
|
@@ -52,6 +53,8 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
|
|
|
private static final String WX_SUCCESS_XML = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
|
|
|
|
|
+ private static final String REFUND_URL = "https://bus.qlapp.cn/notice/pay/order/refundNotify";
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> subJsapi(JsapiPayInfoPo po) {
|
|
|
System.out.println("微信支付传入参数===========" + po);
|
|
@@ -169,26 +172,26 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
/**
|
|
|
* 申请退款
|
|
|
*
|
|
|
- * @param orderNo orderNo
|
|
|
- * @return orderNo
|
|
|
+ * @param po 请求参数
|
|
|
+ * @return 退款结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public String refundOrder(String orderNo, Integer refundMoney, Integer total) {
|
|
|
- log.info("根据订单号申请退款,订单号: {}", orderNo);
|
|
|
+ public String refundOrder(RefundInfoPo po) {
|
|
|
+ log.info("根据订单号申请退款,订单号: {}", po.getOutTradeNo());
|
|
|
String url = wechatPayServiceConfig.getBaseUrl().concat(CombinePayUrlEnum.DOMESTIC_REFUNDS.getType());
|
|
|
Map<String, Object> params = new HashMap<>(2);
|
|
|
- params.put("out_trade_no", orderNo);
|
|
|
+ params.put("out_trade_no", po.getOutTradeNo());
|
|
|
params.put("sub_mchid", wechatPayServiceConfig.getSubMchId());
|
|
|
String outRefundNo = OrderUtils.getOrderNo("TK");
|
|
|
log.info("退款申请号:{}", outRefundNo);
|
|
|
params.put("out_refund_no", outRefundNo);
|
|
|
params.put("reason", "申请退款");
|
|
|
- params.put("notify_url", "http://he56cd66.natappfree.cc/notice/pay/order/refundNotify");
|
|
|
+ params.put("notify_url", REFUND_URL);
|
|
|
Map<String, Object> amountMap = new HashMap<>();
|
|
|
//退款金额,单位:分
|
|
|
- amountMap.put("refund", refundMoney);
|
|
|
+ amountMap.put("refund", po.getRefundMoney());
|
|
|
//原订单金额,单位:分
|
|
|
- amountMap.put("total", total);
|
|
|
+ amountMap.put("total", po.getTotal());
|
|
|
amountMap.put("currency", "CNY");
|
|
|
params.put("amount", amountMap);
|
|
|
String paramsStr = JSON.toJSONString(params);
|
|
@@ -401,7 +404,6 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
resourceJson.get("out_refund_no");
|
|
|
resourceJson.get("refund_id");
|
|
|
}
|
|
|
-
|
|
|
} finally {
|
|
|
lock.unlock();
|
|
|
}
|