package com.ruoyi.payment.domain.enums;
|
|
/**
|
* 支付渠道枚举
|
*
|
* @author ruoyi
|
*/
|
public enum PayChannel {
|
|
/** 微信支付 */
|
WECHAT("WECHAT", "微信支付"),
|
|
/** 支付宝 */
|
ALIPAY("ALIPAY", "支付宝");
|
|
private final String code;
|
private final String desc;
|
|
PayChannel(String code, String desc) {
|
this.code = code;
|
this.desc = desc;
|
}
|
|
public String getCode() {
|
return code;
|
}
|
|
public String getDesc() {
|
return desc;
|
}
|
|
public static PayChannel fromCode(String code) {
|
for (PayChannel channel : values()) {
|
if (channel.code.equals(code)) {
|
return channel;
|
}
|
}
|
throw new IllegalArgumentException("未知的支付渠道: " + code);
|
}
|
}
|