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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
package com.walker.pay.support;
 
import com.walker.infrastructure.utils.StringUtils;
import com.walker.pay.Order;
import com.walker.pay.PayStatus;
import com.walker.pay.PayType;
import com.walker.pay.ServiceProvider;
import com.walker.pay.SplitAccount;
 
import java.util.List;
 
public class DefaultOrder implements Order {
 
    private long id = 0;
    private String payDefinitionId = null;
    private String tradeNo = null;
    private PayType payType = null;
    private long totalMoney = 0;
    private String title = null;
    private String nonce = null;
    private String notifyUrl = null;
    private String attach = null;
    private String ip = StringUtils.EMPTY_STRING;
 
    private ServiceProvider serviceProvider;
    private String version;
 
    @Override
    public String getIdString() {
//        if(StringUtils.isNotEmpty(this.idString)){
//            return idString;
//        }
//        return String.valueOf(this.id);
        return idString;
    }
 
    public void setIdString(String idString) {
//        if(this.id > 0){
//            throw new IllegalArgumentException("id已经设置,不能再次设置id字符串!");
//        }
//        if(StringUtils.isNumeric(idString)){
//            this.id = Long.parseLong(idString);
//        }
        this.idString = idString;
    }
 
    private String idString;
 
    public void setId(long id) {
        if(StringUtils.isNotEmpty(this.idString)){
            throw new IllegalArgumentException("idString已经设置,无需重复设置id");
        }
        this.id = id;
    }
 
    /**
     * 订单不用再设置'支付定义ID',由 <cod>PayEngineManager</cod> 根据 ServiceProvider 和 PayType 查找获得。
     * @param payDefinitionId
     * @date 2023-02-20
     * @date 2023-02-23 在查询订单状态时,需要从数据库获取支付定义信息。
     */
    public void setPayDefinitionId(String payDefinitionId) {
        this.payDefinitionId = payDefinitionId;
    }
 
    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }
 
    public void setPayType(PayType payType) {
        this.payType = payType;
    }
 
    public void setTotalMoney(long totalMoney) {
        this.totalMoney = totalMoney;
    }
 
    public void setTitle(String title) {
        this.title = title;
    }
 
    public void setNonce(String nonce) {
        this.nonce = nonce;
    }
 
    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }
 
    public void setAttach(String attach) {
        this.attach = attach;
    }
 
    public void setIp(String ip) {
        this.ip = ip;
    }
 
    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }
 
    public void setServiceProvider(ServiceProvider serviceProvider){
        this.serviceProvider = serviceProvider;
    }
    public void setVersion(String version){
        this.version = version;
    }
 
    private long createTime = 0;
 
    @Override
    public long getId() {
        return this.id;
    }
 
    @Override
    public String getPayDefinitionId() {
        return this.payDefinitionId;
    }
 
    @Override
    public ServiceProvider getServiceProvider() {
        return this.serviceProvider;
    }
 
    @Override
    public String getVersion() {
        return this.version;
    }
 
    @Override
    public String getTradeNo() {
        return this.tradeNo;
    }
 
    @Override
    public PayType getPayType() {
        return this.payType;
    }
 
    @Override
    public long getTotalMoney() {
        return this.totalMoney;
    }
 
    @Override
    public String getTitle() {
        return this.title;
    }
 
    @Override
    public String getNonce() {
        return this.nonce;
    }
 
    @Override
    public String getNotifyUrl() {
        return this.notifyUrl;
    }
 
    @Override
    public String getAttach() {
        return this.attach;
    }
 
    @Override
    public String getIp() {
        return this.ip;
    }
 
    @Override
    public long getCreateTime() {
        return this.createTime;
    }
 
    @Override
    public String getDeviceInfo() {
        return this.deviceInfo;
    }
 
    @Override
    public long getFee() {
        return this.fee;
    }
 
    @Override
    public String getBuyerId() {
        return this.buyerId;
    }
 
    @Override
    public String getReceiverId() {
        return this.receiverId;
    }
 
    @Override
    public PayStatus getPayStatus() {
        return this.payStatus;
    }
 
    @Override
    public List<SplitAccount> getSplitAccountList() {
        return this.splitAccountList;
    }
 
    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }
 
    public void setFee(long fee) {
        this.fee = fee;
    }
 
    public void setBuyerId(String buyerId) {
        this.buyerId = buyerId;
    }
 
    public void setReceiverId(String receiverId) {
        this.receiverId = receiverId;
    }
 
    public void setPayStatus(PayStatus payStatus) {
        this.payStatus = payStatus;
    }
 
    public void setSplitAccountList(List<SplitAccount> splitAccountList) {
        this.splitAccountList = splitAccountList;
    }
 
    private List<SplitAccount> splitAccountList;
    private PayStatus payStatus = null;
    private String deviceInfo;
    private long fee = 0;
    private String buyerId;
    private String receiverId;
 
    @Override
    public String toString(){
        return new StringBuilder("[id=").append(this.id)
                .append(", tradeNo=").append(this.tradeNo)
                .append(", payType=").append(this.payType)
                .append(", totalMoney=").append(this.totalMoney)
                .append(", title=").append(this.title)
                .append(", payDefinitionId=").append(this.payDefinitionId)
                .append(", buyerId=").append(this.buyerId)
                .append(", receiverId=").append(this.receiverId)
                .append(", idString=").append(this.idString)
                .append("]").toString();
    }
}