🎨 #2985【企业微信】增加会话存档常量类型支持

This commit is contained in:
0katekate0
2023-04-22 15:51:15 +08:00
committed by GitHub
parent e2e4d345b0
commit 9e190fef36
6 changed files with 104 additions and 21 deletions

View File

@@ -1,10 +1,10 @@
package com.github.binarywang.wxpay.bean.notify;
import com.google.gson.Gson;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
/**
* 微信支付订单和退款的异步通知V3版本共用的响应类.
@@ -33,7 +33,7 @@ public class WxPayNotifyV3Response {
*/
public static String success(String msg) {
WxPayNotifyV3Response response = new WxPayNotifyV3Response(SUCCESS, msg);
return new Gson().toJson(response);
return WxGsonBuilder.create().toJson(response);
}
/**
@@ -44,7 +44,7 @@ public class WxPayNotifyV3Response {
*/
public static String fail(String msg) {
WxPayNotifyV3Response response = new WxPayNotifyV3Response(FAIL, msg);
return new Gson().toJson(response);
return WxGsonBuilder.create().toJson(response);
}
}

View File

@@ -157,6 +157,13 @@ public abstract class BaseWxPayRequest implements Serializable {
return yuan.multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP).intValue();
}
/**
* 分转元
*/
public static BigDecimal fen2Yuan(BigDecimal fen) {
return fen.divide(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
}
/**
* 检查请求参数内容,包括必填参数以及特殊约束.
*/