shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.walker.pay;
 
import com.walker.infrastructure.arguments.Variable;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.pay.callback.OrderCallBack;
import com.walker.pay.util.PayDefinitionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
import java.util.Map;
 
public class AbstractPayDefinition implements PayDefinition{
 
    protected final transient Logger logger = LoggerFactory.getLogger(this.getClass());
 
    private String id;
    private String name;
    private ServiceProvider serviceProvider;
    private String version;
    private PayChannel payChannel;
    private boolean enabled = true;
//    private PayEngineProvider payEngineProvider;
 
    // 2023-01-17
//    private List<Variable> configuration;
    private Map<String, Variable> configuration;
    private String payEngineProviderClass;
 
    private OrderCallBack orderCallback;
 
    private Convertor<NotifyValue<?>> orderNotifyConvertor = null;
 
    private String orderNotifyConvertorClass;
 
    @Override
    public String getOrderNotifyConvertorClass() {
        return orderNotifyConvertorClass;
    }
 
    public void setOrderNotifyConvertorClass(String orderNotifyConvertorClass) {
        this.orderNotifyConvertorClass = orderNotifyConvertorClass;
    }
 
    @Override
    public Convertor<NotifyValue<?>> getOrderNotifyConvertor() {
        return orderNotifyConvertor;
    }
 
    public void setOrderNotifyConvertor(Convertor<NotifyValue<?>> orderNotifyConvertor) {
        this.orderNotifyConvertor = orderNotifyConvertor;
    }
 
    @Override
    public OrderCallBack getOrderCallback() {
        return orderCallback;
    }
 
    public void setOrderCallback(OrderCallBack orderCallback) {
        this.orderCallback = orderCallback;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public void setServiceProvider(ServiceProvider serviceProvider) {
        this.serviceProvider = serviceProvider;
    }
 
    public void setVersion(String version) {
        this.version = version;
    }
 
    public void setPayChannel(PayChannel payChannel) {
        this.payChannel = payChannel;
    }
 
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
 
    public void setConfiguration(Map<String, Variable> configuration) {
        this.configuration = configuration;
    }
 
    public void setPayEngineProviderClass(String clazz){
        this.payEngineProviderClass = clazz;
    }
 
    @Override
    public String getId() {
        if(StringUtils.isNotEmpty(this.id)){
            return this.id;
        }
        if(this.serviceProvider == null || StringUtils.isEmpty(this.version)){
            throw new IllegalArgumentException("PayDefinition对象未设置属性: serviceProvider 或 version");
        }
//        this.id = this.serviceProvider.getIndex() + StringUtils.STRING_UNDERLINE + this.version;
        this.id = PayDefinitionUtils.getPayDefinitionId(this.serviceProvider, this.version);
        return this.id;
    }
 
    @Override
    public String getName() {
        return this.name;
    }
 
    @Override
    public ServiceProvider getServiceProvider() {
        return this.serviceProvider;
    }
 
    @Override
    public String getVersion() {
        return this.version;
    }
 
    @Override
    public PayChannel getPayChannel() {
        return this.payChannel;
    }
 
    @Override
    public boolean getEnabled() {
        return this.enabled;
    }
 
    @Override
    public Map<String, Variable> getConfiguration() {
        return this.configuration;
    }
 
//    @Override
//    public PayEngineProvider getPayEngineProvider() {
//        return this.payEngineProvider;
//    }
 
    @Override
    public String getPayEngineProviderClass(){
        return this.payEngineProviderClass;
    }
 
    @Override
    public int hashCode(){
        return this.id.hashCode();
    }
 
//    public boolean equals(Object obj){
//        if(obj == null){
//            return false;
//        }
//        if(obj instanceof ){
//
//        }
//    }
}