feat:微信支付

This commit is contained in:
dzc committed 2026-03-10 16:42:51 +08:00
1 parent f2b185b731
commit bce4bf9ee3
27 files changed
+1224 -68

No files matched your search

@@ -14,7 +14,7 @@ import java.util.Arrays;
@Getter
public enum MiniPlatformTypeEnum {
WECAHT("10", "微信小程序"),
WECHAT("10", "微信小程序"),
ALI_PAY("20", "支付宝"),
;
@@ -6,7 +6,7 @@ import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class ThirdMinAppOAth2LoginDto {
public class ThirdMiniAppGetUniqueDto {
/**
* 小程序平台
@@ -17,4 +17,9 @@ public class ThirdMinAppOAth2LoginDto {
@NotEmpty(message = "code不能为空")
private String code;
/**
* 用户id
*/
private Long userId;
}
@@ -0,0 +1,23 @@
package com.bsd.pjcloud.thirdparty.dto.oathmini;
import com.bsd.pjcloud.thirdparty.constant.miniplatform.MiniPlatformTypeEnum;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class ThirdMiniAppOAth2LoginDto {
/**
* 小程序平台
*/
@NotNull(message = "小程序平台标识不能为空")
private MiniPlatformTypeEnum miniPlatformType;
@NotEmpty(message = "phoneCode不能为空")
private String phoneCode;
@NotEmpty(message = "userCode不能为空")
private String userCode;
}
@@ -0,0 +1,21 @@
package com.bsd.pjcloud.thirdparty.dto.oathmini.pay.wechat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 撤销订单入参
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThirdMiniWechantReverseDto {
private Long orderId;
private String wechantOrderId;
}
@@ -0,0 +1,21 @@
package com.bsd.pjcloud.thirdparty.dto.oathmini.pay.wechat;
import lombok.Data;
/**
* 查询订单入参
*/
@Data
public class ThirdMiniWechatQueryDto {
/**
* 微信订单号
*/
private String wechantOrderId;
/**
* 商户订单号
*/
private String orderId;
}
@@ -0,0 +1,27 @@
package com.bsd.pjcloud.thirdparty.dto.oathmini.pay.wechat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 退款入参
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThirdMiniWechatRefundDto {
private Long orderId;
private String wechantOrderId;
private Long refundId;
private Integer orderPrice;
private Integer refundPrice;
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.thirdparty.dto.oathmini.pay.wechat;
import lombok.Data;
/**
* 微信退款查询入参
*/
@Data
public class ThirdMiniWechatRefundQueryDto {
/**
* 退款id
*/
private String refundId;
}
@@ -9,4 +9,6 @@ public class ThirdMinAppOAth2LoginVo {
private String refreshToken;
private String errorCode;
}
@@ -0,0 +1,30 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import lombok.Data;
/**
* 微信退款回调加密的返回参数
*/
@Data
public class ThirdMiniWechantRefunCallbackSoureVo {
/**
* 公众账号ID
*/
private String appid;
/**
* 退款的商户号
*/
private String mch_id;
/**
* 随机字符串
*/
private String nonce_str;
/**
* 加密信息
*/
private String req_info;
}
@@ -0,0 +1,77 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
/**
* 微信退款回调返回参数
*/
@Data
public class ThirdMiniWechantRefunCallbackVo {
public static final String SUCCESS_CODE = "SUCCESS";
/**
* 微信订单号
*/
private String transaction_id;
/**
* 商户订单号
*/
private String out_trade_no;
/**
* 微信退款单号
*/
private String refund_id;
/**
* 商户退款单号
*/
private String out_refund_no;
/**
* 订单金额
*/
private String total_fee;
/**
* 应结订单金额
*/
private String settlement_total_fee;
/**
* 申请退款金额
*/
private String refund_fee;
/**
* 退款金额
*/
private String settlement_refund_fee;
/**
* 退款状态
*/
private String refund_status;
public boolean isAllSuccess() {
return ObjectUtil.equals(refund_status, SUCCESS_CODE);
}
public static String wechantError() {
return "<xml>" +
"<return_code><![CDATA[FAIL]]></return_code>" +
"<return_msg><![CDATA[FAIL]]></return_msg>" +
"</xml>";
}
public static String wechantSuccess() {
return "<xml>" +
" <return_code><![CDATA[SUCCESS]]></return_code>" +
" <return_msg><![CDATA[OK]]></return_msg>\n" +
"</xml>";
}
}
@@ -0,0 +1,44 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
/**
* 撤销订单返回
*/
@Data
public class ThirdMiniWechantReverseVo {
public static final String SUCCESS = "SUCCESS";
private String return_code;
private String return_msg;
private String appid;
private String mch_id;
private String nonce_str;
private String sign;
private String result_code;
private String err_code;
private String err_code_des;
private String recall;
public boolean isHttpSucess() {
return ObjectUtil.equals(ThirdMiniWechantReverseVo.SUCCESS, return_code);
}
public boolean isPaySucess() {
return ObjectUtil.equals(ThirdMiniWechantReverseVo.SUCCESS, result_code);
}
public boolean isAllSuccess() {
return isHttpSucess() && isPaySucess();
}
}
@@ -0,0 +1,125 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
/**
* 查询订单返回
*/
@Data
public class ThirdMiniWechatQueryVo {
public static final String SUCCESS = "SUCCESS";
private String return_code;
private String return_msg;
private String appid;
private String mch_id;
private String nonce_str;
private String sign;
private String result_code;
private String err_code;
private String err_code_des;
private String device_info;
/**
* 用户标识
*/
private String openid;
/**
* 是否关注公众账号
*/
private String is_subscribe;
/**
* 交易类型
*/
private String trade_type;
/**
* 交易状态
*/
private String trade_state;
/**
* 付款银行
*/
private String bank_type;
/**
* 标价金额
*/
private String total_fee;
/**
* 应结订单金额
*/
private String settlement_total_fee;
/**
* 标价币种
*/
private String fee_type;
/**
* 现金支付金额
*/
private String cash_fee;
/**
* 现金支付币种
*/
private String cash_fee_type;
/**
* 代金券金额
*/
private String coupon_fee;
/**
* 代金券使用数量
*/
private String coupon_count;
/**
* 微信支付订单号
*/
private String transaction_id;
/**
* 商户订单号
*/
private String out_trade_no;
/**
* 附加数据
*/
private String attach;
/**
* 支付完成时间
*/
private String time_end;
/**
* 交易状态描述
*/
private String trade_state_desc;
public boolean isHttpSucess() {
return ObjectUtil.equals(ThirdMiniWechatQueryVo.SUCCESS, return_code);
}
public boolean isPaySucess() {
return ObjectUtil.equals(ThirdMiniWechatQueryVo.SUCCESS, result_code);
}
}
@@ -0,0 +1,102 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
/**
* 退款返回
*/
@Data
public class ThirdMiniWechatRefundQueryVo {
public static final String SUCCESS = "SUCCESS";
/**
* 业务结果
*/
private String result_code;
/**
* 错误码
*/
private String err_code;
/**
* 错误描述
*/
private String err_code_des;
/**
* 公众账号ID
*/
private String appid;
/**
* 商户号
*/
private String mch_id;
/**
* 随机字符串
*/
private String nonce_str;
/**
* 签名
*/
private String sign;
/**
* 订单总退款次数
*/
private Long total_refund_count;
/**
* 微信订单号
*/
private String transaction_id;
/**
* 商户订单号
*/
private String out_trade_no;
/**
* 订单金额
*/
private Long total_fee;
/**
* 应结订单金额
*/
private Long settlement_total_fee;
/**
* 货币种类
*/
private String fee_type;
/**
* 现金支付金额
*/
private Long cash_fee;
/**
* 退款笔数
*/
private Long refund_count;
/**
* 退款总金额
*/
private Long refund_fee;
public boolean isHttpSucess() {
return ObjectUtil.equals(ThirdMiniWechatRefundQueryVo.SUCCESS, err_code);
}
public boolean isPaySucess() {
return ObjectUtil.equals(ThirdMiniWechatRefundQueryVo.SUCCESS, result_code);
}
}
@@ -0,0 +1,84 @@
package com.bsd.pjcloud.thirdparty.vo.oathmini.pay.wechat;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
/**
* 退款返回
*/
@Data
public class ThirdMiniWechatRefundVo {
public static final String SUCCESS = "SUCCESS";
private String return_code;
private String return_msg;
private String result_code;
private String err_code;
private String err_code_des;
private String appid;
private String mch_id;
private String nonce_str;
private String sign;
/**
* 微信支付订单号
*/
private String transaction_id;
/**
* 商户订单号
*/
private String out_trade_no;
/**
* 商户退款单号
*/
private String out_refund_no;
/**
* 微信退款单号
*/
private String refund_id;
/**
* 退款金额
*/
private String refund_fee;
/**
* 应结退款金额
*/
private String settlement_refund_fee;
/**
* 标价金额
*/
private String total_fee;
/**
* 应结订单金额
*/
private String settlement_total_fee;
public boolean isHttpSucess() {
return ObjectUtil.equals(ThirdMiniWechatRefundVo.SUCCESS, return_code);
}
public boolean isPaySucess() {
return ObjectUtil.equals(ThirdMiniWechatRefundVo.SUCCESS, result_code);
}
public boolean isAllSuccess() {
return isHttpSucess() && isPaySucess();
}
}