ref 平台配置改版. 接口配置改版. 脚手架精简, 删除无关功能

This commit is contained in:
bootx
2024-06-09 18:36:27 +08:00
parent 91b2b3d961
commit 5b49ff70dc
281 changed files with 118 additions and 12360 deletions

View File

@@ -0,0 +1,24 @@
package cn.daxpay.single.service.code;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 业务消息通知类型
* 业务系统使用什么样的方式接收异步通知消息
* @author xxm
* @since 2024/6/5
*/
@Getter
@AllArgsConstructor
public enum TradeNotifyTypeEnum {
/** http */
HTTP("http","http"),
/** websocket */
WEBSOCKET("websocket","WebSocket"),
/** mq */
MQ("mq","消息队列");
private final String code;
private final String name;
}

View File

@@ -15,12 +15,7 @@ public class ApiInfoLocal {
/** 当前支付接口编码 */
private String apiCode;
/** 是否开启通知 */
private boolean notice;
/** 回调地址 */
private String noticeUrl;
/** 请求参数是否签名 */
private boolean reqSign;
}

View File

@@ -1,32 +0,0 @@
package cn.daxpay.single.service.common.context;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 支付通知(主动发起, 用于通知客户系统)
* @author xxm
* @since 2023/12/24
*/
@Data
@Accessors(chain = true)
public class NoticeLocal {
/**
* 异步回调地址
* 如果系统关闭回调, 则通知地址为空
* 如果传输参数中不进行回调为true, 则通知地址为空
* 如果传输参数地址为空, 读取接口配置回调地址
* 如果接口配置为空, 读取系统平台配置的回调地址
*/
private String notifyUrl;
/**
* 同步回调地址, 这个一定会触发, 只有支付会触发且无法关闭
* 如果参数中不传输, 会自动读取系统平台配置的回调地址
*/
private String returnUrl;
/** 退出回调地址 */
private String quitUrl;
}

View File

@@ -12,9 +12,6 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class PaymentContext {
/** 支付接口信息 */
private final ApiInfoLocal apiInfo = new ApiInfoLocal();;
/** 平台全局配置 */
private final PlatformLocal platformInfo = new PlatformLocal();
@@ -24,9 +21,6 @@ public class PaymentContext {
/** 退款相关信息 */
private final RefundLocal refundInfo = new RefundLocal();
/** 消息通知(主动发起)相关信息 */
private final NoticeLocal noticeInfo = new NoticeLocal();
/** 回调相关信息 */
private final CallbackLocal callbackInfo = new CallbackLocal();

View File

@@ -25,8 +25,15 @@ public class PlatformLocal {
/** 签名秘钥 */
private String signSecret;
/** 支付通知地址 */
private String notifyUrl;
/** 是否对请求进行验签 */
private boolean reqSign;
/** 消息通知方式 */
private String noticeType;
/** 消息通知地址 */
private String noticeUrl;
/** 支付同步跳转地址 */
private String returnUrl;
@@ -36,4 +43,5 @@ public class PlatformLocal {
/** 支付限额 */
private Integer limitAmount;
}

View File

@@ -3,8 +3,6 @@ package cn.daxpay.single.service.common.context;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* 支付请求相关信息
* @author xxm
@@ -17,10 +15,4 @@ public class RequestLocal {
/** 客户端ip */
private String clientIp;
/** 签名 */
private String sign;
/** 请求时间,时间戳转时间 */
private LocalDateTime reqTime;
}

View File

@@ -3,7 +3,6 @@ package cn.daxpay.single.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.daxpay.single.code.PayChannelEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.service.code.AliPayCode;
import cn.daxpay.single.service.code.AliPayWay;
@@ -47,11 +46,6 @@ 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())){
payChannelConfigService.setEnable(PayChannelEnum.ALI.getCode(), param.getEnable());
}
BeanUtil.copyProperties(param, alipayConfig, CopyOptions.create().ignoreNullValue());
alipayConfigManager.updateById(alipayConfig);
}

View File

@@ -6,7 +6,6 @@ import cn.daxpay.single.param.channel.AliPayParam;
import cn.daxpay.single.param.payment.pay.PayParam;
import cn.daxpay.single.service.code.AliPayCode;
import cn.daxpay.single.service.code.AliPayWay;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.context.PayLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.channel.alipay.entity.AliPayConfig;
@@ -103,7 +102,6 @@ public class AliPayService {
* wap支付
*/
public String wapPay(String amount, PayOrder payOrder, AliPayConfig alipayConfig) {
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
model.setSubject(payOrder.getTitle());
model.setOutTradeNo(payOrder.getOrderNo());
@@ -111,8 +109,6 @@ public class AliPayService {
// 过期时间
model.setTimeExpire(PayUtil.getAliTimeExpire(payOrder.getExpiredTime()));
model.setProductCode(AliPayCode.QUICK_WAP_PAY);
// 中途退出地址
model.setQuitUrl(noticeInfo.getQuitUrl());
// 是否分账
if (payOrder.getAllocation()){
ExtendParams extendParams = new ExtendParams();

View File

@@ -2,7 +2,6 @@ package cn.daxpay.single.service.core.channel.union.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.daxpay.single.code.PayChannelEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.service.code.UnionPayWay;
import cn.daxpay.single.service.core.channel.union.dao.UnionPayConfigManager;
@@ -24,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayInputStream;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -47,11 +45,6 @@ public class UnionPayConfigService {
@Transactional(rollbackFor = Exception.class)
public void update(UnionPayConfigParam param) {
UnionPayConfig unionPayConfig = unionPayConfigManager.findById(ID).orElseThrow(() -> new DataNotExistException("支付宝配置不存在"));
// 启用或停用
if (!Objects.equals(param.getEnable(), unionPayConfig.getEnable())){
payChannelConfigService.setEnable(PayChannelEnum.UNION_PAY.getCode(), param.getEnable());
}
BeanUtil.copyProperties(param, unionPayConfig, CopyOptions.create().ignoreNullValue());
unionPayConfigManager.updateById(unionPayConfig);
}

View File

@@ -2,7 +2,6 @@ package cn.daxpay.single.service.core.channel.wallet.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.daxpay.single.code.PayChannelEnum;
import cn.daxpay.single.service.code.WalletPayWay;
import cn.daxpay.single.service.core.channel.wallet.dao.WalletConfigManager;
import cn.daxpay.single.service.core.channel.wallet.entity.WalletConfig;
@@ -15,7 +14,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -56,10 +54,6 @@ public class WalletConfigService {
@Transactional(rollbackFor = Exception.class)
public void update(WalletConfigParam param){
WalletConfig walletConfig = walletConfigManager.findById(param.getId()).orElseThrow(DataNotExistException::new);
// 启用或停用
if (!Objects.equals(param.getEnable(), walletConfig.getEnable())){
payChannelConfigService.setEnable(PayChannelEnum.WALLET.getCode(), param.getEnable());
}
BeanUtil.copyProperties(param,walletConfig);
walletConfigManager.updateById(walletConfig);
}

View File

@@ -2,11 +2,10 @@ package cn.daxpay.single.service.core.channel.wechat.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.daxpay.single.code.PayChannelEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.service.code.WeChatPayWay;
import cn.daxpay.single.service.core.channel.wechat.dao.WeChatPayConfigManager;
import cn.daxpay.single.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.service.core.system.config.service.PayChannelConfigService;
import cn.daxpay.single.service.param.channel.wechat.WeChatPayConfigParam;
import cn.hutool.core.bean.BeanUtil;
@@ -17,7 +16,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -41,10 +39,6 @@ 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())){
payChannelConfigService.setEnable(PayChannelEnum.WECHAT.getCode(), param.getEnable());
}
BeanUtil.copyProperties(param, weChatPayConfig, CopyOptions.create().ignoreNullValue());
weChatPayConfigManager.updateById(weChatPayConfig);
}

View File

@@ -6,8 +6,6 @@ import cn.daxpay.single.code.PayOrderAllocStatusEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.param.payment.allocation.AllocReceiverParam;
import cn.daxpay.single.param.payment.allocation.AllocationParam;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderDetailManager;
import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderExtraManager;
import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderManager;
@@ -180,9 +178,8 @@ public class AllocationOrderService {
allocationOrder.setId(allocId);
// 分账订单扩展
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
AllocationOrderExtra extend = new AllocationOrderExtra()
.setNotifyUrl(noticeInfo.getNotifyUrl())
.setNotifyUrl(param.getNotifyUrl())
.setAttach(param.getAttach());
extend.setId(allocId);

View File

@@ -4,7 +4,6 @@ import cn.daxpay.single.code.PayOrderAllocStatusEnum;
import cn.daxpay.single.code.PayOrderRefundStatusEnum;
import cn.daxpay.single.code.PayStatusEnum;
import cn.daxpay.single.param.payment.pay.PayParam;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
import cn.daxpay.single.service.core.order.pay.entity.PayOrderExtra;
@@ -59,11 +58,10 @@ public class PayBuilder {
* @param payOrderId 支付订单id
*/
public PayOrderExtra buildPayOrderExtra(PayParam payParam, Long payOrderId) {
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
PayOrderExtra payOrderExtra = new PayOrderExtra()
.setClientIp(payParam.getClientIp())
.setNotifyUrl(noticeInfo.getNotifyUrl())
.setReturnUrl(noticeInfo.getReturnUrl())
.setNotifyUrl(payParam.getNotifyUrl())
.setReturnUrl(payParam.getReturnUrl())
.setAttach(payParam.getAttach())
.setReqTime(payParam.getReqTime());
// 扩展参数

View File

@@ -1,20 +1,13 @@
package cn.daxpay.single.service.core.payment.allocation.service;
import cn.daxpay.single.param.payment.allocation.AllocationParam;
import cn.daxpay.single.service.common.context.ApiInfoLocal;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.context.PlatformLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderExtraManager;
import cn.daxpay.single.service.core.order.allocation.entity.AllocationOrderExtra;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 分账支撑方法
* @author xxm
@@ -28,44 +21,17 @@ public class AllocationAssistService {
private final AllocationOrderExtraManager allocationOrderExtraManager;
/**
* 初始化通知相关上下文
* 1. 异步通知参数: 读取参数配置 -> 读取接口配置 -> 读取平台参数
* 2. 同步跳转参数: 读取参数配置 -> 读取平台参数
* 3. 中途退出地址: 读取参数配置
*/
public void initNotice(AllocationParam allocationParam) {
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
ApiInfoLocal apiInfo = PaymentContextLocal.get().getApiInfo();
PlatformLocal platform = PaymentContextLocal.get()
.getPlatformInfo();
// 异步回调为开启状态
if (!Objects.equals(allocationParam.getNotNotify(), false) && apiInfo.isNotice()){
// 首先读取请求参数
noticeInfo.setNotifyUrl(allocationParam.getNotifyUrl());
// 读取接口配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())) {
noticeInfo.setNotifyUrl(apiInfo.getNoticeUrl());
}
// 读取平台配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())) {
noticeInfo.setNotifyUrl(platform.getNotifyUrl());
}
}
}
/**
* 根据新传入的分账订单更新订单和扩展信息
*/
@Transactional(rollbackFor = Exception.class)
public void updateOrder(AllocationParam allocationParam, AllocationOrderExtra orderExtra) {
// 扩展信息
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
orderExtra.setClientIp(allocationParam.getClientIp())
.setNotifyUrl(noticeInfo.getNotifyUrl())
.setNotifyUrl(allocationParam.getNotifyUrl())
.setAttach(allocationParam.getAttach())
.setClientIp(allocationParam.getClientIp())
.setReqTime(allocationParam.getReqTime());
allocationOrderExtraManager.updateById(orderExtra);
}
}

View File

@@ -74,7 +74,6 @@ public class AllocationService {
private final LockTemplate lockTemplate;
/**
* 开启分账 多次请求只会分账一次
* 优先级 分账接收方列表 > 分账组编号 > 默认分账组
@@ -83,7 +82,6 @@ public class AllocationService {
// 判断是否已经有分账订单
AllocationOrder allocationOrder = allocationOrderManager.findByBizAllocationNo(param.getBizAllocationNo())
.orElse(null);
allocationAssistService.initNotice(param);
if (Objects.nonNull(allocationOrder)){
// 重复分账
return this.retryAllocation(param, allocationOrder);

View File

@@ -5,7 +5,6 @@ import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.service.annotation.InitPaymentContext;
import cn.daxpay.single.service.core.system.config.dao.PayApiConfigManager;
import cn.daxpay.single.service.core.system.config.entity.PayApiConfig;
import cn.daxpay.single.service.core.system.config.service.PayApiConfigService;
import cn.daxpay.single.service.core.system.config.service.PlatformConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -26,8 +25,6 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor
public class InitPlatformInfoAop {
private final PayApiConfigService payApiConfigService;
private final PayApiConfigManager payApiConfigManager;
private final PlatformConfigService platformConfigService;
@@ -44,8 +41,6 @@ public class InitPlatformInfoAop {
if (!api.isEnable()){
throw new PayFailureException("该接口权限未开放");
}
// 设置接口信息
payApiConfigService.initApiInfo(api);
// 初始化平台信息
platformConfigService.initPlatform();
return pjp.proceed();

View File

@@ -31,8 +31,6 @@ public class PaymentAssistService {
*/
public void initRequest(PaymentCommonParam paymentCommonParam){
RequestLocal request = PaymentContextLocal.get().getRequestInfo();
request.setClientIp(paymentCommonParam.getClientIp())
.setSign(paymentCommonParam.getSign())
.setReqTime(paymentCommonParam.getReqTime());
request.setClientIp(paymentCommonParam.getClientIp());
}
}

View File

@@ -4,7 +4,6 @@ import cn.daxpay.single.code.PaySignTypeEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.param.PaymentCommonParam;
import cn.daxpay.single.result.PaymentCommonResult;
import cn.daxpay.single.service.common.context.ApiInfoLocal;
import cn.daxpay.single.service.common.context.PlatformLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.system.config.service.PlatformConfigService;
@@ -36,10 +35,10 @@ public class PaymentSignService {
public void verifySign(PaymentCommonParam param) {
// 先触发上下文的初始化
paymentAssistService.initContext(param);
ApiInfoLocal apiInfo = PaymentContextLocal.get().getApiInfo();
PlatformLocal platformInfo = PaymentContextLocal.get().getPlatformInfo();
// 判断当前接口是否不需要签名
if (!apiInfo.isReqSign()){
if (!platformInfo.isReqSign()){
return;
}
// 参数转换为Map对象

View File

@@ -7,8 +7,6 @@ import cn.daxpay.single.code.PayOrderRefundStatusEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.param.payment.pay.PayParam;
import cn.daxpay.single.result.pay.PayResult;
import cn.daxpay.single.service.common.context.ApiInfoLocal;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.context.PayLocal;
import cn.daxpay.single.service.common.context.PlatformLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
@@ -58,8 +56,6 @@ public class PayAssistService {
public void initPayContext(PayOrder order, PayParam payParam) {
// 初始化支付订单超时时间
this.initExpiredTime(order, payParam);
// 初始化通知相关上下文
this.initNotice(payParam);
}
@@ -93,42 +89,6 @@ public class PayAssistService {
payInfo.setExpiredTime(paymentExpiredTime);
}
/**
* 初始化通知相关上下文
* 1. 异步通知参数: 读取参数配置 -> 读取接口配置 -> 读取平台参数
* 2. 同步跳转参数: 读取参数配置 -> 读取平台参数
* 3. 中途退出地址: 读取参数配置
*/
private void initNotice(PayParam payParam) {
NoticeLocal noticeInfo = PaymentContextLocal.get()
.getNoticeInfo();
ApiInfoLocal apiInfo = PaymentContextLocal.get()
.getApiInfo();
PlatformLocal platform = PaymentContextLocal.get()
.getPlatformInfo();
// 异步回调为开启状态
if (!Objects.equals(payParam.getNotNotify(), false) && apiInfo.isNotice()) {
// 首先读取请求参数
noticeInfo.setNotifyUrl(payParam.getNotifyUrl());
// 读取接口配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())) {
noticeInfo.setNotifyUrl(apiInfo.getNoticeUrl());
}
// 读取平台配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())) {
noticeInfo.setNotifyUrl(platform.getNotifyUrl());
}
}
// 同步回调
noticeInfo.setReturnUrl(payParam.getReturnUrl());
if (StrUtil.isBlank(noticeInfo.getReturnUrl())) {
noticeInfo.setReturnUrl(platform.getNotifyUrl());
}
// 退出回调地址
noticeInfo.setQuitUrl(payParam.getQuitUrl());
}
/**
* 创建支付订单并保存, 返回支付订单
*/
@@ -161,10 +121,9 @@ public class PayAssistService {
}
// 扩展信息
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
payOrderExtra.setClientIp(payParam.getClientIp())
.setNotifyUrl(noticeInfo.getNotifyUrl())
.setReturnUrl(noticeInfo.getReturnUrl())
.setNotifyUrl(payParam.getNotifyUrl())
.setReturnUrl(payParam.getReturnUrl())
.setAttach(payParam.getAttach())
.setClientIp(payParam.getClientIp())
.setReqTime(payParam.getReqTime());

View File

@@ -7,8 +7,6 @@ import cn.daxpay.single.code.RefundStatusEnum;
import cn.daxpay.single.exception.pay.PayFailureException;
import cn.daxpay.single.param.payment.refund.RefundParam;
import cn.daxpay.single.result.pay.RefundResult;
import cn.daxpay.single.service.common.context.ApiInfoLocal;
import cn.daxpay.single.service.common.context.NoticeLocal;
import cn.daxpay.single.service.common.context.PlatformLocal;
import cn.daxpay.single.service.common.context.RefundLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
@@ -46,36 +44,6 @@ public class RefundAssistService {
private final RefundOrderExtraManager refundOrderExtraManager;
/**
* 初始化上下文
*/
public void initRefundContext(RefundParam param){
// 初始化通知相关上下文
this.initNotice(param);
}
/**
* 初始化退款通知相关上下文
*/
private void initNotice(RefundParam param) {
NoticeLocal noticeInfo = PaymentContextLocal.get().getNoticeInfo();
ApiInfoLocal apiInfo = PaymentContextLocal.get().getApiInfo();
PlatformLocal platform = PaymentContextLocal.get().getPlatformInfo();
// 异步回调为开启状态
if (!Objects.equals(param.getNotNotify(), false) && apiInfo.isNotice()){
// 首先读取请求参数
noticeInfo.setNotifyUrl(param.getNotifyUrl());
// 读取接口配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())){
noticeInfo.setNotifyUrl(apiInfo.getNoticeUrl());
}
// 读取平台配置
if (StrUtil.isBlank(noticeInfo.getNotifyUrl())){
noticeInfo.setNotifyUrl(platform.getNotifyUrl());
}
}
}
/**
* 检查并处理退款参数
*/
@@ -125,12 +93,11 @@ public class RefundAssistService {
.setReason(refundParam.getReason());
refundOrderManager.save(refundOrder);
// 生成退款扩展订单
NoticeLocal notice = PaymentContextLocal.get().getNoticeInfo();
RefundOrderExtra orderExtra = new RefundOrderExtra()
.setClientIp(refundParam.getClientIp())
.setReqTime(refundParam.getReqTime())
.setAttach(refundParam.getAttach())
.setNotifyUrl(notice.getNotifyUrl());
.setNotifyUrl(refundParam.getNotifyUrl());
orderExtra.setId(refundOrder.getId());
refundOrderExtraManager.save(orderExtra);

View File

@@ -83,8 +83,6 @@ public class RefundService {
try {
// 判断是否是首次发起退款
Optional<RefundOrder> refund = refundOrderManager.findByBizRefundNo(param.getBizRefundNo());
// 初始化退款通知上下文
refundAssistService.initRefundContext(param);
if (refund.isPresent()){
return this.repeatRefund(refund.get(),param);
} else {

View File

@@ -1,18 +0,0 @@
package cn.daxpay.single.service.core.system.config.convert;
import cn.daxpay.single.service.core.system.config.entity.WechatNoticeConfig;
import cn.daxpay.single.service.dto.system.config.WechatNoticeConfigDto;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
* @author xxm
* @since 2024/1/2
*/
@Mapper
public interface WechatNoticeConfigConvert {
WechatNoticeConfigConvert CONVERT = Mappers.getMapper(WechatNoticeConfigConvert.class);
WechatNoticeConfigDto convert(WechatNoticeConfig in);
}

View File

@@ -1,19 +0,0 @@
package cn.daxpay.single.service.core.system.config.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.daxpay.single.service.core.system.config.entity.WechatNoticeConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
/**
* 微信消息通知相关配置
* @author xxm
* @since 2023/12/24
*/
@Slf4j
@Repository
@RequiredArgsConstructor
public class WechatNoticeConfigManager extends BaseManager<WechatNoticeConfigMapper, WechatNoticeConfig> {
}

View File

@@ -1,14 +0,0 @@
package cn.daxpay.single.service.core.system.config.dao;
import cn.daxpay.single.service.core.system.config.entity.WechatNoticeConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
* @author xxm
* @since 2023/12/24
*/
@Mapper
public interface WechatNoticeConfigMapper extends BaseMapper<WechatNoticeConfig> {
}

View File

@@ -1,20 +0,0 @@
package cn.daxpay.single.service.core.system.config.entity;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 支付接口调用记录
* @author xxm
* @since 2023/12/22
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
//@DbTable(comment = "支付接口调用记录")
@TableName("pay_api_call_record")
public class PayApiCallRecord extends MpCreateEntity {
}

View File

@@ -2,11 +2,10 @@ package cn.daxpay.single.service.core.system.config.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.daxpay.single.service.code.PayApiCallBackTypeEnum;
import cn.daxpay.single.service.core.system.config.convert.PayApiConfigConvert;
import cn.daxpay.single.service.dto.system.config.PayApiConfigDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import cn.daxpay.single.service.core.system.config.convert.PayApiConfigConvert;
import cn.daxpay.single.service.dto.system.config.PayApiConfigDto;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -38,26 +37,9 @@ public class PayApiConfig extends MpBaseEntity implements EntityBaseFunction<Pay
@TableField(updateStrategy = FieldStrategy.NEVER)
private String name;
/**
* 支持回调通知
* @see PayApiCallBackTypeEnum
*/
@DbColumn(comment = "支持回调通知")
@TableField(updateStrategy = FieldStrategy.NEVER)
private boolean noticeSupport;
@DbColumn(comment = "是否启用")
private boolean enable;
@DbColumn(comment = "是否开启回调通知")
private boolean notice;
@DbColumn(comment = "默认通知地址")
private String noticeUrl;
@DbColumn(comment = "请求参数是否签名")
private boolean reqSign;
@DbColumn(comment = "备注")
private String remark;

View File

@@ -36,18 +36,6 @@ public class PayChannelConfig extends MpBaseEntity implements EntityBaseFunction
@TableField(updateStrategy = FieldStrategy.NEVER)
private String name;
/** ICON图片 */
@DbColumn(comment = "ICON图片")
private Long iconId;
/** 卡牌背景色 */
@DbColumn(comment = "卡牌背景色")
private String bgColor;
/** 是否启用 */
@DbColumn(comment = "是否启用")
private Boolean enable;
/** 备注 */
@DbColumn(comment = "备注")
private String remark;

View File

@@ -3,6 +3,7 @@ package cn.daxpay.single.service.core.system.config.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.daxpay.single.code.PaySignTypeEnum;
import cn.daxpay.single.service.code.TradeNotifyTypeEnum;
import cn.daxpay.single.service.core.system.config.convert.PlatformConfigConvert;
import cn.daxpay.single.service.dto.system.config.PlatformConfigDto;
import cn.bootx.table.modify.annotation.DbColumn;
@@ -33,18 +34,34 @@ public class PlatformConfig extends MpBaseEntity implements EntityBaseFunction<P
@DbColumn(comment = "签名方式")
private String signType;
/** 签名秘钥 */
@DbColumn(comment = "签名秘钥")
private String signSecret;
@DbColumn(comment = "支付通知地址")
/** 是否对请求进行验签 */
@DbColumn(comment = "是否对请求进行验签")
private boolean reqSign;
/**
* 消息通知方式, 目前只支持http
* @see TradeNotifyTypeEnum
*/
@DbColumn(comment = "消息通知方式")
private String notifyType;
/** 消息通知地址 */
@DbColumn(comment = "消息通知地址")
private String notifyUrl;
/** 同步支付跳转地址 */
@DbColumn(comment = "同步支付跳转地址")
private String returnUrl;
/** 支付限额 */
@DbColumn(comment = "支付限额")
private Integer limitAmount;
/** 订单默认超时时间(分钟) */
@DbColumn(comment = "订单默认超时时间(分钟)")
private Integer orderTimeout;

View File

@@ -1,52 +0,0 @@
package cn.daxpay.single.service.core.system.config.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.daxpay.single.service.core.system.config.convert.WechatNoticeConfigConvert;
import cn.daxpay.single.service.dto.system.config.WechatNoticeConfigDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 微信消息通知相关配置
* @author xxm
* @since 2023/12/24
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@DbTable(comment = "微信消息通知相关配置")
@TableName("pay_wechat_notice_config")
public class WechatNoticeConfig extends MpBaseEntity implements EntityBaseFunction<WechatNoticeConfigDto> {
@DbColumn(comment = "应用id")
private String appId;
@DbColumn(comment = "应用秘钥")
private String appSecret;
@DbColumn(comment = "公众号二维码")
private String qrUrl;
@DbColumn(comment = "OAuth2地址")
private String oauth2Url;
@DbColumn(comment = "微信校验文件名称")
private String verifyFileName;
@DbColumn(comment = "微信校验文件内容")
private String verifyFileContent;
@DbColumn(comment = "模板消息Id")
private String templateId;
@DbColumn(comment = "模板消息内容")
private String templateContent;
@DbColumn(comment = "模板消息备注")
private String templateRemark;
/**
* 转换
*/
@Override
public WechatNoticeConfigDto toDto() {
return WechatNoticeConfigConvert.CONVERT.convert(this);
}
}

View File

@@ -2,8 +2,6 @@ package cn.daxpay.single.service.core.system.config.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.util.ResultConvertUtil;
import cn.daxpay.single.service.common.context.ApiInfoLocal;
import cn.daxpay.single.service.common.local.PaymentContextLocal;
import cn.daxpay.single.service.core.system.config.dao.PayApiConfigManager;
import cn.daxpay.single.service.core.system.config.entity.PayApiConfig;
import cn.daxpay.single.service.dto.system.config.PayApiConfigDto;
@@ -49,18 +47,4 @@ public class PayApiConfigService {
public PayApiConfigDto findById(Long id){
return openApiInfoManager.findById(id).map(PayApiConfig::toDto).orElseThrow(() -> new DataNotExistException("支付接口配置信息不存在"));
}
/**
* 初始化接口上下文信息
*/
public void initApiInfo(PayApiConfig api){
// 接口信息
ApiInfoLocal apiInfoLocal = PaymentContextLocal.get().getApiInfo();
apiInfoLocal.setApiCode(api.getCode())
.setReqSign(api.isReqSign())
.setNotice(api.isNotice())
.setNoticeUrl(api.getNoticeUrl());
}
}

View File

@@ -4,9 +4,6 @@ import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.daxpay.single.service.core.system.config.dao.PayChannelConfigManager;
import cn.daxpay.single.service.core.system.config.entity.PayChannelConfig;
import cn.daxpay.single.service.dto.system.config.PayChannelConfigDto;
import cn.daxpay.single.service.param.system.payinfo.PayChannelInfoParam;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -40,23 +37,4 @@ public class PayChannelConfigService {
public PayChannelConfigDto findById(Long id){
return manager.findById(id).map(PayChannelConfig::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 设置是否启用
*/
public void setEnable(String code,boolean enable){
PayChannelConfig info = manager.findByCode(code)
.orElseThrow(DataNotExistException::new);
info.setEnable(enable);
manager.updateById(info);
}
/**
* 更新
*/
public void update(PayChannelInfoParam param){
PayChannelConfig info = manager.findById(param.getId()).orElseThrow(DataNotExistException::new);
BeanUtil.copyProperties(param,info, CopyOptions.create().ignoreNullValue());
manager.updateById(info);
}
}

View File

@@ -49,9 +49,10 @@ public class PlatformConfigService {
PlatformLocal platform = PaymentContextLocal.get().getPlatformInfo();
platform.setSignType(config.getSignType());
platform.setSignSecret(config.getSignSecret());
platform.setNotifyUrl(config.getNotifyUrl());
platform.setOrderTimeout(config.getOrderTimeout());
platform.setLimitAmount(config.getLimitAmount());
platform.setWebsiteUrl(config.getWebsiteUrl());
platform.setNoticeType(config.getNotifyType());
platform.setNoticeUrl(config.getNotifyUrl());
}
}

View File

@@ -1,41 +0,0 @@
package cn.daxpay.single.service.core.system.config.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.daxpay.single.service.core.system.config.entity.WechatNoticeConfig;
import cn.daxpay.single.service.core.system.config.dao.WechatNoticeConfigManager;
import cn.daxpay.single.service.param.system.config.WechatNoticeConfigParam;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 微信消息通知相关配置
* @author xxm
* @since 2024/1/2
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class WechatNoticeConfigService {
/** 默认配置ID */
private static final long ID = 0L;
private final WechatNoticeConfigManager wechatNoticeConfigManager;;
/**
* 获取支付平台配置
*/
public WechatNoticeConfig getConfig(){
return wechatNoticeConfigManager.findById(ID).orElseThrow(() -> new DataNotExistException("微信消息配置不存在"));
}
/**
* 更新配置
*/
public void update(WechatNoticeConfigParam param){
WechatNoticeConfig config = wechatNoticeConfigManager.findById(ID).orElseThrow(() -> new DataNotExistException("微信消息配置不存在"));
BeanUtil.copyProperties(param,config);
wechatNoticeConfigManager.updateById(config);
}
}

View File

@@ -1,7 +1,6 @@
package cn.daxpay.single.service.dto.system.config;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.daxpay.single.service.code.PayApiCallBackTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -27,25 +26,9 @@ public class PayApiConfigDto extends BaseDto {
@Schema(description = "名称")
private String name;
/**
* 是否支持回调通知
* @see PayApiCallBackTypeEnum
*/
@Schema(description = "是否支持回调通知")
private boolean noticeSupport;
@Schema(description = "是否启用")
private boolean enable;
@Schema(description = "是否开启回调通知")
private boolean notice;
@Schema(description = "默认通知回调地址")
private String noticeUrl;
@Schema(description = "请求参数是否签名")
private boolean reqSign;
@Schema(description = "备注")
private String remark;

View File

@@ -1,7 +1,6 @@
package cn.daxpay.single.service.dto.system.config;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -26,18 +25,6 @@ public class PayChannelConfigDto extends BaseDto {
@Schema(description = "名称")
private String name;
/** 是否启用 */
@Schema(description = "是否启用")
private Boolean enable;
/** logo图片 */
@Schema(description = "logo图片")
private Long iconId;
/** 卡牌背景色 */
@Schema(description = "卡牌背景色")
private String bgColor;
/** 备注 */
@Schema(description = "备注")
private String remark;

View File

@@ -1,6 +1,7 @@
package cn.daxpay.single.service.dto.system.config;
import cn.daxpay.single.code.PaySignTypeEnum;
import cn.daxpay.single.service.code.TradeNotifyTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -19,6 +20,7 @@ public class PlatformConfigDto {
private String websiteUrl;
/**
* 签名方式
* @see PaySignTypeEnum
*/
@Schema(description = "签名方式")
@@ -27,7 +29,20 @@ public class PlatformConfigDto {
@Schema(description = "签名秘钥")
private String signSecret;
@Schema(description = "异步支付通知地址")
/** 是否对请求进行验签 */
@Schema(description = "是否对请求进行验签")
private boolean reqSign;
/**
* 消息通知方式, 目前只支持http
* @see TradeNotifyTypeEnum
*/
@Schema(description = "消息通知方式")
private String notifyType;
/** 消息通知地址 */
@Schema(description = "消息通知地址")
private String notifyUrl;
@Schema(description = "同步支付跳转地址")
@@ -36,6 +51,6 @@ public class PlatformConfigDto {
@Schema(description = "订单默认超时时间(分钟)")
private Integer orderTimeout;
@Schema(description = "订单默认超时时间(分钟)")
@Schema(description = "支付限额")
private Integer limitAmount;
}

View File

@@ -1,16 +0,0 @@
package cn.daxpay.single.service.dto.system.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 微信消息通知相关配置
* @author xxm
* @since 2024/1/2
*/
@Data
@Accessors(chain = true)
@Schema(title = "微信消息通知相关配置")
public class WechatNoticeConfigDto {
}

View File

@@ -20,15 +20,6 @@ public class PayApiConfigParam {
@Schema(description = "是否启用")
private boolean enable;
@Schema(description = "是否开启回调通知")
private boolean notice;
@Schema(description = "默认回调地址")
private String noticeUrl;
@Schema(description = "请求参数是否签名")
private boolean reqSign;
@Schema(description = "备注")
private String remark;
}

View File

@@ -1,6 +1,7 @@
package cn.daxpay.single.service.param.system.config;
import cn.daxpay.single.code.PaySignTypeEnum;
import cn.daxpay.single.service.code.TradeNotifyTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -18,6 +19,10 @@ public class PlatformConfigParam {
@Schema(description = "网站地址")
private String websiteUrl;
/** 是否对请求进行验签 */
@Schema(description = "是否对请求进行验签")
private boolean reqSign;
/**
* @see PaySignTypeEnum
*/
@@ -27,7 +32,16 @@ public class PlatformConfigParam {
@Schema(description = "签名秘钥")
private String signSecret;
@Schema(description = "支付通知地址")
/**
* 消息通知方式, 目前只支持http
* @see TradeNotifyTypeEnum
*/
@Schema(description = "消息通知方式")
private String notifyType;
/** 消息通知地址 */
@Schema(description = "消息通知地址")
private String notifyUrl;
@Schema(description = "同步支付跳转地址")

View File

@@ -1,16 +0,0 @@
package cn.daxpay.single.service.param.system.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 微信消息通知相关配置
* @author xxm
* @since 2024/1/2
*/
@Data
@Accessors(chain = true)
@Schema(title = "微信消息通知相关配置")
public class WechatNoticeConfigParam {
}