All Downloads are FREE. Search and download functionalities are using the official Maven repository.

matrix.business.pay.enums.PayMode Maven / Gradle / Ivy

There is a newer version: 2.1.11
Show newest version
package matrix.business.pay.enums;

import matrix.boot.common.exception.ServiceException;

/**
 * 支付方式
 *
 * @author wangcheng
 */
public enum PayMode {

    PC("PC", "WEB"),
    H5("H5", "H5"),
    APP("APP", "APP"),
    QrCode("QrCode", "QR Code"),
    WE_JSAPI("WE_JSAPI", "Wechat jsapi");

    private String code;

    private String name;

    PayMode(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据编码获取支付方式
     *
     * @param code 支付编码
     * @return 支付方式
     */
    public static PayMode getByCode(String code) {
        for (PayMode payMode : PayMode.values()) {
            if (payMode.getCode().equals(code)) {
                return payMode;
            }
        }
        throw new ServiceException("支付方式不存在");
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy