private void prepareCharges()

in service/src/main/java/org/apache/fineract/cn/interoperation/service/internal/service/InteropService.java [325:346]


    private void prepareCharges(@NotNull InteropTransferCommand request, @NotNull AccountWrapper accountWrapper, @NotNull InteropActionEntity action,
                                @NotNull List<Charge> charges, Account payableAccount, HashSet<Debtor> debtors, HashSet<Creditor> creditors) {
        MoneyData fspFee = request.getFspFee(); // TODO compare with calculated and with quote

        BigDecimal amount = request.getAmount().getAmount();
        Currency currency = accountWrapper.productDefinition.getCurrency();

        BigDecimal total = MathUtil.normalize(calcTotalCharges(charges, amount), currency);

        if (MathUtil.isEmpty(total)) {
            return;
        }

        if (creditors == null) {
            creditors = new HashSet<>(1);
        }
        if (debtors == null) {
            debtors = new HashSet<>(charges.size());
        }
        addCreditor(accountWrapper.account.getIdentifier(), total.doubleValue(), creditors);
        addDebtor(payableAccount.getIdentifier(), total.doubleValue(), debtors);
    }