支付模块的表的调整
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pay-service-api</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,4 +0,0 @@
|
||||
package cn.iocoder.mall.pay.api;
|
||||
|
||||
public interface PayService {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.mall.pay.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
|
||||
|
||||
public interface PayTransactionService {
|
||||
|
||||
CommonResult<PayTransactionBO> createTransaction(PayTransactionCreateDTO payTransactionCreateDTO);
|
||||
|
||||
CommonResult submitTransaction(); // TODO 1. params 2. result
|
||||
|
||||
CommonResult cancelTransaction(); // TODO 1. params 2. result
|
||||
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package cn.iocoder.mall.pay.api.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 支付交易 BO
|
||||
*/
|
||||
public class PayTransactionBO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 发起交易的 IP
|
||||
*/
|
||||
private String createIp;
|
||||
/**
|
||||
* 业务线的订单编号
|
||||
*
|
||||
* 1. 使用 String 的原因是,业务线可能使用 String 做为编号
|
||||
* 2. 每个 appId 下,orderId 唯一
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 订单商品名
|
||||
*/
|
||||
private String orderSubject;
|
||||
/**
|
||||
* 订单商品描述
|
||||
*/
|
||||
private String orderDescription;
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
private String orderMemo;
|
||||
/**
|
||||
* 支付金额,单位:分。
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 订单状态
|
||||
*
|
||||
* @see cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 交易过期时间
|
||||
*/
|
||||
private Date expireTime;
|
||||
/**
|
||||
* 回调业务线完成时间
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 成功支付的交易拓展编号
|
||||
*/
|
||||
private Integer extensionId;
|
||||
/**
|
||||
* 支付成功的支付渠道
|
||||
*
|
||||
* @see cn.iocoder.mall.pay.api.constant.PayChannelEnum
|
||||
*/
|
||||
private Integer payChannel;
|
||||
/**
|
||||
* 第三方支付成功的时间
|
||||
*/
|
||||
private Date paymentTime;
|
||||
/**
|
||||
* 收到第三方系统通知的时间
|
||||
*
|
||||
* 一般情况下,即第三方系统的异步通知
|
||||
*/
|
||||
private Date notifyTime;
|
||||
/**
|
||||
* 第三方的流水号
|
||||
*/
|
||||
private String tradeNo;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PayTransactionBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public PayTransactionBO setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateIp() {
|
||||
return createIp;
|
||||
}
|
||||
|
||||
public PayTransactionBO setCreateIp(String createIp) {
|
||||
this.createIp = createIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public PayTransactionBO setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderSubject() {
|
||||
return orderSubject;
|
||||
}
|
||||
|
||||
public PayTransactionBO setOrderSubject(String orderSubject) {
|
||||
this.orderSubject = orderSubject;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderDescription() {
|
||||
return orderDescription;
|
||||
}
|
||||
|
||||
public PayTransactionBO setOrderDescription(String orderDescription) {
|
||||
this.orderDescription = orderDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderMemo() {
|
||||
return orderMemo;
|
||||
}
|
||||
|
||||
public PayTransactionBO setOrderMemo(String orderMemo) {
|
||||
this.orderMemo = orderMemo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public PayTransactionBO setPrice(Integer price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public PayTransactionBO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public PayTransactionBO setExpireTime(Date expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getFinishTime() {
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public PayTransactionBO setFinishTime(Date finishTime) {
|
||||
this.finishTime = finishTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getExtensionId() {
|
||||
return extensionId;
|
||||
}
|
||||
|
||||
public PayTransactionBO setExtensionId(Integer extensionId) {
|
||||
this.extensionId = extensionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
public PayTransactionBO setPayChannel(Integer payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getPaymentTime() {
|
||||
return paymentTime;
|
||||
}
|
||||
|
||||
public PayTransactionBO setPaymentTime(Date paymentTime) {
|
||||
this.paymentTime = paymentTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getNotifyTime() {
|
||||
return notifyTime;
|
||||
}
|
||||
|
||||
public PayTransactionBO setNotifyTime(Date notifyTime) {
|
||||
this.notifyTime = notifyTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTradeNo() {
|
||||
return tradeNo;
|
||||
}
|
||||
|
||||
public PayTransactionBO setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public PayTransactionBO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package cn.iocoder.mall.pay.api.constant;
|
||||
/**
|
||||
* 支付通道
|
||||
*/
|
||||
public enum PayChannel {
|
||||
public enum PayChannelEnum {
|
||||
|
||||
WEIXIN_APP(100, "wx", "微信 App 支付"),
|
||||
WEIXIN_PUB(100, "wx", "微信 JS API 支付"),
|
||||
@@ -23,7 +23,7 @@ public enum PayChannel {
|
||||
*/
|
||||
private String name;
|
||||
|
||||
PayChannel(Integer id, String code, String name) {
|
||||
PayChannelEnum(Integer id, String code, String name) {
|
||||
this.id = id;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
@@ -40,4 +40,5 @@ public enum PayChannel {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,13 @@ package cn.iocoder.mall.pay.api.constant;
|
||||
*/
|
||||
public enum PayErrorCodeEnum {
|
||||
|
||||
// ========== PAY 模块 ==========
|
||||
// ========== APP 模块 ==========
|
||||
PAY_APP_NOT_FOUND(1004000000, "App 不存在"),
|
||||
PAY_APP_IS_DISABLE(1004000001, "App 已经被禁用"),
|
||||
|
||||
// ========== TRANSACTION 模块 ==========
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.mall.pay.api.constant;
|
||||
|
||||
/**
|
||||
* 支付交易通知状态枚举
|
||||
*/
|
||||
public enum PayTransactionNotifyStatusEnum {
|
||||
|
||||
WAITING(1, "等待通知"),
|
||||
SUCCESS(2, "通知成功"),
|
||||
FAILURE(3, "通知失败"), // 多次尝试,彻底失败
|
||||
REQUEST_SUCCESS(4, "请求成功,但是结果失败"),
|
||||
REQUEST_FAILURE(5, "请求失败"),
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
PayTransactionNotifyStatusEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.mall.pay.api.constant;
|
||||
|
||||
/**
|
||||
* 支付交易状态枚举
|
||||
*/
|
||||
public enum PayTransactionStatusEnum {
|
||||
|
||||
WAITTING(1, "等待支付"),
|
||||
SUCCESS(2, "支付成功"),
|
||||
CANCEL(3, "取消支付"), // 例如说,支付单超时
|
||||
;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
PayTransactionStatusEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public PayTransactionStatusEnum setValue(Integer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public PayTransactionStatusEnum setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package cn.iocoder.mall.pay.api.dto;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 支付交易创建 DTO
|
||||
*/
|
||||
public class PayTransactionCreateDTO {
|
||||
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
@NotEmpty(message = "应用编号不能为空")
|
||||
private String appId;
|
||||
/**
|
||||
* 发起交易的 IP
|
||||
*/
|
||||
@NotEmpty(message = "IP 不能为空")
|
||||
private String createIp;
|
||||
/**
|
||||
* 业务线的订单编号
|
||||
*/
|
||||
@NotEmpty(message = "订单号不能为空")
|
||||
private String orderId;
|
||||
/**
|
||||
* 订单商品名
|
||||
*/
|
||||
@NotEmpty(message = "商品名不能为空")
|
||||
@Size(max = 32, message = "商品名不能超过32")
|
||||
private String orderSubject;
|
||||
/**
|
||||
* 订单商品描述
|
||||
*/
|
||||
@NotEmpty(message = "商品描述不能为空")
|
||||
@Size(max = 128, message = "商品描述长度不能超过128")
|
||||
private String orderDescription;
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
@Size(max = 256, message = "商品描述长度不能超过256")
|
||||
private String orderMemo;
|
||||
/**
|
||||
* 支付金额,单位:分。
|
||||
*/
|
||||
@NotNull(message = "金额不能为空")
|
||||
@DecimalMin(value = "0", inclusive = false, message = "金额必须大于零")
|
||||
private Integer price;
|
||||
/**
|
||||
* 交易过期时间
|
||||
*/
|
||||
@NotNull(message = "交易过期时间不能为空")
|
||||
private Date expireTime;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateIp() {
|
||||
return createIp;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setCreateIp(String createIp) {
|
||||
this.createIp = createIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderSubject() {
|
||||
return orderSubject;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setOrderSubject(String orderSubject) {
|
||||
this.orderSubject = orderSubject;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderDescription() {
|
||||
return orderDescription;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setOrderDescription(String orderDescription) {
|
||||
this.orderDescription = orderDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderMemo() {
|
||||
return orderMemo;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setOrderMemo(String orderMemo) {
|
||||
this.orderMemo = orderMemo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setPrice(Integer price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public PayTransactionCreateDTO setExpireTime(Date expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user