mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-11-28 01:06:42 +08:00
ref 调整查询和回调通知接口
This commit is contained in:
12
README.md
12
README.md
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
## 📃 文档和源码地址
|
## 📃 文档和源码地址
|
||||||
### 文档地址
|
### 文档地址
|
||||||
在 [Bootx开源文档站](https://doc.bootx.cn/) 下的支付网关(DaxPay)模块下可以进行查阅相关文档,具体链接地址如下:
|
在 [DaxPay文档站](https://doc.daxpay.cn/) 下的支付网关(DaxPay)模块下可以进行查阅相关文档,具体链接地址如下:
|
||||||
[快速指南](https://doc.bootx.cn/daxpay/guides/overview/项目介绍.html)、
|
[快速指南](https://doc.daxpay.cn/single/guides/overview/项目介绍.html)、
|
||||||
[支付对接](https://doc.bootx.cn/daxpay/gateway/overview/接口清单.html)、
|
[支付对接](https://doc.daxpay.cn/single/gateway/overview/接口清单.html)、
|
||||||
[操作手册](https://doc.bootx.cn/daxpay/admin/config/平台配置.html)
|
[操作手册](https://doc.daxpay.cn/single/admin/config/平台配置.html)
|
||||||
|
|
||||||
### 项目地址
|
### 项目地址
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
不会对原业务系统的架构产生影响。如果是Java项目,可以使用SDK简化接入流程, 其他语言可以参照中的说明使用HTTP接口方式接入。
|
不会对原业务系统的架构产生影响。如果是Java项目,可以使用SDK简化接入流程, 其他语言可以参照中的说明使用HTTP接口方式接入。
|
||||||
|
|
||||||
### Java客户端SDK
|
### Java客户端SDK
|
||||||
> SDK版本号与支付网关的版本保持一致,如果需要使用,请在pom.xml中添加如下依赖。SDK使用方式参考[SDK使用说明](https://doc.bootx.cn/daxpay/gateway/overview/SDK使用说明.html)。
|
> SDK版本号与支付网关的版本保持一致,如果需要使用,请在pom.xml中添加如下依赖。SDK使用方式参考[SDK使用说明](https://doc.daxpay.cn/single/gateway/overview/SDK使用说明.html)。
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<!-- 支付SDK -->
|
<!-- 支付SDK -->
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
### SDK调用示例
|
### SDK调用示例
|
||||||
> 此处以支付接口为例,演示业务系统如何调用支付网关进行支付,其他接口的调用方式类似,具体请参考[支付对接](https://doc.bootx.cn/daxpay/gateway/overview/接口清单.html)。
|
> 此处以支付接口为例,演示业务系统如何调用支付网关进行支付,其他接口的调用方式类似,具体请参考[支付对接](https://doc.daxpay.cn/single/gateway/overview/接口清单.html)。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package cn.daxpay.single.demo.controller;
|
package cn.daxpay.single.demo.controller;
|
||||||
|
|
||||||
import cn.bootx.platform.common.core.annotation.IgnoreAuth;
|
import cn.bootx.platform.common.core.annotation.IgnoreAuth;
|
||||||
|
import cn.daxpay.single.demo.configuration.DaxPayDemoProperties;
|
||||||
import cn.daxpay.single.sdk.model.notice.PayNoticeModel;
|
import cn.daxpay.single.sdk.model.notice.PayNoticeModel;
|
||||||
import cn.daxpay.single.sdk.model.notice.RefundNoticeModel;
|
import cn.daxpay.single.sdk.model.notice.RefundNoticeModel;
|
||||||
|
import cn.daxpay.single.sdk.util.PaySignUtil;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -26,11 +29,15 @@ import java.util.Map;
|
|||||||
@RequestMapping("/demo/callback")
|
@RequestMapping("/demo/callback")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ClientNoticeReceiveController {
|
public class ClientNoticeReceiveController {
|
||||||
|
private final DaxPayDemoProperties daxPayDemoProperties;
|
||||||
|
|
||||||
@Operation(summary = "支付消息(map接收)")
|
@Operation(summary = "支付消息(map接收)")
|
||||||
@PostMapping("/pay")
|
@PostMapping("/pay")
|
||||||
public String pay(@RequestBody Map<String,Object> map){
|
public String pay(@RequestBody Map<String,Object> map){
|
||||||
log.info("接收到支付回调消息: {}",map);
|
log.info("接收到支付回调消息: {}",map);
|
||||||
|
// 转换为对象
|
||||||
|
PayNoticeModel bean = BeanUtil.toBean(map, PayNoticeModel.class);
|
||||||
|
log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(bean, daxPayDemoProperties.getSignSecret()));
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +46,7 @@ public class ClientNoticeReceiveController {
|
|||||||
@PostMapping("/payObject")
|
@PostMapping("/payObject")
|
||||||
public String pay(@RequestBody PayNoticeModel model){
|
public String pay(@RequestBody PayNoticeModel model){
|
||||||
log.info("接收到支付回调消息: {}",model);
|
log.info("接收到支付回调消息: {}",model);
|
||||||
|
log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(model, daxPayDemoProperties.getSignSecret()));
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,13 +54,17 @@ public class ClientNoticeReceiveController {
|
|||||||
@PostMapping("/refund")
|
@PostMapping("/refund")
|
||||||
public String refund(@RequestBody Map<String,Object> map) {
|
public String refund(@RequestBody Map<String,Object> map) {
|
||||||
log.info("接收到退款回调消息: {}",map);
|
log.info("接收到退款回调消息: {}",map);
|
||||||
|
// 转换为对象
|
||||||
|
RefundNoticeModel model = BeanUtil.toBean(map, RefundNoticeModel.class);
|
||||||
|
log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(model, daxPayDemoProperties.getSignSecret()));
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "退款消息(对象)")
|
@Operation(summary = "退款消息(对象)")
|
||||||
@PostMapping("/refundObject")
|
@PostMapping("/refundObject")
|
||||||
public String refund(@RequestBody RefundNoticeModel map) {
|
public String refund(@RequestBody RefundNoticeModel model) {
|
||||||
log.info("接收到退款回调消息: {}",map);
|
log.info("接收到退款回调消息: {}",model);
|
||||||
|
log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(model, daxPayDemoProperties.getSignSecret()));
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package cn.daxpay.single.sdk.code;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付订单分账状态
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/4/16
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayOrderAllocStatusEnum {
|
||||||
|
WAITING("waiting", "待分账"),
|
||||||
|
ALLOCATION("allocation", "已分账"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final String code;
|
||||||
|
final String name;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package cn.daxpay.single.sdk.model.notice;
|
|||||||
|
|
||||||
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
||||||
import cn.daxpay.single.sdk.code.PayStatusEnum;
|
import cn.daxpay.single.sdk.code.PayStatusEnum;
|
||||||
|
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -14,7 +15,7 @@ import lombok.ToString;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
public class PayNoticeModel {
|
public class PayNoticeModel extends DaxPayResponseModel {
|
||||||
|
|
||||||
/** 订单号 */
|
/** 订单号 */
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
@@ -55,7 +56,10 @@ public class PayNoticeModel {
|
|||||||
/** 商户扩展参数,回调时会原样返回 */
|
/** 商户扩展参数,回调时会原样返回 */
|
||||||
private String attach;
|
private String attach;
|
||||||
|
|
||||||
/** 签名 */
|
/** 错误码 */
|
||||||
private String sign;
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误原因 */
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cn.daxpay.single.sdk.model.notice;
|
|||||||
|
|
||||||
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
||||||
import cn.daxpay.single.sdk.code.RefundStatusEnum;
|
import cn.daxpay.single.sdk.code.RefundStatusEnum;
|
||||||
|
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -14,7 +15,7 @@ import lombok.ToString;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
public class RefundNoticeModel {
|
public class RefundNoticeModel extends DaxPayResponseModel {
|
||||||
|
|
||||||
/** 退款号 */
|
/** 退款号 */
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
@@ -46,6 +47,9 @@ public class RefundNoticeModel {
|
|||||||
/** 商户扩展参数,回调时会原样返回 */
|
/** 商户扩展参数,回调时会原样返回 */
|
||||||
private String attach;
|
private String attach;
|
||||||
|
|
||||||
/** 签名 */
|
/** 错误码 */
|
||||||
private String sign;
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误原因 */
|
||||||
|
private String errorMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.daxpay.single.sdk.model.pay;
|
package cn.daxpay.single.sdk.model.pay;
|
||||||
|
|
||||||
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
||||||
|
import cn.daxpay.single.sdk.code.PayOrderAllocStatusEnum;
|
||||||
import cn.daxpay.single.sdk.code.PayStatusEnum;
|
import cn.daxpay.single.sdk.code.PayStatusEnum;
|
||||||
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -17,18 +18,30 @@ import lombok.ToString;
|
|||||||
@ToString
|
@ToString
|
||||||
public class PayOrderModel extends DaxPayResponseModel {
|
public class PayOrderModel extends DaxPayResponseModel {
|
||||||
|
|
||||||
/** 支付订单号 */
|
|
||||||
|
/** 订单号 */
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
/** 业务系统订单号 */
|
/** 商户订单号 */
|
||||||
private String bizOrderNo;
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
/** 通道系统交易号 */
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
/** 标题 */
|
/** 标题 */
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/** 描述 */
|
/** 描述 */
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
/** 是否支持分账 */
|
||||||
|
private Boolean allocation;
|
||||||
|
|
||||||
|
/** 是否开启自动分账, 不传输为不开启 */
|
||||||
|
private Boolean autoAllocation;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付通道
|
* 支付通道
|
||||||
* @see PayChannelEnum
|
* @see PayChannelEnum
|
||||||
@@ -52,6 +65,13 @@ public class PayOrderModel extends DaxPayResponseModel {
|
|||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账状态
|
||||||
|
* @see PayOrderAllocStatusEnum
|
||||||
|
*/
|
||||||
|
private String allocationStatus;
|
||||||
|
|
||||||
|
|
||||||
/** 支付时间 */
|
/** 支付时间 */
|
||||||
private Long payTime;
|
private Long payTime;
|
||||||
|
|
||||||
@@ -60,4 +80,10 @@ public class PayOrderModel extends DaxPayResponseModel {
|
|||||||
|
|
||||||
/** 关闭时间 */
|
/** 关闭时间 */
|
||||||
private Long closeTime;
|
private Long closeTime;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误信息 */
|
||||||
|
private String errorMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.daxpay.single.sdk.model.refund;
|
package cn.daxpay.single.sdk.model.refund;
|
||||||
|
|
||||||
|
import cn.daxpay.single.sdk.code.PayChannelEnum;
|
||||||
import cn.daxpay.single.sdk.code.RefundStatusEnum;
|
import cn.daxpay.single.sdk.code.RefundStatusEnum;
|
||||||
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
import cn.daxpay.single.sdk.net.DaxPayResponseModel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -18,27 +19,58 @@ import java.math.BigDecimal;
|
|||||||
@ToString
|
@ToString
|
||||||
public class RefundOrderModel extends DaxPayResponseModel {
|
public class RefundOrderModel extends DaxPayResponseModel {
|
||||||
|
|
||||||
|
|
||||||
|
/** 支付订单号 */
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 商户支付订单号 */
|
||||||
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
/** 通道支付订单号 */
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/** 支付标题 */
|
||||||
|
private String title;
|
||||||
|
|
||||||
/** 退款号 */
|
/** 退款号 */
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
|
|
||||||
/** 商户退款号 */
|
/** 商户退款号 */
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
/** 标题 */
|
/** 通道退款交易号 */
|
||||||
private String title;
|
private String outRefundNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款通道
|
||||||
|
* @see PayChannelEnum
|
||||||
|
*/
|
||||||
|
private String channel;
|
||||||
|
|
||||||
|
/** 订单金额 */
|
||||||
|
private Integer orderAmount;
|
||||||
|
|
||||||
/** 退款金额 */
|
/** 退款金额 */
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
/** 退款完成时间 */
|
/** 退款原因 */
|
||||||
private Long finishTime;
|
private String reason;
|
||||||
|
|
||||||
/** 退款发起时间 */
|
/** 退款发起时间 */
|
||||||
private Long refundTime;
|
private Long refundTime;
|
||||||
|
|
||||||
|
/** 退款完成时间 */
|
||||||
|
private Long finishTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款状态
|
* 退款状态
|
||||||
* @see RefundStatusEnum
|
* @see RefundStatusEnum
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误信息 */
|
||||||
|
private String errorMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class QueryPayParam extends DaxPayRequest<PayOrderModel> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String path() {
|
public String path() {
|
||||||
return "/uni/query/payOrder";
|
return "/unipay/query/payOrder";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class QueryRefundParam extends DaxPayRequest<RefundOrderModel> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String path() {
|
public String path() {
|
||||||
return "/uni/query/refundOrder";
|
return "/unipay/query/refundOrder";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ public class QueryPayOrderTest {
|
|||||||
public void testPay() {
|
public void testPay() {
|
||||||
QueryPayParam param = new QueryPayParam();
|
QueryPayParam param = new QueryPayParam();
|
||||||
|
|
||||||
param.setBizOrderNoeNo("2");
|
param.setBizOrderNoeNo("P17141882417921");
|
||||||
|
param.setClientIp("127.0.0.1");
|
||||||
|
|
||||||
DaxPayResult<PayOrderModel> execute = DaxPayKit.execute(param);
|
DaxPayResult<PayOrderModel> execute = DaxPayKit.execute(param);
|
||||||
System.out.println(execute);
|
System.out.println(execute);
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ public class QueryRefundOrderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPay() {
|
public void testRefund() {
|
||||||
QueryRefundParam param = new QueryRefundParam();
|
QueryRefundParam param = new QueryRefundParam();
|
||||||
|
|
||||||
param.setBizRefundNo("1755263825769361408");
|
param.setRefundNo("DEVR24051020531763000014");
|
||||||
|
param.setClientIp("127.0.0.1");
|
||||||
|
|
||||||
DaxPayResult<RefundOrderModel> execute = DaxPayKit.execute(param);
|
DaxPayResult<RefundOrderModel> execute = DaxPayKit.execute(param);
|
||||||
System.out.println(execute);
|
System.out.println(execute);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.daxpay.single.result.order;
|
package cn.daxpay.single.result.order;
|
||||||
|
|
||||||
import cn.daxpay.single.code.PayChannelEnum;
|
import cn.daxpay.single.code.PayChannelEnum;
|
||||||
|
import cn.daxpay.single.code.PayOrderAllocStatusEnum;
|
||||||
import cn.daxpay.single.code.PayStatusEnum;
|
import cn.daxpay.single.code.PayStatusEnum;
|
||||||
import cn.daxpay.single.result.PaymentCommonResult;
|
import cn.daxpay.single.result.PaymentCommonResult;
|
||||||
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
||||||
@@ -23,13 +24,16 @@ import java.time.LocalDateTime;
|
|||||||
@Schema(title = "支付单响应参数")
|
@Schema(title = "支付单响应参数")
|
||||||
public class PayOrderResult extends PaymentCommonResult {
|
public class PayOrderResult extends PaymentCommonResult {
|
||||||
|
|
||||||
/** 支付订单号 */
|
/** 商户订单号 */
|
||||||
|
@Schema(description = "商户订单号")
|
||||||
|
private String bizOrderNo;
|
||||||
|
|
||||||
@Schema(description = "支付订单号")
|
@Schema(description = "支付订单号")
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
/** 业务系统订单号 */
|
/** 通道系统交易号 */
|
||||||
@Schema(description = "业务号")
|
@Schema(description = "通道支付订单号")
|
||||||
private String bizOrderNo;
|
private String outOrderNo;
|
||||||
|
|
||||||
/** 标题 */
|
/** 标题 */
|
||||||
@Schema(description = "标题")
|
@Schema(description = "标题")
|
||||||
@@ -39,6 +43,14 @@ public class PayOrderResult extends PaymentCommonResult {
|
|||||||
@Schema(description = "描述")
|
@Schema(description = "描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/** 是否支持分账 */
|
||||||
|
@Schema(description = "是否需要分账")
|
||||||
|
private Boolean allocation;
|
||||||
|
|
||||||
|
/** 是否开启自动分账, 不传输为不开启 */
|
||||||
|
@Schema(description = "是否开启自动分账")
|
||||||
|
private Boolean autoAllocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付通道
|
* 支付通道
|
||||||
* @see PayChannelEnum
|
* @see PayChannelEnum
|
||||||
@@ -67,6 +79,13 @@ public class PayOrderResult extends PaymentCommonResult {
|
|||||||
@Schema(description = "支付状态")
|
@Schema(description = "支付状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账状态
|
||||||
|
* @see PayOrderAllocStatusEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "分账状态")
|
||||||
|
private String allocationStatus;
|
||||||
|
|
||||||
/** 支付时间 */
|
/** 支付时间 */
|
||||||
@Schema(description = "支付时间")
|
@Schema(description = "支付时间")
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
@@ -82,4 +101,12 @@ public class PayOrderResult extends PaymentCommonResult {
|
|||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
private LocalDateTime closeTime;
|
private LocalDateTime closeTime;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
@Schema(description = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误信息 */
|
||||||
|
@Schema(description = "错误信息")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.daxpay.single.result.order;
|
package cn.daxpay.single.result.order;
|
||||||
|
|
||||||
|
import cn.daxpay.single.code.PayChannelEnum;
|
||||||
import cn.daxpay.single.code.RefundStatusEnum;
|
import cn.daxpay.single.code.RefundStatusEnum;
|
||||||
import cn.daxpay.single.result.PaymentCommonResult;
|
import cn.daxpay.single.result.PaymentCommonResult;
|
||||||
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
||||||
@@ -9,7 +10,6 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,25 +23,74 @@ import java.time.LocalDateTime;
|
|||||||
@Schema(title = "退款订单数据")
|
@Schema(title = "退款订单数据")
|
||||||
public class RefundOrderResult extends PaymentCommonResult {
|
public class RefundOrderResult extends PaymentCommonResult {
|
||||||
|
|
||||||
|
/** 支付订单号 */
|
||||||
|
@Schema(description = "支付订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 商户支付订单号 */
|
||||||
|
@Schema(description = "商户支付订单号")
|
||||||
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
/** 通道支付订单号 */
|
||||||
|
@Schema(description = "通道支付订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/** 支付标题 */
|
||||||
|
@Schema(description = "支付标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 退款号 */
|
||||||
@Schema(description = "退款号")
|
@Schema(description = "退款号")
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
|
|
||||||
|
/** 商户退款号 */
|
||||||
@Schema(description = "商户退款号")
|
@Schema(description = "商户退款号")
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
@Schema(description = "标题")
|
/** 通道退款交易号 */
|
||||||
private String title;
|
@Schema(description = "通道退款交易号")
|
||||||
|
private String outRefundNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款通道
|
||||||
|
* @see PayChannelEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付通道")
|
||||||
|
private String channel;
|
||||||
|
|
||||||
|
/** 订单金额 */
|
||||||
|
@Schema(description = "订单金额")
|
||||||
|
private Integer orderAmount;
|
||||||
|
|
||||||
|
/** 退款金额 */
|
||||||
@Schema(description = "退款金额")
|
@Schema(description = "退款金额")
|
||||||
private BigDecimal amount;
|
private Integer amount;
|
||||||
|
|
||||||
|
/** 退款原因 */
|
||||||
|
@Schema(description = "退款原因")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/** 退款发起时间 */
|
||||||
|
@Schema(description = "退款发起时间")
|
||||||
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
|
private LocalDateTime refundTime;
|
||||||
|
|
||||||
@Schema(description = "退款完成时间")
|
@Schema(description = "退款完成时间")
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
private LocalDateTime finishTime;
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 退款状态
|
||||||
* @see RefundStatusEnum
|
* @see RefundStatusEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "退款状态")
|
@Schema(description = "退款状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
@Schema(description = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误信息 */
|
||||||
|
@Schema(description = "错误信息")
|
||||||
|
private String errorMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
@Tag(name = "统一查询接口")
|
@Tag(name = "统一查询接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/uni/query")
|
@RequestMapping("/unipay/query")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UniQueryController {
|
public class UniQueryController {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package cn.daxpay.single.service.core.order.pay.convert;
|
package cn.daxpay.single.service.core.order.pay.convert;
|
||||||
|
|
||||||
|
import cn.daxpay.single.result.order.PayOrderResult;
|
||||||
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
||||||
import cn.daxpay.single.service.core.order.pay.entity.PayOrderExtra;
|
import cn.daxpay.single.service.core.order.pay.entity.PayOrderExtra;
|
||||||
|
import cn.daxpay.single.service.core.payment.notice.result.PayNoticeResult;
|
||||||
import cn.daxpay.single.service.dto.order.pay.PayOrderDto;
|
import cn.daxpay.single.service.dto.order.pay.PayOrderDto;
|
||||||
import cn.daxpay.single.service.dto.order.pay.PayOrderExtraDto;
|
import cn.daxpay.single.service.dto.order.pay.PayOrderExtraDto;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@@ -20,4 +22,7 @@ public interface PayOrderConvert {
|
|||||||
|
|
||||||
PayOrderDto convert(PayOrder in);
|
PayOrderDto convert(PayOrder in);
|
||||||
|
|
||||||
|
PayOrderResult convertResult(PayOrder in);
|
||||||
|
|
||||||
|
PayNoticeResult convertNotice(PayOrder order);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package cn.daxpay.single.service.core.order.pay.service;
|
package cn.daxpay.single.service.core.order.pay.service;
|
||||||
|
|
||||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
|
||||||
import cn.bootx.platform.common.core.exception.ValidationFailedException;
|
|
||||||
import cn.bootx.platform.common.core.rest.PageResult;
|
import cn.bootx.platform.common.core.rest.PageResult;
|
||||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||||
import cn.daxpay.single.exception.pay.PayFailureException;
|
import cn.daxpay.single.exception.pay.PayFailureException;
|
||||||
import cn.daxpay.single.param.payment.pay.QueryPayParam;
|
import cn.daxpay.single.param.payment.pay.QueryPayParam;
|
||||||
import cn.daxpay.single.result.order.PayOrderResult;
|
import cn.daxpay.single.result.order.PayOrderResult;
|
||||||
|
import cn.daxpay.single.service.core.order.pay.convert.PayOrderConvert;
|
||||||
import cn.daxpay.single.service.core.order.pay.dao.PayOrderExtraManager;
|
import cn.daxpay.single.service.core.order.pay.dao.PayOrderExtraManager;
|
||||||
import cn.daxpay.single.service.core.order.pay.dao.PayOrderManager;
|
import cn.daxpay.single.service.core.order.pay.dao.PayOrderManager;
|
||||||
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
||||||
import cn.daxpay.single.service.dto.order.pay.PayOrderDto;
|
import cn.daxpay.single.service.dto.order.pay.PayOrderDto;
|
||||||
import cn.daxpay.single.service.param.order.PayOrderQuery;
|
import cn.daxpay.single.service.param.order.PayOrderQuery;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -83,17 +81,15 @@ public class PayOrderQueryService {
|
|||||||
public PayOrderResult queryPayOrder(QueryPayParam param) {
|
public PayOrderResult queryPayOrder(QueryPayParam param) {
|
||||||
// 校验参数
|
// 校验参数
|
||||||
if (StrUtil.isBlank(param.getBizOrderNoeNo()) && Objects.isNull(param.getOrderNo())){
|
if (StrUtil.isBlank(param.getBizOrderNoeNo()) && Objects.isNull(param.getOrderNo())){
|
||||||
throw new ValidationFailedException("业务号或支付单ID不能都为空");
|
throw new PayFailureException("业务号或支付单ID不能都为空");
|
||||||
}
|
}
|
||||||
// 查询支付单
|
// 查询支付单
|
||||||
PayOrder payOrder = this.findByBizOrOrderNo(param.getOrderNo(), param.getBizOrderNoeNo())
|
PayOrder payOrder = this.findByBizOrOrderNo(param.getOrderNo(), param.getBizOrderNoeNo())
|
||||||
.orElseThrow(() -> new DataNotExistException("未查询到支付订单"));
|
.orElseThrow(() -> new PayFailureException("未查询到支付订单"));
|
||||||
// 查询扩展数据
|
// 查询扩展数据
|
||||||
payOrderExtraManager.findById(payOrder.getId())
|
payOrderExtraManager.findById(payOrder.getId())
|
||||||
.orElseThrow(() -> new PayFailureException("支付订单不完整"));
|
.orElseThrow(() -> new PayFailureException("支付订单不完整"));
|
||||||
PayOrderResult payOrderResult = new PayOrderResult();
|
return PayOrderConvert.CONVERT.convertResult(payOrder);
|
||||||
BeanUtil.copyProperties(payOrder, payOrderResult);
|
|
||||||
return payOrderResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.daxpay.single.service.core.order.refund.convert;
|
|||||||
import cn.daxpay.single.result.order.RefundOrderResult;
|
import cn.daxpay.single.result.order.RefundOrderResult;
|
||||||
import cn.daxpay.single.service.core.order.refund.entity.RefundOrder;
|
import cn.daxpay.single.service.core.order.refund.entity.RefundOrder;
|
||||||
import cn.daxpay.single.service.core.order.refund.entity.RefundOrderExtra;
|
import cn.daxpay.single.service.core.order.refund.entity.RefundOrderExtra;
|
||||||
|
import cn.daxpay.single.service.core.payment.notice.result.RefundNoticeResult;
|
||||||
import cn.daxpay.single.service.dto.order.refund.RefundOrderDto;
|
import cn.daxpay.single.service.dto.order.refund.RefundOrderDto;
|
||||||
import cn.daxpay.single.service.dto.order.refund.RefundOrderExtraDto;
|
import cn.daxpay.single.service.dto.order.refund.RefundOrderExtraDto;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@@ -23,5 +24,5 @@ public interface RefundOrderConvert {
|
|||||||
|
|
||||||
RefundOrderResult convertResult(RefundOrder in);
|
RefundOrderResult convertResult(RefundOrder in);
|
||||||
|
|
||||||
|
RefundNoticeResult convertNotice(RefundOrder order);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class RefundOrder extends MpBaseEntity implements EntityBaseFunction<Refu
|
|||||||
private String bizOrderNo;
|
private String bizOrderNo;
|
||||||
|
|
||||||
/** 通道支付订单号 */
|
/** 通道支付订单号 */
|
||||||
@DbColumn(comment = "商户支付订单号")
|
@DbColumn(comment = "通道支付订单号")
|
||||||
private String outOrderNo;
|
private String outOrderNo;
|
||||||
|
|
||||||
/** 支付标题 */
|
/** 支付标题 */
|
||||||
@@ -51,12 +51,12 @@ public class RefundOrder extends MpBaseEntity implements EntityBaseFunction<Refu
|
|||||||
@DbColumn(comment = "退款号")
|
@DbColumn(comment = "退款号")
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
|
|
||||||
|
/** 商户退款号 */
|
||||||
@DbColumn(comment = "商户退款号")
|
@DbColumn(comment = "商户退款号")
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
|
/** 通道退款交易号 */
|
||||||
/** 三方支付系统退款交易号 */
|
@DbColumn(comment = "通道退款交易号")
|
||||||
@DbColumn(comment = "三方支付系统退款交易号")
|
|
||||||
private String outRefundNo;
|
private String outRefundNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package cn.daxpay.single.service.core.order.refund.service;
|
package cn.daxpay.single.service.core.order.refund.service;
|
||||||
|
|
||||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||||
import cn.bootx.platform.common.core.exception.ValidationFailedException;
|
|
||||||
import cn.bootx.platform.common.core.rest.PageResult;
|
import cn.bootx.platform.common.core.rest.PageResult;
|
||||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||||
|
import cn.daxpay.single.exception.pay.PayFailureException;
|
||||||
import cn.daxpay.single.param.payment.refund.QueryRefundParam;
|
import cn.daxpay.single.param.payment.refund.QueryRefundParam;
|
||||||
import cn.daxpay.single.result.order.RefundOrderResult;
|
import cn.daxpay.single.result.order.RefundOrderResult;
|
||||||
import cn.daxpay.single.service.core.order.refund.convert.RefundOrderConvert;
|
import cn.daxpay.single.service.core.order.refund.convert.RefundOrderConvert;
|
||||||
@@ -89,18 +89,11 @@ public class RefundOrderQueryService {
|
|||||||
public RefundOrderResult queryRefundOrder(QueryRefundParam param) {
|
public RefundOrderResult queryRefundOrder(QueryRefundParam param) {
|
||||||
// 校验参数
|
// 校验参数
|
||||||
if (StrUtil.isBlank(param.getRefundNo()) && Objects.isNull(param.getBizRefundNo())){
|
if (StrUtil.isBlank(param.getRefundNo()) && Objects.isNull(param.getBizRefundNo())){
|
||||||
throw new ValidationFailedException("退款号或退款ID不能都为空");
|
throw new PayFailureException("退款号或=商户退款号不能都为空");
|
||||||
}
|
}
|
||||||
// 查询退款单
|
// 查询退款单
|
||||||
RefundOrder refundOrder = null;
|
RefundOrder refundOrder = this.findByBizOrRefundNo(param.getRefundNo(), param.getBizRefundNo())
|
||||||
if (Objects.nonNull(param.getRefundNo())){
|
.orElseThrow(() -> new PayFailureException("退款订单不存在"));
|
||||||
refundOrder = refundOrderManager.findById(param.getRefundNo())
|
|
||||||
.orElseThrow(() -> new DataNotExistException("未查询到支付订单"));
|
|
||||||
}
|
|
||||||
if (Objects.isNull(refundOrder)){
|
|
||||||
refundOrder = refundOrderManager.findByRefundNo(param.getRefundNo())
|
|
||||||
.orElseThrow(() -> new DataNotExistException("未查询到支付订单"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return RefundOrderConvert.CONVERT.convertResult(refundOrder);
|
return RefundOrderConvert.CONVERT.convertResult(refundOrder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.daxpay.single.service.core.payment.notice.result;
|
package cn.daxpay.single.service.core.payment.notice.result;
|
||||||
|
|
||||||
import cn.daxpay.single.code.PayChannelEnum;
|
import cn.daxpay.single.code.PayChannelEnum;
|
||||||
|
import cn.daxpay.single.code.PayOrderAllocStatusEnum;
|
||||||
import cn.daxpay.single.code.PayStatusEnum;
|
import cn.daxpay.single.code.PayStatusEnum;
|
||||||
import cn.daxpay.single.result.PaymentCommonResult;
|
import cn.daxpay.single.result.PaymentCommonResult;
|
||||||
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer;
|
||||||
@@ -23,33 +24,54 @@ import java.time.LocalDateTime;
|
|||||||
@Schema(title = "支付异步通知类")
|
@Schema(title = "支付异步通知类")
|
||||||
public class PayNoticeResult extends PaymentCommonResult {
|
public class PayNoticeResult extends PaymentCommonResult {
|
||||||
|
|
||||||
/** 订单号 */
|
|
||||||
@Schema(description = "订单号")
|
|
||||||
private String orderNo;
|
|
||||||
|
|
||||||
/** 商户订单号 */
|
/** 商户订单号 */
|
||||||
@Schema(description = "商户订单号")
|
@Schema(description = "商户订单号")
|
||||||
private String bizOrderNo;
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
@Schema(description = "支付订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 通道系统交易号 */
|
||||||
|
@Schema(description = "通道支付订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
/** 标题 */
|
/** 标题 */
|
||||||
@Schema(description = "标题")
|
@Schema(description = "标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/** 描述 */
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 是否支持分账 */
|
||||||
|
@Schema(description = "是否需要分账")
|
||||||
|
private Boolean allocation;
|
||||||
|
|
||||||
|
/** 是否开启自动分账, 不传输为不开启 */
|
||||||
|
@Schema(description = "是否开启自动分账")
|
||||||
|
private Boolean autoAllocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付通道
|
* 支付通道
|
||||||
* @see PayChannelEnum
|
* @see PayChannelEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "支付通道")
|
@Schema(description = "异步支付通道")
|
||||||
private String channel;
|
private String channel;
|
||||||
|
|
||||||
/** 支付方式 */
|
/**
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
@Schema(description = "支付方式")
|
@Schema(description = "支付方式")
|
||||||
private String method;
|
private String method;
|
||||||
|
|
||||||
/** 支付金额 */
|
/** 金额 */
|
||||||
@Schema(description = "支付金额")
|
@Schema(description = "金额")
|
||||||
private Integer amount;
|
private Integer amount;
|
||||||
|
|
||||||
|
/** 可退款余额 */
|
||||||
|
@Schema(description = "可退款余额")
|
||||||
|
private Integer refundableBalance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付状态
|
* 支付状态
|
||||||
* @see PayStatusEnum
|
* @see PayStatusEnum
|
||||||
@@ -57,23 +79,38 @@ public class PayNoticeResult extends PaymentCommonResult {
|
|||||||
@Schema(description = "支付状态")
|
@Schema(description = "支付状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 支付成功时间 */
|
/**
|
||||||
@Schema(description = "支付成功时间")
|
* 分账状态
|
||||||
|
* @see PayOrderAllocStatusEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "分账状态")
|
||||||
|
private String allocationStatus;
|
||||||
|
|
||||||
|
/** 支付时间 */
|
||||||
|
@Schema(description = "支付时间")
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
private LocalDateTime payTime;
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
/** 支付关闭时间 */
|
/** 过期时间 */
|
||||||
@Schema(description = "支付关闭时间")
|
@Schema(description = "过期时间")
|
||||||
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
|
private LocalDateTime expiredTime;
|
||||||
|
|
||||||
|
/** 关闭时间 */
|
||||||
|
@Schema(description = "关闭时间")
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
private LocalDateTime closeTime;
|
private LocalDateTime closeTime;
|
||||||
|
|
||||||
/** 支付创建时间 */
|
|
||||||
@Schema(description = "支付创建时间")
|
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/** 商户扩展参数,回调时会原样返回 */
|
/** 商户扩展参数,回调时会原样返回 */
|
||||||
@Schema(description = "商户扩展参数,回调时会原样返回")
|
@Schema(description = "商户扩展参数,回调时会原样返回")
|
||||||
private String attach;
|
private String attach;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
@Schema(description = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误原因 */
|
||||||
|
@Schema(description = "错误原因")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ import java.time.LocalDateTime;
|
|||||||
@Schema(title = "退款通知消息")
|
@Schema(title = "退款通知消息")
|
||||||
public class RefundNoticeResult extends PaymentCommonResult {
|
public class RefundNoticeResult extends PaymentCommonResult {
|
||||||
|
|
||||||
|
/** 支付订单号 */
|
||||||
|
@Schema(description = "支付订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 商户支付订单号 */
|
||||||
|
@Schema(description = "商户支付订单号")
|
||||||
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
/** 通道支付订单号 */
|
||||||
|
@Schema(description = "通道支付订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/** 支付标题 */
|
||||||
|
@Schema(description = "支付标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
/** 退款号 */
|
/** 退款号 */
|
||||||
@Schema(description = "退款号")
|
@Schema(description = "退款号")
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
@@ -31,17 +47,39 @@ public class RefundNoticeResult extends PaymentCommonResult {
|
|||||||
@Schema(description = "商户退款号")
|
@Schema(description = "商户退款号")
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
|
/** 通道退款交易号 */
|
||||||
|
@Schema(description = "通道退款交易号")
|
||||||
|
private String outRefundNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付通道
|
* 退款通道
|
||||||
* @see PayChannelEnum
|
* @see PayChannelEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "支付通道")
|
@Schema(description = "支付通道")
|
||||||
private String channel;
|
private String channel;
|
||||||
|
|
||||||
|
/** 订单金额 */
|
||||||
|
@Schema(description = "订单金额")
|
||||||
|
private Integer orderAmount;
|
||||||
|
|
||||||
/** 退款金额 */
|
/** 退款金额 */
|
||||||
@Schema(description = "退款金额")
|
@Schema(description = "退款金额")
|
||||||
private Integer amount;
|
private Integer amount;
|
||||||
|
|
||||||
|
/** 退款原因 */
|
||||||
|
@Schema(description = "退款原因")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/** 退款发起时间 */
|
||||||
|
@Schema(description = "退款发起时间")
|
||||||
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
|
private LocalDateTime refundTime;
|
||||||
|
|
||||||
|
/** 退款完成时间 */
|
||||||
|
@Schema(description = "退款完成时间")
|
||||||
|
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款状态
|
* 退款状态
|
||||||
* @see RefundStatusEnum
|
* @see RefundStatusEnum
|
||||||
@@ -49,17 +87,15 @@ public class RefundNoticeResult extends PaymentCommonResult {
|
|||||||
@Schema(description = "退款状态")
|
@Schema(description = "退款状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 退款成功时间 */
|
|
||||||
@Schema(description = "退款成功时间")
|
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
|
||||||
private LocalDateTime finishTime;
|
|
||||||
|
|
||||||
/** 退款创建时间 */
|
|
||||||
@Schema(description = "退款创建时间")
|
|
||||||
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/** 商户扩展参数,回调时会原样返回 */
|
/** 商户扩展参数,回调时会原样返回 */
|
||||||
@Schema(description = "商户扩展参数,回调时会原样返回")
|
@Schema(description = "商户扩展参数,回调时会原样返回")
|
||||||
private String attach;
|
private String attach;
|
||||||
|
|
||||||
|
/** 错误码 */
|
||||||
|
@Schema(description = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误信息 */
|
||||||
|
@Schema(description = "错误信息")
|
||||||
|
private String errorMsg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package cn.daxpay.single.service.core.payment.notice.service;
|
|||||||
|
|
||||||
import cn.bootx.platform.common.jackson.util.JacksonUtil;
|
import cn.bootx.platform.common.jackson.util.JacksonUtil;
|
||||||
import cn.daxpay.single.service.code.ClientNoticeTypeEnum;
|
import cn.daxpay.single.service.code.ClientNoticeTypeEnum;
|
||||||
|
import cn.daxpay.single.service.core.order.pay.convert.PayOrderConvert;
|
||||||
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
import cn.daxpay.single.service.core.order.pay.entity.PayOrder;
|
||||||
import cn.daxpay.single.service.core.order.pay.entity.PayOrderExtra;
|
import cn.daxpay.single.service.core.order.pay.entity.PayOrderExtra;
|
||||||
|
import cn.daxpay.single.service.core.order.refund.convert.RefundOrderConvert;
|
||||||
import cn.daxpay.single.service.core.order.refund.entity.RefundOrder;
|
import cn.daxpay.single.service.core.order.refund.entity.RefundOrder;
|
||||||
import cn.daxpay.single.service.core.order.refund.entity.RefundOrderExtra;
|
import cn.daxpay.single.service.core.order.refund.entity.RefundOrderExtra;
|
||||||
import cn.daxpay.single.service.core.payment.common.service.PaymentAssistService;
|
import cn.daxpay.single.service.core.payment.common.service.PaymentAssistService;
|
||||||
@@ -35,19 +37,8 @@ public class ClientNoticeAssistService {
|
|||||||
public ClientNoticeTask buildPayTask(PayOrder order, PayOrderExtra orderExtra){
|
public ClientNoticeTask buildPayTask(PayOrder order, PayOrderExtra orderExtra){
|
||||||
// 获取系统签名
|
// 获取系统签名
|
||||||
paymentAssistService.initPlatform();
|
paymentAssistService.initPlatform();
|
||||||
PayNoticeResult payNoticeResult = new PayNoticeResult()
|
PayNoticeResult payNoticeResult = PayOrderConvert.CONVERT.convertNotice(order);
|
||||||
.setOrderNo(order.getOrderNo())
|
payNoticeResult.setAttach(orderExtra.getAttach());
|
||||||
.setBizOrderNo(order.getBizOrderNo())
|
|
||||||
.setTitle(order.getTitle())
|
|
||||||
.setChannel(order.getChannel())
|
|
||||||
.setMethod(order.getMethod())
|
|
||||||
.setAmount(order.getAmount())
|
|
||||||
.setPayTime(order.getPayTime())
|
|
||||||
.setCloseTime(order.getCloseTime())
|
|
||||||
.setCreateTime(order.getCreateTime())
|
|
||||||
.setStatus(order.getStatus())
|
|
||||||
.setAttach(orderExtra.getAttach());
|
|
||||||
|
|
||||||
paymentSignService.sign(payNoticeResult);
|
paymentSignService.sign(payNoticeResult);
|
||||||
return new ClientNoticeTask()
|
return new ClientNoticeTask()
|
||||||
.setUrl(orderExtra.getNotifyUrl())
|
.setUrl(orderExtra.getNotifyUrl())
|
||||||
@@ -67,22 +58,15 @@ public class ClientNoticeAssistService {
|
|||||||
// 获取系统签名
|
// 获取系统签名
|
||||||
paymentAssistService.initPlatform();
|
paymentAssistService.initPlatform();
|
||||||
// 创建退款通知内容
|
// 创建退款通知内容
|
||||||
RefundNoticeResult payNoticeResult = new RefundNoticeResult()
|
RefundNoticeResult refundNoticeResult = RefundOrderConvert.CONVERT.convertNotice(order);
|
||||||
.setRefundNo(order.getRefundNo())
|
refundNoticeResult.setAttach(orderExtra.getAttach());
|
||||||
.setBizRefundNo(order.getBizRefundNo())
|
|
||||||
.setChannel(order.getChannel())
|
|
||||||
.setAmount(order.getAmount())
|
|
||||||
.setFinishTime(order.getFinishTime())
|
|
||||||
.setCreateTime(order.getCreateTime())
|
|
||||||
.setStatus(order.getStatus())
|
|
||||||
.setAttach(orderExtra.getAttach());
|
|
||||||
|
|
||||||
// 签名
|
// 签名
|
||||||
paymentSignService.sign(payNoticeResult);
|
paymentSignService.sign(refundNoticeResult);
|
||||||
return new ClientNoticeTask()
|
return new ClientNoticeTask()
|
||||||
.setUrl(orderExtra.getNotifyUrl())
|
.setUrl(orderExtra.getNotifyUrl())
|
||||||
// 时间序列化进行了重写
|
// 时间序列化进行了重写
|
||||||
.setContent(JacksonUtil.toJson(payNoticeResult))
|
.setContent(JacksonUtil.toJson(refundNoticeResult))
|
||||||
.setNoticeType(ClientNoticeTypeEnum.REFUND.getType())
|
.setNoticeType(ClientNoticeTypeEnum.REFUND.getType())
|
||||||
.setSendCount(0)
|
.setSendCount(0)
|
||||||
.setTradeId(order.getId())
|
.setTradeId(order.getId())
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ package cn.daxpay.single.service.core.task.notice.entity;
|
|||||||
|
|
||||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||||
import cn.daxpay.single.code.PayStatusEnum;
|
|
||||||
import cn.daxpay.single.code.RefundStatusEnum;
|
|
||||||
import cn.daxpay.single.service.code.ClientNoticeTypeEnum;
|
|
||||||
import cn.daxpay.single.service.core.task.notice.convert.ClientNoticeConvert;
|
|
||||||
import cn.daxpay.single.service.dto.record.notice.ClientNoticeTaskDto;
|
|
||||||
import cn.bootx.table.modify.annotation.DbColumn;
|
import cn.bootx.table.modify.annotation.DbColumn;
|
||||||
import cn.bootx.table.modify.annotation.DbTable;
|
import cn.bootx.table.modify.annotation.DbTable;
|
||||||
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
|
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
|
||||||
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
|
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
|
||||||
|
import cn.daxpay.single.code.PayStatusEnum;
|
||||||
|
import cn.daxpay.single.code.RefundStatusEnum;
|
||||||
|
import cn.daxpay.single.service.code.ClientNoticeTypeEnum;
|
||||||
|
import cn.daxpay.single.service.core.payment.notice.result.PayNoticeResult;
|
||||||
|
import cn.daxpay.single.service.core.payment.notice.result.RefundNoticeResult;
|
||||||
|
import cn.daxpay.single.service.core.task.notice.convert.ClientNoticeConvert;
|
||||||
|
import cn.daxpay.single.service.dto.record.notice.ClientNoticeTaskDto;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -53,7 +55,11 @@ public class ClientNoticeTask extends MpBaseEntity implements EntityBaseFunction
|
|||||||
@DbColumn(comment = "交易状态")
|
@DbColumn(comment = "交易状态")
|
||||||
private String tradeStatus;
|
private String tradeStatus;
|
||||||
|
|
||||||
/** 消息内容 */
|
/**
|
||||||
|
* 消息内容
|
||||||
|
* @see PayNoticeResult
|
||||||
|
* @see RefundNoticeResult
|
||||||
|
*/
|
||||||
@DbColumn(comment = "消息内容")
|
@DbColumn(comment = "消息内容")
|
||||||
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
|
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
|
||||||
private String content;
|
private String content;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "具体支付日志基类")
|
@Schema(title = "支付订单")
|
||||||
public class PayOrderDto extends BaseDto {
|
public class PayOrderDto extends BaseDto {
|
||||||
|
|
||||||
/** 商户订单号 */
|
/** 商户订单号 */
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ public class RefundOrderDto extends BaseDto {
|
|||||||
@Schema(description = "支付订单号")
|
@Schema(description = "支付订单号")
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 通道支付订单号 */
|
||||||
|
@Schema(description = "通道支付订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
/** 商户支付订单号 */
|
/** 商户支付订单号 */
|
||||||
@Schema(description = "商户支付订单号")
|
@Schema(description = "商户支付订单号")
|
||||||
private String bizOrderNo;
|
private String bizOrderNo;
|
||||||
@@ -42,11 +46,12 @@ public class RefundOrderDto extends BaseDto {
|
|||||||
@Schema(description = "退款号")
|
@Schema(description = "退款号")
|
||||||
private String refundNo;
|
private String refundNo;
|
||||||
|
|
||||||
|
/** 商户退款号 */
|
||||||
@Schema(description = "商户退款号")
|
@Schema(description = "商户退款号")
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
/** 三方支付系统退款交易号 */
|
/** 通道退款交易号 */
|
||||||
@Schema(description = "三方支付系统退款交易号")
|
@Schema(description = "通道退款交易号")
|
||||||
private String outRefundNo;
|
private String outRefundNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ public class RefundOrderQuery extends QueryOrder {
|
|||||||
@Schema(description = "商户退款号")
|
@Schema(description = "商户退款号")
|
||||||
private String bizRefundNo;
|
private String bizRefundNo;
|
||||||
|
|
||||||
/** 三方支付系统退款交易号 */
|
/** 通道退款交易号 */
|
||||||
@Schema(description = "三方支付系统退款交易号")
|
@Schema(description = "通道退款交易号")
|
||||||
private String outRefundNo;
|
private String outRefundNo;
|
||||||
|
|
||||||
/** 支付订单ID */
|
/** 支付订单ID */
|
||||||
|
|||||||
Reference in New Issue
Block a user