Created
June 30, 2020 15:55
Star
You must be signed in to star a gist
Cyclos test: retrieve balances & trasnfers for account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.cyclos.model.banking.accounts.AccountBalanceHistoryParams | |
import org.cyclos.model.banking.accounts.AccountHistoryQuery | |
import org.cyclos.model.banking.accounts.AccountVO | |
import org.cyclos.model.users.users.UserVO | |
import org.cyclos.model.utils.DatePeriodDTO | |
import org.cyclos.utils.DateTime | |
def begin = new DateTime(2020, 3, 1) | |
def end = new DateTime(2020, 5, 1) | |
def month = new DatePeriodDTO(begin: begin , end: end) | |
def abhp = new AccountBalanceHistoryParams(period: [begin: begin, end: end], account: new AccountVO(account.id)) | |
def a = accountService.getAccountBalanceHistory(abhp) | |
println('balances:') | |
a.balances.each { | |
println(it.date.toString() +" - " + it.amount.toString()) | |
} | |
println() | |
def ahq = new AccountHistoryQuery(account: [account.id], period: month) | |
def b = accountService.searchAccountHistory(ahq) | |
println('transfers:') | |
b.each { | |
println(it.date.toString() +" - " + it.amount.toString() + " (" | |
+ it.relatedAccount.id + ")") | |
} | |
println() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment