transferMoney(user, originAccount, targetAccount, operationDate, amount, chargeAmount, rate, memo);
}
protected void transferMoney(UserDetails user, Account origin, Account target, Date operationDate, BigDecimal amount, BigDecimal chargeAmount, double rate, String memo) {
if (isValidTransfer(user, origin, target, operationDate, amount)) {
Payee payee = Payee.findMySelf(user);
Subcategory transferCategory = Subcategory.findBySubcategory("category.transfer.out", user);
Subcategory transferInCategory = Subcategory.findBySubcategory("category.transfer.in", user);
AccountTransaction send = AccountTransaction.createInstance(origin, payee, transferCategory, calculateAmount(amount), operationDate, memo);
AccountTransaction receive = AccountTransaction.createInstance(target, payee, transferInCategory, calculateTargetAmount(amount, rate), operationDate, memo);
receive.setOriginOfTheFunds(origin.getName());