package com.hfkj.sysenum.order;

import lombok.Getter;

import java.util.Objects;

/**
 * 交易支付类型
 * @className: OrderPayModelEnum
 * @author: HuRui
 * @date: 2024/5/7
 **/
@Getter
public enum OrderPayTypeEnum {
    /**
     * 支付宝
     */
    type1(1, "支付宝"),
    /**
     * 微信
     */
    type2(2, "微信"),
    /**
     * 云闪付
     */
    type3(3, "云闪付"),
    /**
     * API余额
     */
    type4(4, "API余额"),
    ;

    private final int code;

    private final String name;

    OrderPayTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据类型查询数据
     * @param type
     * @return
     */
    public static OrderPayTypeEnum getDataByType(Integer type) {
        for (OrderPayTypeEnum ele : values()) {
            if (Objects.equals(type, ele.getCode())) return ele;
        }
        return null;
    }

}
