public void processTransfer()

in service/src/main/java/org/apache/fineract/cn/teller/service/internal/processor/DepositTransactionHandler.java [85:125]


  public void processTransfer(final String tellerCode, final TellerTransaction tellerTransaction,
                              final boolean chargesIncluded) {
    final TellerEntity tellerEntity = getTellerEntity(tellerCode);
    final TellerTransactionCosts tellerTransactionCosts = this.getTellerTransactionCosts(tellerTransaction);

    if (tellerTransactionCosts.getTotalAmount().compareTo(BigDecimal.ZERO) ==0) {
      return;
    }

    final String resolvedCustomerAccount = this.accountingService.resolveAccountIdentifier(tellerTransaction.getCustomerAccountIdentifier());

    final JournalEntry journalEntry = this.prepareJournalEntry(tellerTransaction);
    final HashSet<Debtor> debtors = new HashSet<>();
    journalEntry.setDebtors(debtors);

    final Debtor customerDebtor = new Debtor();
    customerDebtor.setAccountNumber(resolvedCustomerAccount);
    customerDebtor.setAmount(tellerTransaction.getAmount().toString());
    debtors.add(customerDebtor);

    if (!tellerTransactionCosts.getCharges().isEmpty()) {
      if (chargesIncluded) {
        debtors.add(this.createChargesDebtor(tellerEntity.getTellerAccountIdentifier(), tellerTransactionCosts));
      } else {
        debtors.add(this.createChargesDebtor(resolvedCustomerAccount, tellerTransactionCosts));
      }
    }

    final HashSet<Creditor> creditors = new HashSet<>();
    journalEntry.setCreditors(creditors);

    final Creditor targetCreditor = new Creditor();
    targetCreditor.setAccountNumber(tellerTransaction.getTargetAccountIdentifier());
    targetCreditor.setAmount(tellerTransaction.getAmount().toString());
    creditors.add(targetCreditor);

    creditors.addAll(this.createChargeCreditors(tellerTransactionCosts));

    this.accountingService.postJournalEntry(journalEntry);
    this.depositAccountManagementService.transactedProductInstance(resolvedCustomerAccount);
  }