package com.seer.teach.common.enums.pay;

import lombok.Getter;

@Getter
public enum PayOrderSourceEnum {

    /**
     * 学豆充值
     */
    STUDY_BEAN_RECHARGE(1, "学豆充值"),

    /**
     * 商城订单支付
     */
    MALL_ORDER_PAYMENT(2, "商城订单支付");

    private final Integer code;
    private final String name;

    PayOrderSourceEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }



    /**
     * 根据code获取枚举
     */
    public static PayOrderSourceEnum fromCode(Integer code) {
        for (PayOrderSourceEnum source : PayOrderSourceEnum.values()) {
            if (source.getCode().equals(code)) {
                return source;
            }
        }
        return null;
    }
}