Skip to content
Permalink
Browse files
Merge pull request #10 from markusgeiss/develop
added external references and fixed close with zero issue
  • Loading branch information
markusgeiss committed Sep 12, 2017
2 parents 7934000 + 6e7f90c commit 050391c4297bd7e5475b6d359099384826e4ac98
Showing 5 changed files with 31 additions and 7 deletions.
@@ -23,7 +23,7 @@
public class TellerTransactionCosts {

private String tellerTransactionIdentifier;
@DecimalMin(value = "0.001")
@DecimalMin(value = "0.000")
@DecimalMax(value = "9999999999.99999")
private BigDecimal totalAmount;
private List<Charge> charges;
@@ -433,6 +433,8 @@ private Teller prepareTeller() throws Exception {

Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_TELLER, TestTellerOperation.tellerUnderTest.getCode()));

Mockito.verify(this.organizationServiceSpy, Mockito.times(1)).setTellerReference(Matchers.eq(officeIdentifier));

final TellerManagementCommand command = new TellerManagementCommand();
command.setAction(TellerManagementCommand.Action.OPEN.name());
command.setAdjustment(TellerManagementCommand.Adjustment.NONE.name());
@@ -100,6 +100,8 @@ public String process(final CreateTellerCommand createTellerCommand) {

this.tellerRepository.save(tellerEntity);

this.organizationService.setTellerReference(officeIdentifier);

return teller.getCode();
} else {
throw new IllegalStateException("Preconditions not met, see log file for further information.");
@@ -83,10 +83,13 @@ public TellerTransactionCosts getTellerTransactionCosts(final TellerTransaction
public void processTransfer(final String tellerCode, final TellerTransaction tellerTransaction,
final boolean chargesIncluded) {
final TellerEntity tellerEntity = getTellerEntity(tellerCode);
final JournalEntry journalEntry = this.prepareJournalEntry(tellerTransaction);

final TellerTransactionCosts tellerTransactionCosts = this.getTellerTransactionCosts(tellerTransaction);

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

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

@@ -116,11 +119,16 @@ public void processTransfer(final String tellerCode, final TellerTransaction tel
this.accountingService.postJournalEntry(journalEntry);
}

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

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

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

@@ -152,9 +160,13 @@ public void processCashDeposit(final String tellerCode, final TellerTransaction
public void processCashWithdrawal(final String tellerCode, final TellerTransaction tellerTransaction,
final boolean chargesIncluded) {
final TellerEntity tellerEntity = getTellerEntity(tellerCode);
final JournalEntry journalEntry = this.prepareJournalEntry(tellerTransaction);
final TellerTransactionCosts tellerTransactionCosts = this.getTellerTransactionCosts(tellerTransaction);

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

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

@@ -185,7 +197,7 @@ public void processCashWithdrawal(final String tellerCode, final TellerTransacti
}

public void processDepositAccountClosing(final String tellerCode, final TellerTransaction tellerTransaction,
final boolean chargesIncluded) {
final boolean chargesIncluded) {
this.processCashWithdrawal(tellerCode, tellerTransaction, chargesIncluded);

this.depositAccountManagementService.closeProductInstance(tellerTransaction.getCustomerAccountIdentifier());
@@ -17,6 +17,7 @@

import io.mifos.office.api.v1.client.NotFoundException;
import io.mifos.office.api.v1.client.OrganizationManager;
import io.mifos.office.api.v1.domain.ExternalReference;
import io.mifos.teller.ServiceConstants;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,4 +57,11 @@ public boolean employeeExists(final String employeeIdentifier) {
return false;
}
}

public void setTellerReference(final String officeIdentifier) {
final ExternalReference externalReference = new ExternalReference();
externalReference.setType("fineract.teller");
externalReference.setState(ExternalReference.State.ACTIVE.name());
this.organizationManager.addExternalReference(officeIdentifier, externalReference);
}
}

0 comments on commit 050391c

Please sign in to comment.