/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.yixiang.co
 */
package co.yixiang.yshop.module.pay.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author hupeng
 * 支付相关枚举
 */
@Getter
@AllArgsConstructor
public enum PayTypeEnum {

    WEIXIN("weixin", "微信支付"),
    WEIXIN_H5("weixin_h5", "微信H5支付"),
    WEIXIN_APPLET("weixin_applet", "微信小程序支付"),
    WEIXIN_APP("weixin_app", "微信app支付"),

    YUE("yue", "余额支付"),
    INTEGRAL("integral", "积分兑换");


    private String type;

    private String desc;

    public static PayTypeEnum toType(String type) {
        return Stream.of(PayTypeEnum.values())
                .filter(p -> p.type.equals(type))
                .findAny()
                .orElse(null);
    }

}
