All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.jsbintask.wxpay.response.WxPayResponse Maven / Gradle / Ivy

The newest version!
package cn.jsbintask.wxpay.response;

import cn.jsbintask.wxpay.WxPayConstants;
import cn.jsbintask.wxpay.request.AbstractWxPayRequest;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Data;
import lombok.ToString;

/**
 * @author [email protected]
 * @date 2019/9/5 17:37
 */
@Data
@JacksonXmlRootElement(localName = "xml")
@ToString(callSuper = true)
public class WxPayResponse {
    /**
     * 通信逻辑
     */
    private String returnCode;
    private String returnMsg;
    private String sign;

    /**
     * 商户信息
     */
    @JacksonXmlProperty(localName = "appid")
    private String appId;
    private String mchId;
    private String nonceStr;

    /**
     * 业务码逻辑
     */
    private String resultCode;
    private String errCode;
    private String errCodeDes;

    @JsonIgnore
    public boolean success() {
        return needCheckSign() ? WxPayConstants.SUCCESS.equals(returnCode) && WxPayConstants.SUCCESS.equals(resultCode) :
                WxPayConstants.SUCCESS.equals(returnCode) && (resultCode == null || WxPayConstants.SUCCESS.equals(resultCode));
    }

    @JsonIgnore
    private Object rawData;

    @JsonIgnore
    public boolean needCheckSign() {
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy