package org.dromara.pay.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 支付渠道枚举
 *
 * @author pengles
 */
@Getter
@AllArgsConstructor
public enum PayChannelEnum {

    WX_PUB("wx_pub", "微信 JSAPI 支付"),
    WX_LITE("wx_lite", "微信小程序支付"),
    WX_APP("wx_app", "微信 App 支付"),
    WX_NATIVE("wx_native", "微信 Native 支付"),
    WX_H5("wx_h5", "微信 H5 支付"),
    ALIPAY_PC("alipay_pc", "支付宝 PC 支付"),
    ALIPAY_WAP("alipay_wap", "支付宝 Wap 支付"),
    ALIPAY_APP("alipay_app", "支付宝 App 支付"),
    ALIPAY_QR("alipay_qr", "支付宝扫码支付"),
    MOCK("mock", "模拟支付"),
    WALLET("wallet", "钱包支付");

    private final String code;
    private final String name;

    public static PayChannelEnum getByCode(String code) {
        for (PayChannelEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
