mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 02:56:20 +00:00
feat 支付平台配置/通道配置对接, 退款金额设置失败修复
This commit is contained in:
@@ -53,10 +53,13 @@
|
||||
- [x] (前端) 退款订单
|
||||
- [x] (前端) 支付通道配置列表
|
||||
- 2024-01-13:
|
||||
- [ ] (前端) 微信/支付宝支付通道配置
|
||||
- [ ] 支付通道支持停用
|
||||
- [x] (前端) 微信/支付宝支付通道配置
|
||||
- [x] 支付通道支持停用
|
||||
- [x] 请求支付网关时区退款号以R开头, 用于与支付ID的区分
|
||||
- [ ] 优化支付相关订单和记录的查询条件
|
||||
- [ ] (前端) 平台配置
|
||||
- **任务池**
|
||||
- [ ] 支付宝关闭支付时支持撤销方式,
|
||||
- [ ] 支付宝关闭支付时支持撤销方式,
|
||||
- [ ] 支持转账操作, 通过支付通道专有参数进行实现, 转账时只能单个通道进行操作
|
||||
- [ ] 支付成功回调后, 如果订单已超时, 则进入待退款订单中,提示进行退款,或者自动退款
|
||||
- [ ] 退款状态同步逻辑
|
||||
|
@@ -11,18 +11,18 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 平台配置项
|
||||
* 支付平台配置控制器
|
||||
* @author xxm
|
||||
* @since 2024/1/2
|
||||
*/
|
||||
@Tag(name = "平台配置项")
|
||||
@Tag(name = "支付平台配置控制器")
|
||||
@RestController
|
||||
@RequestMapping("/platform/config")
|
||||
@RequiredArgsConstructor
|
||||
public class PlatformConfigController {
|
||||
private final PlatformConfigService platformConfigService;
|
||||
|
||||
@Operation(summary = "平台配置项")
|
||||
@Operation(summary = "获取平台配置")
|
||||
@GetMapping("/getConfig")
|
||||
public ResResult<PlatformConfigDto> getConfig(){
|
||||
return Res.ok(platformConfigService.getConfig().toDto());
|
||||
|
@@ -8,7 +8,7 @@ import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 支付同步状态
|
||||
* 支付同步结果
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2021/4/21
|
||||
|
@@ -7,6 +7,7 @@ import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.PayParam;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -86,4 +87,11 @@ public class PayUtil {
|
||||
.map(PayChannelParam::getChannel)
|
||||
.noneMatch(PayChannelEnum.ASYNC_TYPE_CODE::contains);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成退款号
|
||||
*/
|
||||
public String getRefundNo(){
|
||||
return "R" + IdUtil.getSnowflakeNextIdStr();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package cn.bootx.platform.daxpay.gateway.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* 支付同步通知控制器
|
||||
* @author xxm
|
||||
* @since 2024/1/13
|
||||
*/
|
||||
@Tag(name = "支付同步通知控制器")
|
||||
@RestController
|
||||
@RequestMapping("/pay/return")
|
||||
@RequiredArgsConstructor
|
||||
public class PayReturnController {
|
||||
|
||||
@Operation(summary = "支付宝同步通知")
|
||||
@GetMapping("/alipay")
|
||||
public ModelAndView alipay(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Operation(summary = "微信同步通知")
|
||||
@GetMapping("/wechat")
|
||||
public ModelAndView wechat(){
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -28,6 +28,6 @@ public class PlatformLocal {
|
||||
/** 支付通知地址 */
|
||||
private String notifyUrl;
|
||||
|
||||
/** 订单支付超时 */
|
||||
/** 订单支付超时(分钟) */
|
||||
private Integer orderTimeout;
|
||||
}
|
||||
|
@@ -37,6 +37,10 @@ public class AliPayConfig extends MpBaseEntity implements EntityBaseFunction<Ali
|
||||
@DbColumn(comment = "支付宝商户appId")
|
||||
private String appId;
|
||||
|
||||
/** 是否启用 */
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
/**
|
||||
* 服务器异步通知页面路径, 需要填写本网关服务的地址, 不可以直接填写业务系统的地址
|
||||
* 1. 需http://或者https://格式的完整路径,
|
||||
@@ -115,9 +119,6 @@ public class AliPayConfig extends MpBaseEntity implements EntityBaseFunction<Ali
|
||||
@TableField(typeHandler = StringListTypeHandler.class)
|
||||
private List<String> payWays;
|
||||
|
||||
@DbColumn(comment = "状态")
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
@DbColumn(comment = "备注")
|
||||
private String remark;
|
||||
|
@@ -3,10 +3,12 @@ package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
|
||||
import cn.bootx.platform.common.core.exception.BizException;
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayCode;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayWay;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.dao.AliPayConfigManager;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.service.PayChannelInfoService;
|
||||
import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayConfigParam;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
@@ -36,6 +38,7 @@ public class AliPayConfigService {
|
||||
/** 默认支付宝配置的主键ID */
|
||||
private final static Long ID = 0L;
|
||||
private final AliPayConfigManager alipayConfigManager;
|
||||
private final PayChannelInfoService payChannelInfoService;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -43,6 +46,11 @@ public class AliPayConfigService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(AliPayConfigParam param) {
|
||||
AliPayConfig alipayConfig = alipayConfigManager.findById(ID).orElseThrow(() -> new DataNotExistException("支付宝配置不存在"));
|
||||
// 启用或停用
|
||||
if (!Objects.equals(param.getEnable(), alipayConfig.getEnable())){
|
||||
payChannelInfoService.setEnable(PayChannelEnum.ALI.getCode(), param.getEnable());
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(param, alipayConfig, CopyOptions.create().ignoreNullValue());
|
||||
alipayConfigManager.updateById(alipayConfig);
|
||||
}
|
||||
@@ -52,9 +60,9 @@ public class AliPayConfigService {
|
||||
*/
|
||||
public List<LabelValue> findPayWays() {
|
||||
return AliPayWay.getPayWays()
|
||||
.stream()
|
||||
.map(e -> new LabelValue(e.getName(),e.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
.stream()
|
||||
.map(e -> new LabelValue(e.getName(),e.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayCode;
|
||||
import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.bootx.platform.daxpay.util.PayUtil;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||
import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||
@@ -38,7 +38,7 @@ public class AliPayRefundService {
|
||||
|
||||
// 设置退款信息
|
||||
AsyncRefundLocal refundInfo = PaymentContextLocal.get().getAsyncRefundInfo();
|
||||
refundInfo.setRefundNo(IdUtil.getSnowflakeNextIdStr());
|
||||
refundInfo.setRefundNo(PayUtil.getRefundNo());
|
||||
refundModel.setOutRequestNo(refundInfo.getRefundNo());
|
||||
try {
|
||||
AlipayTradeRefundResponse response = AliPayApi.tradeRefundToResponse(refundModel);
|
||||
|
@@ -25,6 +25,4 @@ public interface WeChatConvert {
|
||||
|
||||
WeChatPayOrderDto convert(WeChatPayOrder in);
|
||||
|
||||
WeChatPayOrder convert(WeChatPayOrderDto in);
|
||||
|
||||
}
|
||||
|
@@ -41,6 +41,10 @@ public class WeChatPayConfig extends MpBaseEntity implements EntityBaseFunction<
|
||||
@DbColumn(comment = "微信应用appId")
|
||||
private String wxAppId;
|
||||
|
||||
/** 是否启用 */
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
/**
|
||||
* 服务器异步通知页面路径, 需要填写本网关服务的地址, 不可以直接填写业务系统的地址
|
||||
* 1. 需http://或者https://格式的完整路径,
|
||||
|
@@ -2,10 +2,12 @@ package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.WeChatPayWay;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.dao.WeChatPayConfigManager;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.service.PayChannelInfoService;
|
||||
import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayConfigParam;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -30,6 +33,7 @@ public class WeChatPayConfigService {
|
||||
/** 默认微信支付配置的主键ID */
|
||||
private final static Long ID = 0L;
|
||||
private final WeChatPayConfigManager weChatPayConfigManager;
|
||||
private final PayChannelInfoService payChannelInfoService;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -37,6 +41,10 @@ public class WeChatPayConfigService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(WeChatPayConfigParam param) {
|
||||
WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(ID).orElseThrow(() -> new PayFailureException("微信支付配置不存在"));
|
||||
// 启用或停用
|
||||
if (!Objects.equals(param.getEnable(), weChatPayConfig.getEnable())){
|
||||
payChannelInfoService.setEnable(PayChannelEnum.WECHAT.getCode(), param.getEnable());
|
||||
}
|
||||
BeanUtil.copyProperties(param, weChatPayConfig, CopyOptions.create().ignoreNullValue());
|
||||
weChatPayConfigManager.updateById(weChatPayConfig);
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@ public class WeChatPaySyncService {
|
||||
log.warn("疑似未查询到订单:{}", result);
|
||||
return syncResult.setSyncStatus(PaySyncStatusEnum.NOT_FOUND);
|
||||
}
|
||||
// 查询到订单的状态
|
||||
String tradeStatus = result.get(WeChatPayCode.TRADE_STATE);
|
||||
// 支付完成
|
||||
if (Objects.equals(tradeStatus, WeChatPayCode.TRADE_SUCCESS) || Objects.equals(tradeStatus, WeChatPayCode.TRADE_ACCEPT)) {
|
||||
@@ -89,4 +90,8 @@ public class WeChatPaySyncService {
|
||||
}
|
||||
return syncResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款查询
|
||||
*/
|
||||
}
|
||||
|
@@ -2,15 +2,16 @@ package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayRefundStatusEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.WeChatPayCode;
|
||||
import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
|
||||
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
|
||||
import cn.bootx.platform.daxpay.util.PayUtil;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ijpay.core.enums.SignType;
|
||||
import com.ijpay.core.kit.WxPayKit;
|
||||
@@ -22,7 +23,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -35,20 +35,21 @@ import java.util.Optional;
|
||||
@RequiredArgsConstructor
|
||||
public class WechatRefundService {
|
||||
|
||||
private final PayOrderChannelManager payOrderChannelManager;
|
||||
|
||||
/**
|
||||
* 退款
|
||||
* 退款方法
|
||||
* 微信需要同时传输订单金额或退款金额
|
||||
*/
|
||||
public void refund(PayOrder payOrder, int amount,
|
||||
WeChatPayConfig weChatPayConfig) {
|
||||
RefundableInfo refundableInfo = payOrder.getRefundableInfos().stream()
|
||||
.filter(o -> Objects.equals(o.getChannel(), PayChannelEnum.WECHAT.getCode()))
|
||||
.findFirst()
|
||||
public void refund(PayOrder payOrder, int amount, WeChatPayConfig weChatPayConfig) {
|
||||
PayOrderChannel orderChannel = payOrderChannelManager.findByPaymentIdAndChannel(payOrder.getId(), PayChannelEnum.WECHAT.getCode())
|
||||
.orElseThrow(() -> new PayFailureException("未找到微信支付的详细信息"));
|
||||
String refundFee = String.valueOf(amount);
|
||||
String totalFee = refundableInfo.getAmount().toString();
|
||||
String totalFee = String.valueOf(orderChannel.getAmount());
|
||||
// 设置退款信息
|
||||
AsyncRefundLocal refundInfo = PaymentContextLocal.get().getAsyncRefundInfo();
|
||||
refundInfo.setRefundNo(IdUtil.getSnowflakeNextIdStr());
|
||||
refundInfo.setRefundNo(PayUtil.getRefundNo());
|
||||
|
||||
Map<String, String> params = RefundModel.builder()
|
||||
.appid(weChatPayConfig.getWxAppId())
|
||||
.mch_id(weChatPayConfig.getWxMchId())
|
||||
|
@@ -127,6 +127,7 @@ public class PayRefundAssistService {
|
||||
PayRefundOrder refundOrder = new PayRefundOrder()
|
||||
.setRefundRequestNo(asyncRefundInfo.getRefundNo())
|
||||
.setAmount(amount)
|
||||
.setRefundableBalance(payOrder.getRefundableBalance())
|
||||
.setPaymentId(payOrder.getId())
|
||||
.setBusinessNo(payOrder.getBusinessNo())
|
||||
.setRefundTime(LocalDateTime.now())
|
||||
|
@@ -91,7 +91,8 @@ public class PayRefundService {
|
||||
// 全部退款根据支付订单的退款信息构造退款参数
|
||||
List<RefundChannelParam> channelParams = payOrder.getRefundableInfos()
|
||||
.stream()
|
||||
.map(o -> new RefundChannelParam().setChannel(o.getChannel())
|
||||
.map(o -> new RefundChannelParam()
|
||||
.setChannel(o.getChannel())
|
||||
.setAmount(o.getAmount()))
|
||||
.collect(Collectors.toList());
|
||||
param.setRefundChannels(channelParams);
|
||||
|
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -71,8 +72,10 @@ public class PayRepairService {
|
||||
break;
|
||||
case REFUND:
|
||||
this.refund(order, repairStrategies);
|
||||
// repairResult.setRepairStatus(PayStatusEnum.REFUNDED);
|
||||
break;
|
||||
default:
|
||||
repairResult.setRepairStatus(repairResult.getBeforeStatus());
|
||||
break;
|
||||
}
|
||||
this.saveRecord(order, repairParam, repairResult);
|
||||
@@ -147,13 +150,15 @@ public class PayRepairService {
|
||||
* 保存记录
|
||||
*/
|
||||
private void saveRecord(PayOrder order, PayRepairParam repairParam, RepairResult repairResult){
|
||||
// 修复后的状态
|
||||
String afterStatus = Optional.ofNullable(repairResult.getRepairStatus()).map(PayStatusEnum::getCode).orElse(null);
|
||||
|
||||
PayRepairRecord payRepairRecord = new PayRepairRecord()
|
||||
.setPaymentId(order.getId())
|
||||
.setAsyncChannel(order.getAsyncChannel())
|
||||
.setBusinessNo(order.getBusinessNo())
|
||||
.setBeforeStatus(repairResult.getBeforeStatus().getCode())
|
||||
.setAfterStatus(repairResult.getRepairStatus().getCode())
|
||||
.setAfterStatus(afterStatus)
|
||||
.setAmount(repairParam.getAmount())
|
||||
.setRepairSource(repairParam.getRepairSource().getCode())
|
||||
.setRepairType(repairParam.getRepairType().getCode());
|
||||
|
@@ -51,7 +51,7 @@ public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction<
|
||||
* 网关返回状态
|
||||
* @see PaySyncStatusEnum
|
||||
*/
|
||||
@DbColumn(comment = "同步状态")
|
||||
@DbColumn(comment = "网关返回状态")
|
||||
private String gatewayStatus;
|
||||
|
||||
/**
|
||||
|
@@ -39,7 +39,10 @@ public class PlatformConfig extends MpBaseEntity implements EntityBaseFunction<P
|
||||
@DbColumn(comment = "支付通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@DbColumn(comment = "订单默认超时时间")
|
||||
@DbColumn(comment = "同步支付通知地址")
|
||||
private String returnUrl;
|
||||
|
||||
@DbColumn(comment = "订单默认超时时间(分钟)")
|
||||
private Integer orderTimeout;
|
||||
|
||||
|
||||
|
@@ -6,13 +6,22 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/1/8
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/1/8
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PayChannelInfoManager extends BaseManager<PayChannelInfoMapper, PayChannelInfo> {
|
||||
|
||||
/**
|
||||
* 根据code查询
|
||||
*/
|
||||
public Optional<PayChannelInfo> findByCode(String code){
|
||||
return findByField(PayChannelInfo::getCode, code);
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,10 @@ public class PayChannelInfo extends MpBaseEntity implements EntityBaseFunction<P
|
||||
@DbColumn(comment = "卡牌背景色")
|
||||
private String bgColor;
|
||||
|
||||
/** 是否启用 */
|
||||
@DbColumn(comment = "是否启用")
|
||||
private boolean enabled;
|
||||
|
||||
/** 备注 */
|
||||
@DbColumn(comment = "备注")
|
||||
private String remark;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.core.system.payinfo.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.util.ResultConvertUtil;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.dao.PayChannelInfoManager;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayChannelInfo;
|
||||
import cn.bootx.platform.daxpay.service.dto.system.payinfo.PayChannelInfoDto;
|
||||
@@ -39,7 +38,17 @@ public class PayChannelInfoService {
|
||||
* 单条
|
||||
*/
|
||||
public PayChannelInfoDto findById(Long id){
|
||||
return ResultConvertUtil.dtoConvert(manager.findById(id));
|
||||
return manager.findById(id).map(PayChannelInfo::toDto).orElseThrow(DataNotExistException::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否启用
|
||||
*/
|
||||
public void setEnable(String code,boolean enable){
|
||||
PayChannelInfo info = manager.findByCode(code)
|
||||
.orElseThrow(DataNotExistException::new);
|
||||
info.setEnabled(enable);
|
||||
manager.updateById(info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.dto.channel.alipay;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.starter.data.perm.sensitive.SensitiveInfo;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -26,9 +27,15 @@ public class AliPayConfigDto extends BaseDto implements Serializable {
|
||||
@SensitiveInfo
|
||||
private String appId;
|
||||
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "请求网关地址")
|
||||
private String serverUrl;
|
||||
|
||||
@@ -64,9 +71,6 @@ public class AliPayConfigDto extends BaseDto implements Serializable {
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.dto.channel.wechat;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.starter.data.perm.sensitive.SensitiveInfo;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -28,6 +29,15 @@ public class WeChatPayConfigDto extends BaseDto implements Serializable {
|
||||
@SensitiveInfo
|
||||
private String wxAppId;
|
||||
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "异步通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "同步通知地址")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "商户平台「API安全」中的 APIv2 密钥")
|
||||
@SensitiveInfo
|
||||
private String apiKeyV2;
|
||||
@@ -44,21 +54,12 @@ public class WeChatPayConfigDto extends BaseDto implements Serializable {
|
||||
@SensitiveInfo
|
||||
private String p12;
|
||||
|
||||
@Schema(description = "服务器异步通知页面路径 通知url必须为直接可访问的url,不能携带参数。公网域名必须为https ")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
@Schema(description = "可用支付方式")
|
||||
private List<String> payWays;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean activity;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String state;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
@@ -3,14 +3,13 @@ package cn.bootx.platform.daxpay.service.dto.record.sync;
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
|
||||
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付同步记录
|
||||
* @author xxm
|
||||
@@ -23,44 +22,53 @@ import java.time.LocalDateTime;
|
||||
public class PaySyncRecordDto extends BaseDto {
|
||||
|
||||
/** 支付记录id */
|
||||
@Schema(description = "支付记录id")
|
||||
@Schema(description ="支付记录id")
|
||||
private Long paymentId;
|
||||
|
||||
@Schema(description = "业务号")
|
||||
/** 业务号 */
|
||||
@Schema(description ="业务号")
|
||||
private String businessNo;
|
||||
|
||||
/**
|
||||
* 同步通道
|
||||
* @see PayChannelEnum#getCode()
|
||||
*/
|
||||
@Schema(description = "同步通道")
|
||||
@Schema(description ="同步通道")
|
||||
private String asyncChannel;
|
||||
|
||||
/** 同步消息 */
|
||||
@Schema(description = "同步消息")
|
||||
/** 通知消息 */
|
||||
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
|
||||
@Schema(description ="通知消息")
|
||||
private String syncInfo;
|
||||
|
||||
/**
|
||||
* 同步状态
|
||||
* 网关返回状态
|
||||
* @see PaySyncStatusEnum
|
||||
*/
|
||||
@Schema(description = "同步状态")
|
||||
private String status;
|
||||
@Schema(description ="网关返回状态")
|
||||
private String gatewayStatus;
|
||||
|
||||
/**
|
||||
* 支付单如果状态不一致, 是否进行修复
|
||||
*/
|
||||
@DbColumn(comment = "是否进行修复")
|
||||
@Schema(description ="是否进行修复")
|
||||
private boolean repairOrder;
|
||||
|
||||
@Schema(description = "错误消息")
|
||||
/** 支付单修复前状态 */
|
||||
@Schema(description ="支付单修复前状态")
|
||||
private String beforeStatus;
|
||||
/** 支付单修复后状态 */
|
||||
@Schema(description ="支付单修复后状态")
|
||||
private String afterStatus;
|
||||
|
||||
@Schema(description ="错误消息")
|
||||
private String errorMsg;
|
||||
|
||||
/** 同步时间 */
|
||||
@Schema(description = "同步时间")
|
||||
private LocalDateTime syncTime;
|
||||
|
||||
/** 客户端IP */
|
||||
@Schema(description = "客户端IP")
|
||||
@Schema(description ="客户端IP")
|
||||
private String clientIp;
|
||||
|
||||
/** 请求链路ID */
|
||||
@Schema(description ="请求链路ID")
|
||||
private String reqId;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.system.config;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.PaySignTypeEnum;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -16,21 +15,24 @@ import lombok.experimental.Accessors;
|
||||
@Schema(title = "平台配置")
|
||||
public class PlatformConfigDto {
|
||||
|
||||
@DbColumn(comment = "网站地址")
|
||||
@Schema(description ="网站地址")
|
||||
private String websiteUrl;
|
||||
|
||||
/**
|
||||
* @see PaySignTypeEnum
|
||||
*/
|
||||
@DbColumn(comment = "签名方式")
|
||||
@Schema(description ="签名方式")
|
||||
private String signType;
|
||||
|
||||
@DbColumn(comment = "签名秘钥")
|
||||
@Schema(description ="签名秘钥")
|
||||
private String signSecret;
|
||||
|
||||
@DbColumn(comment = "支付通知地址")
|
||||
@Schema(description ="异步支付通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@DbColumn(comment = "订单默认超时时间")
|
||||
@Schema(description ="同步支付通知地址")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description ="订单默认超时时间(分钟)")
|
||||
private Integer orderTimeout;
|
||||
}
|
||||
|
@@ -18,6 +18,9 @@ public class AliPayConfigParam {
|
||||
@Schema(description = "支付宝商户appId")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问")
|
||||
private String notifyUrl;
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.param.channel.wechat;
|
||||
|
||||
import cn.bootx.platform.common.core.annotation.QueryParam;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -25,6 +26,15 @@ public class WeChatPayConfigParam {
|
||||
@Schema(description = "微信应用appId")
|
||||
private String wxAppId;
|
||||
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "异步通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description ="同步通知地址")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "商户平台「API安全」中的 APIv2 密钥")
|
||||
private String apiKeyV2;
|
||||
|
||||
@@ -37,18 +47,12 @@ public class WeChatPayConfigParam {
|
||||
@Schema(description = "API 证书中的 p12 文件")
|
||||
private String p12;
|
||||
|
||||
@Schema(description = "服务器异步通知页面路径 通知url必须为直接可访问的url,不能携带参数。公网域名必须为https ")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "是否沙箱环境")
|
||||
private boolean sandbox;
|
||||
|
||||
@Schema(description = "可用支付方式")
|
||||
private List<String> payWays;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String state;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
@@ -31,6 +31,9 @@ public class PlatformConfigParam {
|
||||
@DbColumn(comment = "支付通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description ="同步支付通知地址")
|
||||
private String returnUrl;
|
||||
|
||||
@DbColumn(comment = "订单默认超时时间")
|
||||
private Integer orderTimeout;
|
||||
}
|
||||
|
Reference in New Issue
Block a user