package com.xingxi.common.enums;

/**
 * @program: fmp
 * @description: 交易状态
 * @author: fmp
 * @create: 2023-10-28 22:10
 */
public enum ETradeState implements BaseEnum {

    SUCCESS("SUCCESS", "支付成功"),
    REFUND("REFUND", "转入退款"),
    NOTPAY("NOTPAY", "未支付"),
    CLOSED("CLOSED", "已关闭"),
    REVOKED("REVOKED", "已撤销（付款码支付）"),
    USERPAYING("USERPAYING", "用户支付中（付款码支付）"),
    PAYERROR("PAYERROR", "支付失败(其他原因，如银行返回失败)");

    private String val;
    private String desc;

    ETradeState(String val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    @Override
    public String getVal() {
        return val;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    /** 解析*/
    public static ETradeState parse(String val) {
        for(ETradeState type : ETradeState.values()) {
            if(type.getVal().equalsIgnoreCase(val)) {
                return type;
            }
        }
        return null;
    }
}
