Browse Source

退款bug修改

fllmoyu 4 năm trước cách đây
mục cha
commit
239158215e

+ 1 - 1
common/src/main/java/com/jpsoft/bus/modules/base/service/impl/OrderInfoServiceImpl.java

@@ -113,7 +113,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
 		if (orderInfo.getPayStatus() !=20){
 			throw new Exception("订单状态错误,不可退款");
 		}
-		if (!"wechat".equals(orderInfo.getPayName()) || "alipay".equals(orderInfo.getPayName())){
+		if (!"wechat".equals(orderInfo.getPayName()) && !"alipay".equals(orderInfo.getPayName())){
 			throw new Exception("非在线支付,不可在线退款");
 		}
 

+ 5 - 3
common/src/main/java/com/jpsoft/bus/modules/pay/service/impl/AlipayServiceImpl.java

@@ -116,7 +116,7 @@ public class AlipayServiceImpl implements AlipayService {
 
 
         Map<String, Object> maps = new HashMap<>();
-        maps.put("out_trade_no", orderInfo.getOutOrderNo());
+        maps.put("trade_no", orderInfo.getTransactionId());
         maps.put("refund_reason", "正常退款");
         maps.put("refund_amount", orderInfo.getPayFee());
 
@@ -134,14 +134,16 @@ public class AlipayServiceImpl implements AlipayService {
         AlipayTradeRefundResponse response = alipayClient.execute(request);
 
         //退款成功
-        if (response.isSuccess()){
+        if ("10000".equals(response.getCode())){
             orderInfo.setRefundFee(orderInfo.getPayFee());
             orderInfo.setPayStatus(payStatus);
             orderInfoService.update(orderInfo);
 
+        }else {
+            throw new Exception(response.getSubMsg());
         }
 
-        return response.isSuccess();
+        return true;
 
 
     }

+ 0 - 1
common/src/main/java/com/jpsoft/bus/modules/pay/service/impl/WechatServiceImpl.java

@@ -129,7 +129,6 @@ public class WechatServiceImpl implements WechatService {
                 .sub_mch_id(wxJpsoftConfig.getSubMchId())
                 .nonce_str(WxPayKit.generateStr())
                 .transaction_id(orderInfo.getTransactionId())
-                .out_trade_no(orderInfo.getTransactionId())
                 .out_refund_no(WxPayKit.generateStr())
                 .total_fee(totalFee)
                 .refund_fee(refundFeeStr)