package com.yiqi.common.enums;

/**
 * @author xiaohei
 * @date 2023/11/12
 */
public enum PayResult {

    // 0未支付 100 支付中等待结果   101 ：支付失败   200 成功
    wait(100, "等待支付结果"),
    fail(101, "支付失败"),
    success(200, "支付成功"),
    ;

    private final int code;
    private final String info;

    PayResult(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static PayResult getPayResult(int code) {
        for (PayResult payResult : PayResult.values()) {
            if (payResult.getCode() == code) {
                return payResult;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }
}
