-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathTransferHelper.java
43 lines (32 loc) · 1.36 KB
/
TransferHelper.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
package com.intuit.developer.sampleapp.crud.helper;
import java.math.BigDecimal;
import java.text.ParseException;
import com.intuit.ipp.data.Account;
import com.intuit.ipp.data.Transfer;
import com.intuit.ipp.exception.FMSException;
import com.intuit.ipp.services.DataService;
import com.intuit.ipp.util.DateUtils;
/**
* @author dderose
*
*/
public final class TransferHelper {
private TransferHelper() {
}
public static Transfer getTransferFields(DataService service) throws FMSException {
Transfer transfer = new Transfer();
try {
transfer.setTxnDate(DateUtils.getCurrentDateTime());
} catch (ParseException e) {
throw new FMSException("ParseException while getting current date.");
}
Account depositAccount = AccountHelper.getAssetAccount(service);
transfer.setFromAccountRef(AccountHelper.getAccountRef(depositAccount));
Account creditAccount = AccountHelper.getCreditCardBankAccount(service);
transfer.setToAccountRef(AccountHelper.getAccountRef(creditAccount));
transfer.setAmount(new BigDecimal("100.00"));
transfer.setDomain("QBO");
transfer.setPrivateNote("Transfer " + transfer.getAmount() + " from " + depositAccount.getFullyQualifiedName() + " to " + creditAccount.getFullyQualifiedName());
return transfer;
}
}