支付模块,发起交易,暂时是比较 demo 的代码。未完成~
This commit is contained in:
@@ -2,13 +2,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.bo.PayTransactionSubmitBO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
|
||||
|
||||
public interface PayTransactionService {
|
||||
|
||||
CommonResult<PayTransactionBO> createTransaction(PayTransactionCreateDTO payTransactionCreateDTO);
|
||||
|
||||
CommonResult submitTransaction(); // TODO 1. params 2. result
|
||||
CommonResult<PayTransactionSubmitBO> submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO);
|
||||
|
||||
CommonResult cancelTransaction(); // TODO 1. params 2. result
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.pay.api.bo;
|
||||
|
||||
/**
|
||||
* 支付交易提交结果 BO
|
||||
*/
|
||||
public class PayTransactionSubmitBO {
|
||||
|
||||
/**
|
||||
* 支付交易拓展单编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 调用三方平台的响应结果
|
||||
*/
|
||||
private String invokeResponse;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInvokeResponse() {
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitBO setInvokeResponse(String invokeResponse) {
|
||||
this.invokeResponse = invokeResponse;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,10 @@ public enum PayChannelEnum {
|
||||
WEIXIN_APP(100, "wx", "微信 App 支付"),
|
||||
WEIXIN_PUB(100, "wx", "微信 JS API 支付"),
|
||||
|
||||
ALIPAY(200, "alipay", "微信支付");
|
||||
ALIPAY(200, "alipay", "微信支付"),
|
||||
|
||||
PINGXX(9999, "ping++", "ping++ 支付"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 渠道编号
|
||||
|
||||
@@ -12,7 +12,8 @@ public enum PayErrorCodeEnum {
|
||||
PAY_APP_IS_DISABLE(1004000001, "App 已经被禁用"),
|
||||
|
||||
// ========== TRANSACTION 模块 ==========
|
||||
|
||||
PAY_TRANSACTION_NOT_FOUND(100401000, "支付交易单不存在"),
|
||||
PAY_TRANSACTION_STATUS_IS_NOT_WAITING(100401001, "支付交易单不处于待支付"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.mall.pay.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 支付交易提交 DTO
|
||||
*/
|
||||
public class PayTransactionSubmitDTO {
|
||||
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
@NotEmpty(message = "应用编号不能为空")
|
||||
private String appId;
|
||||
/**
|
||||
* 发起交易的 IP
|
||||
*/
|
||||
@NotEmpty(message = "IP 不能为空")
|
||||
private String createIp;
|
||||
/**
|
||||
* 业务线的订单编号
|
||||
*/
|
||||
@NotEmpty(message = "订单号不能为空")
|
||||
private String orderId;
|
||||
/**
|
||||
* 支付渠道
|
||||
*/
|
||||
@NotNull(message = "支付渠道")
|
||||
private Integer payChannel;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitDTO setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateIp() {
|
||||
return createIp;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitDTO setCreateIp(String createIp) {
|
||||
this.createIp = createIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitDTO setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
public PayTransactionSubmitDTO setPayChannel(Integer payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user