mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-07 13:45:46 +08:00
doc 补充时序图
This commit is contained in:
@@ -9,8 +9,10 @@
|
||||
- [ ] 微信新增V3版本接口
|
||||
- [ ] 付款码回退到V2接口
|
||||
- [ ] 增加转账功能
|
||||
- [ ] 支付宝
|
||||
- [ ] 微信
|
||||
- [ ] 云闪付支持对账功能
|
||||
- [ ] 结算台DEMO增加云闪付示例
|
||||
- [x] 结算台DEMO增加云闪付示例
|
||||
|
||||
2.0.x 版本内容
|
||||
- [ ] 统一关闭接口增加使用撤销关闭订单
|
||||
|
||||
17
_doc/pay/支付业务时序图.puml
Normal file
17
_doc/pay/支付业务时序图.puml
Normal file
@@ -0,0 +1,17 @@
|
||||
@startuml
|
||||
autonumber
|
||||
|
||||
actor 客户 as khd
|
||||
participant 控制器 as kzq
|
||||
participant 服务类 as fwl
|
||||
participant DAO as dao
|
||||
|
||||
khd -> kzq: 发送请求
|
||||
skinparam responseMessageBelowArrow true
|
||||
kzq --> fwl ++: 组装参数
|
||||
fwl --> kzq ++: 返回功能
|
||||
kzq --> fwl --: 继续查询
|
||||
kzq --> kzq: 继续查询
|
||||
fwl --> dao ++ : 数据查询
|
||||
dao --> fwl: 查询
|
||||
@enduml
|
||||
17
_doc/pay/支付代码时序图-重复调起支付.puml
Normal file
17
_doc/pay/支付代码时序图-重复调起支付.puml
Normal file
@@ -0,0 +1,17 @@
|
||||
@startuml
|
||||
autonumber
|
||||
|
||||
actor 客户 as khd
|
||||
participant 控制器 as kzq
|
||||
participant 服务类 as fwl
|
||||
participant DAO as dao
|
||||
|
||||
khd -> kzq: 发送请求
|
||||
skinparam responseMessageBelowArrow true
|
||||
kzq --> fwl ++: 组装参数
|
||||
fwl --> kzq ++: 返回功能
|
||||
kzq --> fwl --: 继续查询
|
||||
kzq --> kzq: 继续查询
|
||||
fwl --> dao ++ : 数据查询
|
||||
dao --> fwl: 查询
|
||||
@enduml
|
||||
42
_doc/pay/支付代码时序图-首次支付.puml
Normal file
42
_doc/pay/支付代码时序图-首次支付.puml
Normal file
@@ -0,0 +1,42 @@
|
||||
@startuml
|
||||
autonumber
|
||||
skinparam responseMessageBelowArrow true
|
||||
|
||||
title 支付代码时序图-以支付宝支付为例
|
||||
|
||||
actor 客户端 as Client
|
||||
participant PayService
|
||||
participant PayOrderService
|
||||
participant PayAssistService
|
||||
participant AliPayStrategy
|
||||
participant PayStrategyFactory
|
||||
participant AliPayService
|
||||
participant ClientNoticeService
|
||||
|
||||
Client -> PayService: 发送请求
|
||||
PayService --> PayAssistService: 校验支付状态
|
||||
PayService --> PayAssistService: 初始化上下文
|
||||
PayService -> PayService: 调用首次支付方法
|
||||
PayService -> PayAssistService: 创建支付订单和扩展记录并保存
|
||||
PayService <- PayAssistService: 返回支付订单对象
|
||||
PayService -> PayService: 调用支付方法进行发起支付
|
||||
PayService -> PayStrategyFactory: 通过工厂生成对应的策略组
|
||||
PayService <- PayStrategyFactory: 返回支付策略组
|
||||
PayService -> AliPayStrategy: 执行支付前处理动作
|
||||
AliPayStrategy --> AliPayStrategy: 支付宝参数验证和反序列化通道支付参数
|
||||
AliPayStrategy -> AliPayService: 检查并获取支付宝配置, 同时校验支付相关信息
|
||||
AliPayStrategy <- AliPayService: 返回检查结果和支付配置
|
||||
PayService <- AliPayStrategy: 支付前处理完成
|
||||
AliPayStrategy -> AliPayService: 调用网关接口进行进行支付
|
||||
AliPayService -> 支付宝支付网关: 根据情况调用对应类型的支付
|
||||
AliPayService <- 支付宝支付网关: 返回支付调用结果
|
||||
AliPayStrategy <- AliPayService: 返回支付结构体或者支付结果(写到现成变量中)
|
||||
PayService <- AliPayStrategy: 支付调用完成
|
||||
PayService -> AliPayStrategy: 进行支付调用成功后处理
|
||||
AliPayStrategy --> ChannelOrderService: 保存通道支付订单
|
||||
AliPayStrategy --> ChannelOrderService: 如果已经支付完成, 保存流水记录
|
||||
PayService <- AliPayStrategy: 处理完成
|
||||
PayService --> ClientNoticeService: 如果支付成功, 发送通知
|
||||
Client <- PayService: 返回支付结果
|
||||
|
||||
@enduml
|
||||
64
_doc/reconcile/对账代码时序图-支付宝.puml
Normal file
64
_doc/reconcile/对账代码时序图-支付宝.puml
Normal file
@@ -0,0 +1,64 @@
|
||||
@startuml
|
||||
|
||||
title 对账代码时序图-以支付宝对账为例
|
||||
|
||||
skinparam responseMessageBelowArrow true
|
||||
|
||||
actor 客户端 as Client
|
||||
participant ReconcileService
|
||||
participant ReconcileOrderService
|
||||
participant ReconcileStrategy
|
||||
participant AliPayReconcileService
|
||||
participant ReconcileDiffService
|
||||
participant ReconcileOrderManager
|
||||
participant ReconcileContext
|
||||
participant ReconcileDetailManager
|
||||
participant ReconcileStrategyFactory
|
||||
participant AliGateway as 支付宝网关
|
||||
|
||||
autonumber
|
||||
Client -> ReconcileService: 发起对账请求
|
||||
|
||||
group 1. 创建对账订单
|
||||
autonumber 1
|
||||
ReconcileService -> ReconcileStrategyFactory: 构建对账策略
|
||||
ReconcileService <- ReconcileStrategyFactory: 返回对账策略对象
|
||||
ReconcileService -> ReconcileStrategy: 生成批次号
|
||||
ReconcileService <- ReconcileStrategy: 返回批次号
|
||||
ReconcileService -> ReconcileService: 创建对账订单
|
||||
ReconcileService -> ReconcileOrderManager: 保存对账订单
|
||||
ReconcileService <- ReconcileOrderManager: 返回对账订单
|
||||
end
|
||||
|
||||
group 2. 下载对账单并进行保存
|
||||
autonumber 1
|
||||
ReconcileService -> ReconcileStrategyFactory: 构建对账策略
|
||||
ReconcileService <- ReconcileStrategyFactory: 返回对账策略对象
|
||||
ReconcileService -> ReconcileStrategy: 下载对账单, 并进行解析进行保存
|
||||
ReconcileStrategy -> AliPayReconcileService: 发起对账单下载请求,获取对账单下载地址
|
||||
AliPayReconcileService -> AliGateway: 发起对账单下载请求,获取对账单下载地址
|
||||
AliPayReconcileService <- AliGateway: 返回对账单下载地址
|
||||
AliPayReconcileService -> AliGateway: 下载对账单
|
||||
AliPayReconcileService <- AliGateway: 返回对账单内容
|
||||
AliPayReconcileService -> AliPayReconcileService: 解析对账单, 同时生成通用对账单记录
|
||||
AliPayReconcileService --> ReconcileContext: 将解析后的通用对账单记录放到到上下文
|
||||
ReconcileStrategy <- AliPayReconcileService: 处理结束
|
||||
ReconcileService <- ReconcileStrategy: 处理结束
|
||||
ReconcileService <- ReconcileContext: 获取通用对账单记录
|
||||
ReconcileService --> reconcileDetailManager: 保存明细记录
|
||||
end
|
||||
|
||||
group 3. 对账单比对
|
||||
autonumber 1
|
||||
ReconcileService -> ReconcileStrategyFactory: 构建对账策略
|
||||
ReconcileService <- ReconcileStrategyFactory: 返回对账策略对象
|
||||
ReconcileService <--> ReconcileStrategy: 初始对账策略类
|
||||
ReconcileService <- ReconcileStrategy: 获取本地和网关订单数据
|
||||
ReconcileService -> ReconcileService: 比对本地和网关订单差异
|
||||
ReconcileService --> ReconcileDiffService: 保存差异记录
|
||||
|
||||
end
|
||||
autonumber 2
|
||||
Client <- ReconcileService: 返回对账结束
|
||||
|
||||
@enduml
|
||||
76
_doc/refund/退款代码时序图-全部退款.puml
Normal file
76
_doc/refund/退款代码时序图-全部退款.puml
Normal file
@@ -0,0 +1,76 @@
|
||||
@startuml
|
||||
|
||||
autonumber
|
||||
skinparam responseMessageBelowArrow true
|
||||
|
||||
title 退款代码时序图-以支付宝退款全部退款为例
|
||||
|
||||
actor 客户端 as Client
|
||||
participant RefundService
|
||||
participant RefundStrategyFactory
|
||||
participant AliRefundStrategy
|
||||
participant RefundAssistService
|
||||
participant AlipayConfigService
|
||||
participant AliRefundService
|
||||
participant PayOrderService
|
||||
participant PayChannelOrderManager
|
||||
participant PayChannelOrderService
|
||||
participant AliRecordService
|
||||
participant ClientNoticeService
|
||||
participant 支付宝网关 as AlliGateway
|
||||
|
||||
Client -> RefundService: 发起退款请求
|
||||
|
||||
group 1. 退款发起前准备
|
||||
autonumber 1
|
||||
RefundService -> RefundService: 使用适配方法发起全部退款
|
||||
RefundService <- RefundAssistService: 获取支付订单
|
||||
RefundService --> RefundAssistService: 检查退款参数, 同时补充一些数据
|
||||
RefundService --> RefundAssistService: 上下文初始化
|
||||
|
||||
RefundService -> RefundStrategyFactory: 通过工厂生成对应的策略组
|
||||
RefundService <- RefundStrategyFactory: 返回支付策略组
|
||||
|
||||
RefundService --> AliRefundStrategy: 初始化退款策略的参数
|
||||
AliRefundStrategy --> AliRefundStrategy: 执行初始化退款策略的参数
|
||||
|
||||
RefundService --> AliRefundStrategy: 退款前校验操作
|
||||
RefundService --> AliRefundStrategy: 生成通道退款订单对象
|
||||
|
||||
RefundService --> PayChannelOrderManager: 预扣支付相关订单要退款的金额并进行更新
|
||||
RefundService --> PayOrderService: 更新支付订单退款状态
|
||||
RefundService --> RefundAssistService: 创建退款相关订单,并对数据进行持久化保存
|
||||
|
||||
end
|
||||
|
||||
group 2. 退款操作
|
||||
autonumber 1
|
||||
|
||||
RefundService -> AliRefundStrategy: 退款前准备操作
|
||||
AliRefundStrategy --> AlipayConfigService: 获取并初始化支付配置信息
|
||||
RefundService <- AliRefundStrategy: 退款前准备结束
|
||||
|
||||
RefundService -> AliRefundStrategy: 执行退款策略
|
||||
AliRefundStrategy -> AliRefundService : 执行退款操作
|
||||
AliRefundService --> AlliGateway: 发送退款指令
|
||||
AliRefundService -> AliRefundStrategy: 返回结果
|
||||
RefundService <- AliRefundStrategy: 退款执行结束
|
||||
|
||||
end
|
||||
|
||||
group 3. 退款发起成功后操作
|
||||
autonumber 1
|
||||
RefundService -> AliRefundStrategy: 执行退款发起成功后操作
|
||||
AliRefundStrategy --> AliRefundStrategy: 更新退款订单数据状态
|
||||
AliRefundStrategy --> PayChannelOrderService: 更新支付通道订单中的状态属性
|
||||
AliRefundStrategy --> AliRecordService: 如果退款完成, 保存流水记录
|
||||
RefundService <- AliRefundStrategy: 执行完成
|
||||
|
||||
RefundService --> PayOrderService: 更新支付订单信息
|
||||
RefundService --> RefundAssistService: 更新退款订单和相关通道退款订单
|
||||
RefundService --> ClientNoticeService: 如果支付完成发送退款成功通知
|
||||
|
||||
end
|
||||
autonumber 2
|
||||
Client <- RefundService: 返回退款调用结果
|
||||
@enduml
|
||||
@@ -156,7 +156,6 @@ public class AliPayReconcileService {
|
||||
reconcileDetail.setOrderId(billDetail.getBatchNo())
|
||||
.setType(ReconcileTradeEnum.REFUND.getCode());
|
||||
}
|
||||
|
||||
return reconcileDetail;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,4 +27,11 @@ public class UnionPayReconcileService {
|
||||
// 下载对账单
|
||||
Map<String, Object> stringObjectMap = unionPayKit.downloadBill(date, RECONCILE_BILL_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换和保存
|
||||
*/
|
||||
public void convertAndSave(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class PayAssistService {
|
||||
/**
|
||||
* 创建并保存通道支付订单
|
||||
*/
|
||||
public void createPayChannelOrder(List<AbsPayStrategy> payStrategies) {
|
||||
public void savePayChannelOrder(List<AbsPayStrategy> payStrategies) {
|
||||
PayLocal payInfo = PaymentContextLocal.get().getPayInfo();
|
||||
List<PayChannelOrder> channelOrders = payStrategies.stream()
|
||||
.map(AbsPayStrategy::getChannelOrder)
|
||||
|
||||
@@ -9,7 +9,6 @@ import cn.bootx.platform.daxpay.result.pay.PayResult;
|
||||
import cn.bootx.platform.daxpay.service.common.context.PayLocal;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.builder.PayBuilder;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayChannelOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
|
||||
@@ -53,8 +52,6 @@ public class PayService {
|
||||
|
||||
private final ClientNoticeService clientNoticeService;
|
||||
|
||||
private final PayChannelOrderManager payChannelOrderManager;
|
||||
|
||||
private final LockTemplate lockTemplate;
|
||||
|
||||
/**
|
||||
@@ -162,7 +159,7 @@ public class PayService {
|
||||
// 4.2 支付调用成功操作, 进行扣款、创建记录类类似的操作
|
||||
strategies.forEach(AbsPayStrategy::doSuccessHandler);
|
||||
// 4.3 保存通道支付订单
|
||||
payAssistService.createPayChannelOrder(strategies);
|
||||
payAssistService.savePayChannelOrder(strategies);
|
||||
|
||||
// 5.1 如果没有异步支付, 直接进行订单完成处理
|
||||
if (PayUtil.isNotSync(payParam.getPayChannels())) {
|
||||
|
||||
Reference in New Issue
Block a user