package com.qxgmat.data.constants.enums.trade;

/**
 * Created by gaojie on 2017/11/20.
 */
public enum PayType {
    CASH("cash"),
    ALIPAY("alipay"),
    WECHAT("wechat")
    ;
    final static public String message = "支付类型";

    public String key ;
    private PayType(String value){
        this.key = value;
    }

    public static PayType ValueOf(String name){
        if (name == null) return null;
        return PayType.valueOf(name.toUpperCase());
    }

    public static PayType FromChannel(PayChannel channel){
        if (channel == null) return null;
        switch (channel){
            case ALIPAY_APP:
            case ALIPAY_QR:
                return PayType.ALIPAY;
            case WECHAT_APP:
            case WECHAT_QR:
                return PayType.WECHAT;
            case OFFLINE:
            default:
                return PayType.CASH;
        }
    }
}
