mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
fix: 修复退款数据中时间无法解析的异常
这个问题是 Jackson在进行反序列化的时候需要声明对Java 8 时间包的支持。 Closes #13
This commit is contained in:
@@ -33,6 +33,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -71,6 +73,8 @@ public class WechatPayCallback {
|
||||
static {
|
||||
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
|
||||
MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
SimpleModule module = new JavaTimeModule();
|
||||
MAPPER.registerModule(module);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,10 @@ package cn.felord.payment.wechat.v3.model;
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.TradeState;
|
||||
import cn.felord.payment.wechat.enumeration.TradeType;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -72,7 +74,8 @@ public class TransactionConsumeData {
|
||||
/**
|
||||
* 支付完成时间 YYYY-MM-DDTHH:mm:ss+TIMEZONE
|
||||
*/
|
||||
private String successTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
|
||||
private OffsetDateTime successTime;
|
||||
/**
|
||||
* 在 1.0.0.RELEASE 直接返回了枚举字符串,1.0.2.RELEASE 中变更为枚举
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user