wip: repayment/disbursal apis support optional payment details

This commit is contained in:
Vishwas Babu AJ
2013-04-09 17:00:25 +05:30
parent c2a462aede
commit e15a72eab1
14 changed files with 503 additions and 95 deletions
@@ -2,37 +2,39 @@ package org.mifosplatform.portfolio.loanaccount;
import org.joda.time.LocalDate;
import org.mifosplatform.organisation.monetary.domain.Money;
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransaction;
public class LoanTransactionBuilder {
private Money transactionAmount = new MoneyBuilder().build();
private LocalDate transactionDate = LocalDate.now();
private boolean repayment = false;
@SuppressWarnings("unused")
private Money transactionAmount = new MoneyBuilder().build();
@SuppressWarnings("unused")
private LocalDate transactionDate = LocalDate.now();
@SuppressWarnings("unused")
private boolean repayment = false;
public LoanTransaction build() {
LoanTransaction transaction = null;
if (repayment) {
transaction = LoanTransaction.repayment(transactionAmount, transactionDate);
}
return transaction;
}
/** public LoanTransaction build() {
public LoanTransactionBuilder with(final Money newAmount) {
this.transactionAmount = newAmount;
return this;
}
LoanTransaction transaction = null;
public LoanTransactionBuilder with(final LocalDate withTransactionDate) {
this.transactionDate = withTransactionDate;
return this;
}
public LoanTransactionBuilder repayment() {
this.repayment = true;
return this;
}
if (repayment) {
transaction = LoanTransaction.repayment(transactionAmount, transactionDate);
}
return transaction;
}**/
public LoanTransactionBuilder with(final Money newAmount) {
this.transactionAmount = newAmount;
return this;
}
public LoanTransactionBuilder with(final LocalDate withTransactionDate) {
this.transactionDate = withTransactionDate;
return this;
}
public LoanTransactionBuilder repayment() {
this.repayment = true;
return this;
}
}