1
zj
2024-06-13 8eea5be3b36875bd4ffe70e6c3a5bb07b1d829bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.yami.trading.common.constants;
 
import cn.hutool.core.util.StrUtil;
 
/**
 * 支付方式类型:0其它/1银行卡/2虚拟货币/3微信/4支付宝/5PayPal/6西联汇款/7SWIFT国际汇款
 *
 */
public enum PayMethodTypeEnum {
    // 此类支付大类对应的多语言 langKey 组装规则: pay.type.{code}
    OTHER(0, "其它"),
    BANK_CARD(1, "银行卡"),
    VIRTUAL_CURRENCY(2, "虚拟货币"),
    WX_PAY(3, "微信"),
    ALI_PAY(4, "支付宝"),
    PAYPAL(5, "PayPal"),
    WESTERN_UNION(6, "西联汇款"),
    SWIFT(7, "SWIFT国际汇款"),
    ;
 
    private int code;
 
    private String name;
 
    private PayMethodTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }
 
    public static PayMethodTypeEnum codeOf(int inputCode) {
        PayMethodTypeEnum[] values = PayMethodTypeEnum.values();
        for (PayMethodTypeEnum one : values) {
            if (one.getCode() == inputCode) {
                return one;
            }
        }
 
        return null;
    }
 
    public static PayMethodTypeEnum nameOf(String inputName) {
        if (StrUtil.isBlank(inputName)) {
            //return PayMethodTypeEnum.OTHER;
            return null;
        }
        PayMethodTypeEnum[] values = PayMethodTypeEnum.values();
        for (PayMethodTypeEnum one : values) {
            if (one.getName().equalsIgnoreCase(inputName)) {
                return one;
            }
        }
 
        return null;
    }
 
    public int getCode() {
        return code;
    }
 
    public String getName() {
        return name;
    }
}