TRX 1 éve
szülő
commit
a8aeb4e37c

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/FrictionlessUnionConfigModel.java

@@ -43,6 +43,9 @@ public class FrictionlessUnionConfigModel {
     @Schema(description = "来源系统Id")
     @Schema(description = "来源系统Id")
     private String sysSource;
     private String sysSource;
 
 
+    @Schema(description = "来源编号")
+    private String sysSourceNo;
+
     @Schema(description = "签约结束后调整小程序id")
     @Schema(description = "签约结束后调整小程序id")
     private String mchntWxMpAppId;
     private String mchntWxMpAppId;
 
 

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/payConfig/FrictionlessUnionConfigParam.java

@@ -40,6 +40,9 @@ public class FrictionlessUnionConfigParam extends PayConfigParam {
     @Schema(description = "来源系统Id")
     @Schema(description = "来源系统Id")
     private String sysSource;
     private String sysSource;
 
 
+    @Schema(description = "来源编号")
+    private String sysSourceNo;
+
     @Schema(description = "签约结束后跳转小程序id")
     @Schema(description = "签约结束后跳转小程序id")
     private String mchntWxMpAppId;
     private String mchntWxMpAppId;
 
 

+ 3 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/hxz/HxzService.java

@@ -118,7 +118,7 @@ public class HxzService extends SuperService {
         requestInfoService.addRequestInfo(param, resultModel);
         requestInfoService.addRequestInfo(param, resultModel);
         stopWatch.stop();
         stopWatch.stop();
         log.info("time; {}", stopWatch.prettyPrint());
         log.info("time; {}", stopWatch.prettyPrint());
-        return ResultContent.buildSuccess(JSONUtil.toJsonStr(resultModel));
+        return ResultContent.buildSuccess(expenseFlowService.buildPayResultStr(resultModel));
     }
     }
 
 
     /**
     /**
@@ -131,7 +131,7 @@ public class HxzService extends SuperService {
         // 构建返回结果
         // 构建返回结果
         ConsumTransactionsResult resultModel = expenseFlowService.buildPayResult(param.getOrder());
         ConsumTransactionsResult resultModel = expenseFlowService.buildPayResult(param.getOrder());
         requestInfoService.addRequestInfo(param, resultModel);
         requestInfoService.addRequestInfo(param, resultModel);
-        return ResultContent.buildSuccess(JSONUtil.toJsonStr(resultModel));
+        return ResultContent.buildSuccess(expenseFlowService.buildPayResultStr(resultModel));
     }
     }
 
 
     /**
     /**
@@ -188,7 +188,7 @@ public class HxzService extends SuperService {
         // 构建返回结果
         // 构建返回结果
         ConsumTransactionsResult resultModel = expenseFlowService.buildPayResult(param.getQROrder());
         ConsumTransactionsResult resultModel = expenseFlowService.buildPayResult(param.getQROrder());
         requestInfoService.addRequestInfo(param, resultModel);
         requestInfoService.addRequestInfo(param, resultModel);
-        return ResultContent.buildSuccess(JSONUtil.toJsonStr(resultModel));
+        return ResultContent.buildSuccess(expenseFlowService.buildPayResultStr(resultModel));
     }
     }
 
 
 }
 }

+ 12 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectPaySettingServiceImpl.java

@@ -551,6 +551,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         fields.add(PayConfigField.builder().name("协议模板id").key("planId").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).maxLength(100).build());
         fields.add(PayConfigField.builder().name("协议模板id").key("planId").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).maxLength(100).build());
         fields.add(PayConfigField.builder().name("密钥").key("notifySecret").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).build());
         fields.add(PayConfigField.builder().name("密钥").key("notifySecret").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).build());
         fields.add(PayConfigField.builder().name("来源系统Id").key("sysSource").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).build());
         fields.add(PayConfigField.builder().name("来源系统Id").key("sysSource").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).build());
+        fields.add(PayConfigField.builder().name("来源编号").key("sysSourceNo").type(PayFieldType.Str).isMust(Boolean.TRUE).payShowField(mainFiled).build());
 
 
         fields.add(PayConfigField.builder().name("通知地址").key("notifyUrl").type(PayFieldType.Str).isMust(Boolean.TRUE).maxLength(500).payShowField(mainFiled).build());
         fields.add(PayConfigField.builder().name("通知地址").key("notifyUrl").type(PayFieldType.Str).isMust(Boolean.TRUE).maxLength(500).payShowField(mainFiled).build());
 
 
@@ -681,6 +682,15 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                 appConf.setSecretKey(model.getNotifySecret());
                 appConf.setSecretKey(model.getNotifySecret());
                 appConf.setNotifyUrl(model.getNotifyUrl());
                 appConf.setNotifyUrl(model.getNotifyUrl());
                 appConf.setSysSource(model.getSysSource());
                 appConf.setSysSource(model.getSysSource());
+                appConf.setSysSourceNo(model.getSysSourceNo());
+
+                // 退款
+                appConf.setWithdrawAppId(model.getWithdrawAppId());
+                appConf.setWithdrawAppKey(model.getWithdrawAppKey());
+                appConf.setWithdrawSysId(model.getWithdrawSysid());
+                appConf.setWithdrawMchId(model.getWithdrawMid());
+                appConf.setAppType(model.getWithdrawAppType());
+
                 accountModel.setConf(appConf);
                 accountModel.setConf(appConf);
             }
             }
 
 
@@ -784,6 +794,8 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                 appConf.setPlanId(model.getPlanId());
                 appConf.setPlanId(model.getPlanId());
                 appConf.setSecretKey(model.getNotifySecret());
                 appConf.setSecretKey(model.getNotifySecret());
                 appConf.setNotifyUrl(model.getNotifyUrl());
                 appConf.setNotifyUrl(model.getNotifyUrl());
+                appConf.setSysSource(model.getSysSource());
+                appConf.setSysSourceNo(model.getSysSourceNo());
 
 
                 // 提现参数
                 // 提现参数
                 appConf.setWithdrawAppId(model.getWithdrawAppId());
                 appConf.setWithdrawAppId(model.getWithdrawAppId());

+ 20 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/payment/ExpenseFlowServiceImpl.java

@@ -416,9 +416,16 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
      * @return
      * @return
      */
      */
     public ConsumTransactionsResult buildPayResult(String orderNo) {
     public ConsumTransactionsResult buildPayResult(String orderNo) {
+        // 支付结果
         ConsumTransactionsResult result = new ConsumTransactionsResult();
         ConsumTransactionsResult result = new ConsumTransactionsResult();
         ExpenseFlow expenseFlow = expenseFlowDao.findTopByOrderNoOrderByCreateTimeDesc(orderNo);
         ExpenseFlow expenseFlow = expenseFlowDao.findTopByOrderNoOrderByCreateTimeDesc(orderNo);
         if (ObjectUtils.isNotEmpty(expenseFlow)) {
         if (ObjectUtils.isNotEmpty(expenseFlow)) {
+            if (expenseFlow.getOrderType() == OrderState.PAY_IN_PROGRESS) {
+                // 支付中
+                result.setStatus(-1);
+                result.setMsg("支付中");
+                return result;
+            }
             Boolean isPaySuccess = expenseFlow.getIsPaySuccess();
             Boolean isPaySuccess = expenseFlow.getIsPaySuccess();
             if (isPaySuccess != null && isPaySuccess) {
             if (isPaySuccess != null && isPaySuccess) {
                 result.setSuccess();
                 result.setSuccess();
@@ -444,6 +451,19 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
         return result;
         return result;
     }
     }
 
 
+    /**
+     * 构建支付返回数据
+     *
+     * @param result
+     * @return
+     */
+    public String buildPayResultStr(ConsumTransactionsResult result) {
+        if (ObjectUtils.isEmpty(result)) {
+            return new JSONObject().toString();
+        }
+        return JSONUtil.toJsonStr(result);
+    }
+
     /**
     /**
      * 查询分页数据
      * 查询分页数据
      *
      *

+ 22 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/payment/PayCallService.java

@@ -140,7 +140,7 @@ public class PayCallService extends SuperService {
         }
         }
 
 
         // 所有的渠道都支付失败
         // 所有的渠道都支付失败
-        if (!b && paymentTypes.size() == 1) {
+        if (!b && paymentTypes.size() > 1) {
             String msg = "支付失败";
             String msg = "支付失败";
             entity.setPaymentStatus("支付失败");
             entity.setPaymentStatus("支付失败");
             entity.setIsPaySuccess(Boolean.FALSE);
             entity.setIsPaySuccess(Boolean.FALSE);
@@ -406,6 +406,8 @@ public class PayCallService extends SuperService {
             } else {
             } else {
                 return ResultContent.buildFail(resultContent.getMsg());
                 return ResultContent.buildFail(resultContent.getMsg());
             }
             }
+        } else if (entity.getPaymentType() == PaymentType.UnionFrictionlessPay) {
+            unionFrictionlessPayRefund(entity, param);
         }
         }
         return ResultContent.buildFail("不支持退款");
         return ResultContent.buildFail("不支持退款");
     }
     }
@@ -427,6 +429,25 @@ public class PayCallService extends SuperService {
         }
         }
     }
     }
 
 
+    /**
+     * @param entity
+     * @param param
+     * @return
+     */
+    public ResultContent<List<TransactionLogModel>> unionFrictionlessPayRefund(ExpenseFlow entity, ExpenseRefundParam param) {
+        String refundNo = NextNoUtil.getNextPaymentNo(null);
+        entity.setRefundNo(refundNo);
+        String paymentNo = entity.getPaymentNo();
+
+        ResultContent resultContent = chinaumsSenselessPayService.refund(entity.getProjectOid(), entity.getShopOid(), entity.getUserId(),
+                entity.getPayAmount(), paymentNo, refundNo, param.getRemark());
+        if (resultContent.isSuccess()) {
+            return ResultContent.buildSuccess(resultContent.getContent());
+        } else {
+            return ResultContent.buildFail(String.format("退款失败:%s", resultContent.getMsg()));
+        }
+    }
+
     /**
     /**
      * 结算
      * 结算
      *
      *