-
Notifications
You must be signed in to change notification settings - Fork 34
/
Sep6Transaction.java
400 lines (315 loc) · 9.99 KB
/
Sep6Transaction.java
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
package org.stellar.anchor.sep6;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import org.stellar.anchor.SepTransaction;
import org.stellar.anchor.api.shared.InstructionField;
import org.stellar.anchor.api.shared.Refunds;
public interface Sep6Transaction extends SepTransaction {
/**
* The database ID.
*
* @return The generated database ID.
*/
String getId();
void setId(String id);
/**
* Unique, anchor-generated ID for the transaction.
*
* @return The anchor-generated transaction ID.
*/
String getTransactionId();
void setTransactionId(String transactionId);
/**
* <code>transaction_id</code> on Stellar network of the transfer that either completed the
* deposit or started the withdrawal.
*
* @return the Stellar transaction ID.
*/
String getStellarTransactionId();
void setStellarTransactionId(String stellarTransactionId);
/**
* ID of transaction on external network that either started the deposit or completed the
* withdrawal.
*
* @return the external transaction ID.
*/
String getExternalTransactionId();
void setExternalTransactionId(String externalTransactionId);
/**
* Processing status of deposit/withdrawal.
*
* @return the transaction status.
*/
String getStatus();
void setStatus(String status);
/**
* Estimated number of seconds until a status change is expected.
*
* @return the status ETA.
*/
Long getStatusEta();
void setStatusEta(Long statusEta);
/**
* A URL that the user can visit if they want more infomration about their account / status.
*
* @return the more info URL.
*/
String getMoreInfoUrl();
void setMoreInfoUrl(String moreInfoUrl);
/**
* <code>deposit</code>, <code>deposit-exchange</code>, <code>withdrawal</code> or <code>
* withdrawal-exchange</code>.
*
* @return the transaction kind.
*/
String getKind();
void setKind(String kind);
/**
* Start date and time of the transaction.
*
* @return the started at timestamp.
*/
Instant getStartedAt();
void setStartedAt(Instant startedAt);
/**
* The date and time of the transaction reaching <code>completed</code> or <code>refunded</code>
* status.
*
* @return the completed at timestamp.
*/
Instant getCompletedAt();
void setCompletedAt(Instant completedAt);
/**
* The date and time the user funds were received.
*
* @return the transfer received at timestamp.
*/
Instant getTransferReceivedAt();
void setTransferReceivedAt(Instant transferReceivedAt);
/**
* The deposit or withdrawal method used. E.g. <code>bank_account</code>, <code>cash</code>
*
* @return the deposit or withdraw method.
*/
String getType();
void setType(String type);
/**
* The code of the asset of interest. E.g. BTC, ETH, USD, INR, etc.
*
* @return the request asset code.
*/
String getRequestAssetCode();
void setRequestAssetCode(String assetCode);
/**
* The issuer of the Stellar asset the user wants to receive for their deposit or want to withdraw
* into an off-chain asset. If asset issuer is not provided, the anchor should use the asset
* issued by themselves as described in their TOML file.
*
* @return the request asset issuer.
*/
String getRequestAssetIssuer();
void setRequestAssetIssuer(String assetIssuer);
/**
* Amount received by the anchor at the start of the tranaction as a string with up to 7 decimals.
* It excludes any fees charged before the anchor received the funds.
*
* @return the amount received by the anchor.
*/
String getAmountIn();
void setAmountIn(String amountIn);
/**
* The asset code of the asset received by the anchor at the start of the tranaction.
*
* @return the asset code of the asset received by the anchor.
*/
String getAmountInAsset();
void setAmountInAsset(String amountInAsset);
/**
* Amount sent by the anchor at the end of the transaction as a string with up to 7 decimals. It
* excludes the amount converted to XLM to fund the account and any external fees.
*
* @return the amount sent by the anchor.
*/
String getAmountOut();
void setAmountOut(String amountOut);
/**
* The asset code of the asset sent by the anchor at the end of the transaction.
*
* @return the asset code of the asset sent by the anchor.
*/
String getAmountOutAsset();
void setAmountOutAsset(String amountOutAsset);
/**
* The amount of fee charged by the anchor.
*
* @return the amount of fee charged by the anchor.
*/
String getAmountFee();
void setAmountFee(String amountFee);
/**
* The asset in which fees are calculated in. Must be present if the deposit/withdrawal was made
* using non-equivalent assets. The value must bein SEP-38 Asset Identification format.
*
* @return the asset in which fees are calculated in.
*/
String getAmountFeeAsset();
void setAmountFeeAsset(String amountFeeAsset);
/**
* The amount requested by the user to deposit or withdraw.
*
* @return the amount expected by the user.
*/
String getAmountExpected();
void setAmountExpected(String amount);
/**
* The Stellar account used to authenticate using SEP-10.
*
* @return the SEP-10 account.
*/
String getSep10Account();
void setSep10Account(String sep10Account);
/**
* The Stellar account memo used to authenticate using SEP-10.
*
* @return the SEP-10 account memo.
*/
String getSep10AccountMemo();
void setSep10AccountMemo(String sep10AccountMemo);
/**
* If this is a withdrawal, this is the anchor's Stellar account that the user transferred (or
* will transfer) their issued asset to.
*
* @return the anchor's Stellar account.
*/
String getWithdrawAnchorAccount();
void setWithdrawAnchorAccount(String withdrawAnchorAccount);
/**
* For withdrawals, the Stellar account the assets were withdrawn from. For deposits, the
* sent-from address (perhaps BTC, IBAN, bank account).
*
* @return the account the assets were deposited to or withdrawn from.
*/
String getFromAccount();
void setFromAccount(String fromAccount);
/**
* For withdrawals, the sent-to address (perhaps BTC, IBAN, bank account). For deposits, the
* Stellar account the assets were deposited to.
*
* @return the account the assets were deposited to or withdrawn from.
*/
String getToAccount();
void setToAccount(String toAccount);
/**
* For withdrawals, this is the memo when the user transferred to withdrawAnchorAccount. It is
* null if the user is not ready to receive payment, for example if KYC is not completed.
*
* <p>For deposits, this is the memo (if any) used to transfer the asset to the Stellar account.
*
* @return the withdrawal or deposit memo.
*/
String getMemo();
void setMemo(String memo);
/**
* The withdrawal or deposit memo type.
*
* @return the withdrawal or deposit memo type.
*/
String getMemoType();
void setMemoType(String memoType);
/**
* The ID returned from a SEP-38 quote response. IF this is set, the user must deliver the deposit
* funds to the anchor before the quote expires, otherwise the anchor may not honor the quote.
*
* @return the quote ID.
*/
String getQuoteId();
void setQuoteId(String quoteId);
/**
* Human-readable explanation of the transaction status.
*
* @return the message.
*/
String getMessage();
void setMessage(String message);
/**
* Describes any on or off-chain refund associated with this transaction.
*
* @return the refunds.
*/
Refunds getRefunds();
void setRefunds(Refunds refunds);
/**
* The memo the anchor must use when sending refund payments back to the user. If not specified,
* the anchor should use the seame memo used by the user to send the original payment. If
* specified, the <code>refundMemoType</code> must also be specified.
*
* @return the refund memo.
*/
String getRefundMemo();
void setRefundMemo(String refundMemo);
/**
* The refund memo type.
*
* @return the refund memo type.
*/
String getRefundMemoType();
void setRefundMemoType(String refundMemoType);
/**
* A human-readable message indicating any errors that require updated information from the user.
*
* @return the required info message.
*/
String getRequiredInfoMessage();
void setRequiredInfoMessage(String requiredInfoMessage);
/**
* A set of fields that require updates from the user.
*
* @return the required info updates.
*/
List<String> getRequiredInfoUpdates();
void setRequiredInfoUpdates(List<String> requiredInfoUpdates);
/**
* A human-readable message indicating why the SEP-12 information provided by the user is not
* sufficient to complete the transaction.
*
* @return the required customer info message.
*/
String getRequiredCustomerInfoMessage();
void setRequiredCustomerInfoMessage(String requiredCustomerInfoMessage);
/**
* A set of SEP-9 fields that require update from the user via SEP-12. This field is only relevant
* when `status` is `pending_customer_info_update`.
*
* @return the required customer info updates.
*/
List<String> getRequiredCustomerInfoUpdates();
void setRequiredCustomerInfoUpdates(List<String> requiredCustomerInfoUpdates);
/**
* Describes how to complete the off-chain deposit.
*
* @return the deposit instructions.
*/
Map<String, InstructionField> getInstructions();
void setInstructions(Map<String, InstructionField> instructions);
enum Kind {
DEPOSIT("deposit"),
WITHDRAWAL("withdrawal"),
DEPOSIT_EXCHANGE("deposit-exchange"),
WITHDRAWAL_EXCHANGE("withdrawal-exchange");
private final String name;
Kind(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
public boolean isDeposit() {
return this.equals(DEPOSIT) || this.equals(DEPOSIT_EXCHANGE);
}
public boolean isWithdrawal() {
return this.equals(WITHDRAWAL) || this.equals(WITHDRAWAL_EXCHANGE);
}
}
}