Repository navigation
Expand file tree
/
Copy pathInvoice.java
More file actions
413 lines (335 loc) · 9.29 KB
/
Copy pathInvoice.java
File metadata and controls
413 lines (335 loc) · 9.29 KB
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
package model;
import java.util.Hashtable;
import java.util.List;
import com.fasterxml.jackson.annotation.*;
import controller.BitPayException;
@JsonIgnoreProperties(ignoreUnknown=true)
public class Invoice {
public static final String STATUS_NEW = "new";
public static final String STATUS_PAID = "paid";
public static final String STATUS_CONFIRMED = "confirmed";
public static final String STATUS_COMPLETE = "complete";
public static final String STATUS_INVALID = "invalid";
public static final String EXSTATUS_FALSE = "false";
public static final String EXSTATUS_PAID_OVER = "paidOver";
public static final String EXSTATUS_PAID_PARTIAL = "paidPartial";
private String _guid = "";
private String _token = "";
private Double _price;
private String _currency;
private String _posData = "";
private String _notificationURL = "";
private String _transactionSpeed = "";
private boolean _fullNotifications = false;
private String _notificationEmail = "";
private String _redirectURL = "";
private String _orderId = "";
private String _itemDesc = "";
private String _itemCode = "";
private boolean _physical = false;
private InvoiceBuyer _buyer;
private String _id;
private String _url;
private String _status;
private String _btcPrice;
private String _invoiceTime;
private long _expirationTime;
private long _currentTime;
private String _btcPaid;
private String _btcDue;
private List<InvoiceTransaction> _transactions;
private String _rate;
private Hashtable<String, String> _exRates;
private String _exceptionStatus;
private InvoicePaymentUrls _paymentUrls = new InvoicePaymentUrls();
private InvoiceFlags _flags = new InvoiceFlags();
private boolean _extendedNotifications = false;
/**
* Constructor, create an empty Invoice object.
*/
public Invoice() {}
/**
* Constructor, create a minimal request Invoice object.
* @param price The amount for which the invoice will be created.
* @param currency The three digit currency type used to compute the invoice bitcoin amount.
*/
public Invoice(Double price, String currency)
{
this._price = price;
this._currency = currency;
}
// API fields
//
@JsonProperty("guid")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getGuid() {
return _guid;
}
@JsonProperty("guid")
public void setGuid(String _guid) {
this._guid = _guid;
}
@JsonProperty("token")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getToken() {
return _token;
}
@JsonProperty("token")
public void setToken(String _token) {
this._token = _token;
}
// Required fields
//
@JsonProperty("price")
public Double getPrice() {
return _price;
}
@JsonProperty("price")
public void setPrice(Double _price) {
this._price = _price;
}
@JsonProperty("currency")
public String getCurrency() {
return _currency;
}
@JsonProperty("currency")
public void setCurrency(String _currency) throws BitPayException {
if (_currency.length() != 3)
{
throw new BitPayException("Error: currency code must be exactly three characters");
}
this._currency = _currency;
}
// Optional fields
//
@JsonProperty("orderId")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getOrderId() {
return _orderId;
}
@JsonProperty("orderId")
public void setOrderId(String _orderId) {
this._orderId = _orderId;
}
@JsonProperty("itemDesc")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getItemDesc() {
return _itemDesc;
}
@JsonProperty("itemDesc")
public void setItemDesc(String _itemDesc) {
this._itemDesc = _itemDesc;
}
@JsonProperty("itemCode")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getItemCode() {
return _itemCode;
}
@JsonProperty("itemCode")
public void setItemCode(String _itemCode) {
this._itemCode = _itemCode;
}
@JsonProperty("posData")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getPosData() {
return _posData;
}
@JsonProperty("posData")
public void setPosData(String _posData) {
this._posData = _posData;
}
@JsonProperty("notificationURL")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getNotificationURL() {
return _notificationURL;
}
@JsonProperty("notificationURL")
public void setNotificationURL(String _notificationURL) {
this._notificationURL = _notificationURL;
}
@JsonProperty("transactionSpeed")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getTransactionSpeed() {
return _transactionSpeed;
}
@JsonProperty("transactionSpeed")
public void setTransactionSpeed(String _transactionSpeed) {
this._transactionSpeed = _transactionSpeed;
}
@JsonProperty("fullNotifications")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean getFullNotifications() {
return _fullNotifications;
}
@JsonProperty("fullNotifications")
public void setFullNotifications(boolean _fullNotifications) {
this._fullNotifications = _fullNotifications;
}
@JsonProperty("notificationEmail")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getNotificationEmail() {
return _notificationEmail;
}
@JsonProperty("notificationEmail")
public void setNotificationEmail(String _notificationEmail) {
this._notificationEmail = _notificationEmail;
}
@JsonProperty("redirectURL")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getRedirectURL() {
return _redirectURL;
}
@JsonProperty("redirectURL")
public void setRedirectURL(String _redirectURL) {
this._redirectURL = _redirectURL;
}
@JsonProperty("physical")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean getPhysical() {
return _physical;
}
@JsonProperty("physical")
public void setPhysical(boolean _physical) {
this._physical = _physical;
}
@JsonProperty("buyer")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public InvoiceBuyer getBuyer() {
return _buyer;
}
@JsonProperty("buyer")
public void setBuyer(InvoiceBuyer _buyer) {
this._buyer = _buyer;
}
@JsonProperty("extendedNotifications")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean getExtendedNotifications() {
return _extendedNotifications;
}
@JsonProperty("extendedNotifications")
public void setExtendedNotifications(boolean _extendedNotifications) {
this._extendedNotifications = _extendedNotifications;
}
// Response fields
//
@JsonIgnore
public String getId() {
return _id;
}
@JsonProperty("id")
public void setId(String _id) {
this._id = _id;
}
@JsonIgnore
public String getUrl() {
return _url;
}
@JsonProperty("url")
public void setUrl(String _url) {
this._url = _url;
}
@JsonIgnore
public String getStatus() {
return _status;
}
@JsonProperty("status")
public void setStatus(String _status) {
this._status = _status;
}
@JsonIgnore
public String getBtcPrice() {
return _btcPrice;
}
@JsonProperty("btcPrice")
public void setBtcPrice(String _btcPrice) {
this._btcPrice = _btcPrice;
}
@JsonIgnore
public String getInvoiceTime() {
return _invoiceTime;
}
@JsonProperty("invoiceTime")
public void setInvoiceTime(String _invoiceTime) {
this._invoiceTime = _invoiceTime;
}
@JsonIgnore
public long getExpirationTime() {
return _expirationTime;
}
@JsonProperty("expirationTime")
public void setExpirationTime(long _expirationTime) {
this._expirationTime = _expirationTime;
}
@JsonIgnore
public long getCurrentTime() {
return _currentTime;
}
@JsonProperty("currentTime")
public void setCurrentTime(long _currentTime) {
this._currentTime = _currentTime;
}
@JsonIgnore
public String getBtcPaid() {
return _btcPaid;
}
@JsonProperty("btcPaid")
public void setBtcPaid(String _btcPaid) {
this._btcPaid = _btcPaid;
}
@JsonIgnore
public String getBtcDue() {
return _btcDue;
}
@JsonProperty("btcDue")
public void setBtcDue(String _btcDue) {
this._btcDue = _btcDue;
}
@JsonIgnore
public List<InvoiceTransaction> getTransactions() {
return _transactions;
}
@JsonProperty("transactions")
public void setTransactions(List<InvoiceTransaction> _transactions) {
this._transactions = _transactions;
}
@JsonIgnore
public String getRate() {
return _rate;
}
@JsonProperty("rate")
public void setRate(String _rate) {
this._rate = _rate;
}
@JsonIgnore
public Hashtable<String, String> getExRates() {
return _exRates;
}
@JsonProperty("exRates")
public void setExRates(Hashtable<String, String> _exRates) {
this._exRates = _exRates;
}
@JsonIgnore
public String getExceptionStatus() {
return _exceptionStatus;
}
@JsonProperty("exceptionStatus")
public void setExceptionStatus(String _exceptionStatus) {
this._exceptionStatus = _exceptionStatus;
}
@JsonIgnore
public InvoicePaymentUrls getPaymentUrls() {
return _paymentUrls;
}
@JsonProperty("paymentUrls")
public void setPaymentUrls(InvoicePaymentUrls _paymentUrls) {
this._paymentUrls = _paymentUrls;
}
@JsonIgnore
public InvoiceFlags getFlags() {
return _flags;
}
@JsonProperty("flags")
public void setFlags(InvoiceFlags _flags) {
this._flags = _flags;
}
}