package com.iformall.enums;

/**
 * Created by Stormeye on 2018/08/09.
 */
public enum EnumPayStatus {
    PAY_STATUS_NOTPAY(-2, "未支付"),
    PAY_STATUS_UNKNOWN(-1, "未知"),
    PAY_STATUS_WAIT(0, "支付中"),
    PAY_STATUS_SUCCESS(1, "支付成功"),
    PAY_STATUS_FAIL(2, "支付错误"),
    PAY_STATUS_CANCEL(3, "取消支付"),
    PAY_STATUS_CANCEL_FAIL(4,"取消支付失败"),
    PAY_STATUS_CLOSE(5, "关闭支付订单"),
    PAY_STATUS_CLOSE_FAIL(6,"关闭支付订单失败"),
    PAY_STATUS_REVERSE(7, "撤销支付订单"),
    PAY_STATUS_REVERSE_FAIL(8,"撤销支付订单失败"),
    PAY_STATUS_REFUND(9,"支付转退款")
    ;

    public static EnumPayStatus getEnum(Integer code) {
        for (EnumPayStatus value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    private Integer code;
    private String message;

    EnumPayStatus(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
