package com.jsowell.adapay.response;

import com.jsowell.common.enums.adapay.AdapayStatusEnum;
import com.jsowell.common.util.StringUtils;
import lombok.*;

/**
 * 汇付基础响应
 */
@Getter
@Setter
public class AdapayBaseResponse {
    /**
     * 当前交易结果状态，参见 状态 说明
     * @see com.jsowell.common.enums.adapay.AdapayStatusEnum
     */
    private String status;

    private String error_code;
    private String error_msg;
    private String error_type;

    public boolean isSuccess() {
        return StringUtils.equals(status, AdapayStatusEnum.SUCCEEDED.getValue());
    }

    public boolean isNotSuccess() {
        return !isSuccess();
    }

    public boolean isFailed() {
        return StringUtils.equals(status, AdapayStatusEnum.FAILED.getValue());
    }

    public boolean isNotFailed() {
        return !isFailed();
    }
}
