io.gitee.putaoo.easypay.constant.PayChannel Maven / Gradle / Ivy
package io.gitee.putaoo.easypay.constant;
import java.util.Arrays;
import java.util.Objects;
public enum PayChannel {
/**
* 支付通道
*/
ALIPAY("alipay","支付宝"),
WXPAY("wxpay","微信支付");
private String name;
private String chinese;
PayChannel(String name,String chinese){
this.name = name;
this.chinese = chinese;
}
public String getName() {
return name;
}
public String getChinese() {
return chinese;
}
public static PayChannel fromChineseName(String chinese){
return Arrays.stream(PayChannel.values())
.filter(payChannel -> Objects.equals(chinese,payChannel.getChinese()))
.findFirst()
.orElse(null);
}
}