remove deprecate MoneyData class usage forcing tidy up of LoanTransaction usage.
This commit is contained in:
@@ -38,15 +38,15 @@ import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
|||||||
import org.mifosng.platform.api.data.LoanChargeData;
|
import org.mifosng.platform.api.data.LoanChargeData;
|
||||||
import org.mifosng.platform.api.data.LoanPermissionData;
|
import org.mifosng.platform.api.data.LoanPermissionData;
|
||||||
import org.mifosng.platform.api.data.LoanProductData;
|
import org.mifosng.platform.api.data.LoanProductData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
import org.mifosng.platform.api.data.MoneyData;
|
|
||||||
import org.mifosng.platform.api.data.StaffData;
|
import org.mifosng.platform.api.data.StaffData;
|
||||||
import org.mifosng.platform.api.data.TransactionProcessingStrategyData;
|
import org.mifosng.platform.api.data.TransactionProcessingStrategyData;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
|
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
|
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
|
||||||
import org.mifosng.platform.charge.service.ChargeReadPlatformService;
|
import org.mifosng.platform.charge.service.ChargeReadPlatformService;
|
||||||
|
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||||
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
|
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
|
||||||
import org.mifosng.platform.fund.service.FundReadPlatformService;
|
import org.mifosng.platform.fund.service.FundReadPlatformService;
|
||||||
import org.mifosng.platform.loan.service.CalculationPlatformService;
|
import org.mifosng.platform.loan.service.CalculationPlatformService;
|
||||||
@@ -112,6 +112,8 @@ public class LoansApiResource {
|
|||||||
"status",
|
"status",
|
||||||
"lifeCycleStatusDate"));
|
"lifeCycleStatusDate"));
|
||||||
|
|
||||||
|
final Set<String> typicalTransactionResponseParameters = new HashSet<String>(Arrays.asList("id", "type", "date", "currency", "amount"));
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -219,8 +221,11 @@ public class LoansApiResource {
|
|||||||
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId, loanBasicDetails.getCurrency(),
|
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId, loanBasicDetails.getCurrency(),
|
||||||
singleDisbursement, loanBasicDetails.getTotalDisbursementCharges(), loanBasicDetails.getInArrearsTolerance());
|
singleDisbursement, loanBasicDetails.getTotalDisbursementCharges(), loanBasicDetails.getInArrearsTolerance());
|
||||||
|
|
||||||
MoneyData tolerance = MoneyData.of(loanBasicDetails.getCurrency(), loanBasicDetails.getInArrearsTolerance());
|
// FIXME - KW - Waive feature was changed to waive interest at anytime so this permission checking is probably not needed - look into.
|
||||||
MoneyData totalOutstandingMoney = MoneyData.of(loanBasicDetails.getCurrency(), repaymentSchedule.totalOutstanding());
|
final MonetaryCurrency currency = new MonetaryCurrency(loanBasicDetails.getCurrency().getCode(), loanBasicDetails.getCurrency().getDecimalPlaces());
|
||||||
|
final Money tolerance = Money.of(currency, loanBasicDetails.getInArrearsTolerance());
|
||||||
|
final Money totalOutstandingMoney = Money.of(currency, repaymentSchedule.totalOutstanding());
|
||||||
|
|
||||||
boolean isWaiveAllowed = totalOutstandingMoney.isGreaterThanZero() && (tolerance.isGreaterThan(totalOutstandingMoney) || tolerance.isEqualTo(totalOutstandingMoney));
|
boolean isWaiveAllowed = totalOutstandingMoney.isGreaterThanZero() && (tolerance.isGreaterThan(totalOutstandingMoney) || tolerance.isEqualTo(totalOutstandingMoney));
|
||||||
|
|
||||||
if (responseParameters.contains("permissions")) {
|
if (responseParameters.contains("permissions")) {
|
||||||
@@ -442,67 +447,28 @@ public class LoansApiResource {
|
|||||||
@QueryParam("command") final String commandParam,
|
@QueryParam("command") final String commandParam,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
LoanTransactionData transactionData = null;
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
|
if (responseParameters.isEmpty()) {
|
||||||
|
responseParameters.addAll(typicalTransactionResponseParameters);
|
||||||
|
}
|
||||||
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
|
LoanTransactionNewData transactionData = null;
|
||||||
if (is(commandParam, "repayment")) {
|
if (is(commandParam, "repayment")) {
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
|
||||||
Arrays.asList("id", "transactionType", "date", "principal",
|
|
||||||
"interest", "total", "totalWaived", "overpaid"));
|
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
|
||||||
}
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
|
||||||
transactionData = this.loanReadPlatformService.retrieveNewLoanRepaymentDetails(loanId);
|
transactionData = this.loanReadPlatformService.retrieveNewLoanRepaymentDetails(loanId);
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
|
|
||||||
} else if (is(commandParam, "waiveinterest")) {
|
} else if (is(commandParam, "waiveinterest")) {
|
||||||
|
transactionData = this.loanReadPlatformService.retrieveNewLoanWaiveInterestDetails(loanId);
|
||||||
final Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "type", "date", "currency", "amount"));
|
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
|
||||||
}
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
final LoanTransactionNewData newTransactionData = this.loanReadPlatformService.retrieveNewLoanWaiveInterestDetails(loanId);
|
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, newTransactionData);
|
|
||||||
} else if (is(commandParam, "writeoff")) {
|
} else if (is(commandParam, "writeoff")) {
|
||||||
final Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "type", "date", "currency", "amount"));
|
transactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
|
||||||
}
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
final LoanTransactionNewData newTransactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, newTransactionData);
|
|
||||||
} else if (is(commandParam, "close-rescheduled")) {
|
} else if (is(commandParam, "close-rescheduled")) {
|
||||||
final Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "type", "date", "currency", "amount"));
|
transactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
|
||||||
}
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
final LoanTransactionNewData newTransactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, newTransactionData);
|
|
||||||
} else if (is(commandParam, "close")) {
|
} else if (is(commandParam, "close")) {
|
||||||
final Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "type", "date", "currency", "amount"));
|
transactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
|
||||||
}
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
final LoanTransactionNewData newTransactionData = this.loanReadPlatformService.retrieveNewClosureDetails();
|
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, newTransactionData);
|
|
||||||
} else {
|
} else {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam);
|
throw new UnrecognizedQueryParamException("command", commandParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -513,17 +479,13 @@ public class LoansApiResource {
|
|||||||
@PathParam("transactionId") final Long transactionId,
|
@PathParam("transactionId") final Long transactionId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
Arrays.asList("id", "transactionType", "date", "principal", "interest", "total", "totalWaived", "overpaid")
|
|
||||||
);
|
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
|
||||||
if (responseParameters.isEmpty()) {
|
if (responseParameters.isEmpty()) {
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
responseParameters.addAll(typicalTransactionResponseParameters);
|
||||||
}
|
}
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
LoanTransactionData transactionData = this.loanReadPlatformService.retrieveLoanTransactionDetails(loanId, transactionId);
|
final LoanTransactionNewData transactionData = this.loanReadPlatformService.retrieveLoanTransactionDetails(loanId, transactionId);
|
||||||
|
|
||||||
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
|
return this.apiJsonSerializerService.serializeLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
|
||||||
}
|
}
|
||||||
|
|||||||
-101
@@ -1,101 +0,0 @@
|
|||||||
package org.mifosng.platform.api.data;
|
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
|
||||||
|
|
||||||
public class LoanTransactionData {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private EnumOptionData transactionType;
|
|
||||||
private LocalDate date;
|
|
||||||
private MoneyData principal;
|
|
||||||
private MoneyData interest;
|
|
||||||
private MoneyData total;
|
|
||||||
private MoneyData totalWaived;
|
|
||||||
private MoneyData overpaid;
|
|
||||||
|
|
||||||
public LoanTransactionData() {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoanTransactionData(
|
|
||||||
Long id, EnumOptionData transactionType, final LocalDate date,
|
|
||||||
final MoneyData principal,
|
|
||||||
final MoneyData interest,
|
|
||||||
final MoneyData total, final MoneyData overpaid) {
|
|
||||||
this.id = id;
|
|
||||||
this.transactionType = transactionType;
|
|
||||||
this.date = date;
|
|
||||||
this.principal = principal;
|
|
||||||
this.interest = interest;
|
|
||||||
this.total = total;
|
|
||||||
this.overpaid = overpaid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumOptionData getTransactionType() {
|
|
||||||
return transactionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTransactionType(EnumOptionData transactionType) {
|
|
||||||
this.transactionType = transactionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(LocalDate date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData getPrincipal() {
|
|
||||||
return principal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrincipal(MoneyData principal) {
|
|
||||||
this.principal = principal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData getInterest() {
|
|
||||||
return interest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInterest(MoneyData interest) {
|
|
||||||
this.interest = interest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData getTotal() {
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotal(MoneyData total) {
|
|
||||||
this.total = total;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData getOverpaid() {
|
|
||||||
return overpaid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverpaid(MoneyData overpaid) {
|
|
||||||
this.overpaid = overpaid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasOverpaidComponent() {
|
|
||||||
return this.overpaid.isGreaterThanZero();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData getTotalWaived() {
|
|
||||||
return totalWaived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalWaived(MoneyData totalWaived) {
|
|
||||||
this.totalWaived = totalWaived;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+5
-2
@@ -15,7 +15,6 @@ public class LoanTransactionNewData {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private EnumOptionData type;
|
private EnumOptionData type;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -36,4 +35,8 @@ public class LoanTransactionNewData {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public LocalDate dateOf() {
|
||||||
|
return this.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,189 +0,0 @@
|
|||||||
package org.mifosng.platform.api.data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated - Want to remove this and its usage around loans in full. In its place we just pass back a {@link BigDecimal} for the amount and a {@link CurrencyData} is also passed back.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class MoneyData implements Serializable, Comparable<MoneyData> {
|
|
||||||
|
|
||||||
private String currencyCode;
|
|
||||||
private Integer digitsAfterDecimal;
|
|
||||||
private BigDecimal amount;
|
|
||||||
private String defaultName;
|
|
||||||
private String nameCode;
|
|
||||||
private String displaySymbol;
|
|
||||||
|
|
||||||
public static MoneyData of(final CurrencyData currency, final BigDecimal amount) {
|
|
||||||
return new MoneyData(currency.getCode(), currency.getDecimalPlaces(), currency.getName(), currency.getNameCode(), currency.getDisplaySymbol(), amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MoneyData zero(final CurrencyData currency) {
|
|
||||||
return new MoneyData(currency.getCode(), currency.getDecimalPlaces(), currency.getName(), currency.getNameCode(), currency.getDisplaySymbol(), BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected MoneyData() {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
private MoneyData(final String currencyCode,
|
|
||||||
final int currencyDigitsAfterDecimal,
|
|
||||||
String defaultName, String nameCode, String displaySymbol,
|
|
||||||
final BigDecimal amount) {
|
|
||||||
this.currencyCode = currencyCode;
|
|
||||||
this.digitsAfterDecimal = currencyDigitsAfterDecimal;
|
|
||||||
this.defaultName = defaultName;
|
|
||||||
this.nameCode = nameCode;
|
|
||||||
this.displaySymbol = displaySymbol;
|
|
||||||
BigDecimal amountStripped = amount.stripTrailingZeros();
|
|
||||||
this.amount = amountStripped.setScale(this.digitsAfterDecimal,
|
|
||||||
RoundingMode.HALF_EVEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData plus(final Iterable<? extends MoneyData> moniesToAdd) {
|
|
||||||
BigDecimal total = this.amount;
|
|
||||||
for (MoneyData moneyProvider : moniesToAdd) {
|
|
||||||
MoneyData money = this.checkCurrencyEqual(moneyProvider);
|
|
||||||
total = total.add(money.amount);
|
|
||||||
}
|
|
||||||
return MoneyData.of(currencyData(this), total);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData plus(final MoneyData moneyToAdd) {
|
|
||||||
MoneyData toAdd = this.checkCurrencyEqual(moneyToAdd);
|
|
||||||
return this.plus(toAdd.getAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData plus(final BigDecimal amountToAdd) {
|
|
||||||
if (amountToAdd.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
BigDecimal newAmount = this.amount.add(amountToAdd);
|
|
||||||
return MoneyData.of(currencyData(this), newAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MoneyData plus(final double amountToAdd) {
|
|
||||||
if (amountToAdd == 0) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
BigDecimal newAmount = this.amount.add(BigDecimal.valueOf(amountToAdd));
|
|
||||||
return MoneyData.of(currencyData(this), newAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CurrencyData currencyData(MoneyData moneyData) {
|
|
||||||
String code = moneyData.getCurrencyCode();
|
|
||||||
String name = moneyData.getDefaultName();
|
|
||||||
int decimalPlaces = moneyData.getDigitsAfterDecimal();
|
|
||||||
String displaySymbol = moneyData.getDisplaySymbol();
|
|
||||||
String nameCode = moneyData.getNameCode();
|
|
||||||
return new CurrencyData(code, name, decimalPlaces, displaySymbol, nameCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
private MoneyData checkCurrencyEqual(final MoneyData money) {
|
|
||||||
if (this.isSameCurrency(money) == false) {
|
|
||||||
throw new UnsupportedOperationException("currencies are different.");
|
|
||||||
}
|
|
||||||
return money;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSameCurrency(final MoneyData money) {
|
|
||||||
return this.currencyCode.equals(money.getCurrencyCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurrencyCode() {
|
|
||||||
return this.currencyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
|
||||||
return this.amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCurrencyCode(final String currencyCode) {
|
|
||||||
this.currencyCode = currencyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmount(final BigDecimal amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefaultName() {
|
|
||||||
return defaultName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultName(String defaultName) {
|
|
||||||
this.defaultName = defaultName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNameCode() {
|
|
||||||
return nameCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNameCode(String nameCode) {
|
|
||||||
this.nameCode = nameCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplaySymbol() {
|
|
||||||
return displaySymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisplaySymbol(String displaySymbol) {
|
|
||||||
this.displaySymbol = displaySymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGreaterThanZero() {
|
|
||||||
return this.isGreaterThan(MoneyData.of(currencyData(this), BigDecimal.ZERO));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGreaterThan(final MoneyData other) {
|
|
||||||
return this.compareTo(other) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isZero() {
|
|
||||||
return this.isEqualTo(MoneyData.zero(currencyData(this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEqualTo(final MoneyData other) {
|
|
||||||
return this.compareTo(other) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(final MoneyData other) {
|
|
||||||
MoneyData otherMoney = other;
|
|
||||||
if (this.currencyCode.equals(otherMoney.currencyCode) == false) {
|
|
||||||
throw new UnsupportedOperationException(
|
|
||||||
"currencies arent different");
|
|
||||||
}
|
|
||||||
return this.amount.compareTo(otherMoney.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
MoneyData money = (MoneyData) obj;
|
|
||||||
return money.toString().equals(this.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return this.toString().hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new StringBuilder().append(this.amount.toPlainString()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplaySymbolValue() {
|
|
||||||
return new StringBuilder().append(this.amount.toPlainString()).append(' ').append(this.displaySymbol).toString().trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDigitsAfterDecimal() {
|
|
||||||
return digitsAfterDecimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDigitsAfterDecimal(Integer digitsAfterDecimal) {
|
|
||||||
this.digitsAfterDecimal = digitsAfterDecimal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-3
@@ -24,7 +24,6 @@ import org.mifosng.platform.api.data.GroupData;
|
|||||||
import org.mifosng.platform.api.data.LoanAccountData;
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
import org.mifosng.platform.api.data.LoanChargeData;
|
import org.mifosng.platform.api.data.LoanChargeData;
|
||||||
import org.mifosng.platform.api.data.LoanProductData;
|
import org.mifosng.platform.api.data.LoanProductData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
import org.mifosng.platform.api.data.NoteData;
|
import org.mifosng.platform.api.data.NoteData;
|
||||||
import org.mifosng.platform.api.data.OfficeData;
|
import org.mifosng.platform.api.data.OfficeData;
|
||||||
@@ -104,8 +103,6 @@ public interface ApiJsonSerializerService {
|
|||||||
|
|
||||||
String serializeLoanAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, LoanAccountData loanAccount);
|
String serializeLoanAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, LoanAccountData loanAccount);
|
||||||
|
|
||||||
String serializeLoanTransactionDataToJson(boolean prettyPrint, Set<String> responseParameters, LoanTransactionData transaction);
|
|
||||||
|
|
||||||
String serializeLoanTransactionDataToJson(boolean prettyPrint, Set<String> responseParameters, LoanTransactionNewData newTransactionData);
|
String serializeLoanTransactionDataToJson(boolean prettyPrint, Set<String> responseParameters, LoanTransactionNewData newTransactionData);
|
||||||
|
|
||||||
String serializeChargeDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<ChargeData> charges);
|
String serializeChargeDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<ChargeData> charges);
|
||||||
|
|||||||
-16
@@ -26,7 +26,6 @@ import org.mifosng.platform.api.data.GroupData;
|
|||||||
import org.mifosng.platform.api.data.LoanAccountData;
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
import org.mifosng.platform.api.data.LoanChargeData;
|
import org.mifosng.platform.api.data.LoanChargeData;
|
||||||
import org.mifosng.platform.api.data.LoanProductData;
|
import org.mifosng.platform.api.data.LoanProductData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
import org.mifosng.platform.api.data.NoteData;
|
import org.mifosng.platform.api.data.NoteData;
|
||||||
import org.mifosng.platform.api.data.OfficeData;
|
import org.mifosng.platform.api.data.OfficeData;
|
||||||
@@ -184,10 +183,6 @@ public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerServ
|
|||||||
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "repaymentStrategyOptions", "chargeOptions",
|
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "repaymentStrategyOptions", "chargeOptions",
|
||||||
"loanOfficerId", "loanOfficerName", "loanOfficerOptions", "chargeTemplate"));
|
"loanOfficerId", "loanOfficerName", "loanOfficerOptions", "chargeTemplate"));
|
||||||
|
|
||||||
private static final Set<String> LOAN_TRANSACTION_DATA_PARAMETERS = new HashSet<String>(
|
|
||||||
Arrays.asList("id", "transactionType", "date", "principal",
|
|
||||||
"interest", "total", "totalWaived", "overpaid"));
|
|
||||||
|
|
||||||
private static final Set<String> LOAN_TRANSACTION_NEW_DATA_PARAMETERS = new HashSet<String>(
|
private static final Set<String> LOAN_TRANSACTION_NEW_DATA_PARAMETERS = new HashSet<String>(
|
||||||
Arrays.asList("id", "type", "date", "currency", "amount"));
|
Arrays.asList("id", "type", "date", "currency", "amount"));
|
||||||
|
|
||||||
@@ -558,17 +553,6 @@ public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerServ
|
|||||||
return helper.serializedJsonFrom(gsonDeserializer, loanAccount);
|
return helper.serializedJsonFrom(gsonDeserializer, loanAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String serializeLoanTransactionDataToJson(final boolean prettyPrint,
|
|
||||||
final Set<String> responseParameters,
|
|
||||||
final LoanTransactionData transaction) {
|
|
||||||
final Gson gsonDeserializer = helper
|
|
||||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
|
||||||
LOAN_TRANSACTION_DATA_PARAMETERS, prettyPrint,
|
|
||||||
responseParameters);
|
|
||||||
return helper.serializedJsonFrom(gsonDeserializer, transaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String serializeLoanTransactionDataToJson(final boolean prettyPrint,
|
public String serializeLoanTransactionDataToJson(final boolean prettyPrint,
|
||||||
final Set<String> responseParameters,
|
final Set<String> responseParameters,
|
||||||
|
|||||||
+1
-1
@@ -176,7 +176,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientLookup mapRow(ResultSet rs, int rowNum) throws SQLException {
|
public ClientLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
Long id = rs.getLong("id");
|
Long id = rs.getLong("id");
|
||||||
String firstname = rs.getString("firstname");
|
String firstname = rs.getString("firstname");
|
||||||
String lastname = rs.getString("lastname");
|
String lastname = rs.getString("lastname");
|
||||||
|
|||||||
+5
-7
@@ -2,14 +2,12 @@ package org.mifosng.platform.loan.domain;
|
|||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
|
|
||||||
|
public class LoanRepaymentDataComparator implements Comparator<LoanTransactionNewData> {
|
||||||
public class LoanRepaymentDataComparator implements Comparator<LoanTransactionData> {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(final LoanTransactionData o1, final LoanTransactionData o2) {
|
public int compare(final LoanTransactionNewData o1, final LoanTransactionNewData o2) {
|
||||||
return o2.getDate().compareTo(o1.getDate());
|
return o2.dateOf().compareTo(o1.dateOf());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
+2
-3
@@ -8,7 +8,6 @@ import org.mifosng.platform.api.data.CurrencyData;
|
|||||||
import org.mifosng.platform.api.data.DisbursementData;
|
import org.mifosng.platform.api.data.DisbursementData;
|
||||||
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||||
import org.mifosng.platform.api.data.LoanPermissionData;
|
import org.mifosng.platform.api.data.LoanPermissionData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
|
|
||||||
public interface LoanReadPlatformService {
|
public interface LoanReadPlatformService {
|
||||||
@@ -27,11 +26,11 @@ public interface LoanReadPlatformService {
|
|||||||
|
|
||||||
LoanBasicDetailsData retrieveGroupAndProductDetails(Long groupId, Long productId);
|
LoanBasicDetailsData retrieveGroupAndProductDetails(Long groupId, Long productId);
|
||||||
|
|
||||||
LoanTransactionData retrieveNewLoanRepaymentDetails(Long loanId);
|
LoanTransactionNewData retrieveNewLoanRepaymentDetails(Long loanId);
|
||||||
|
|
||||||
LoanTransactionNewData retrieveNewLoanWaiveInterestDetails(Long loanId);
|
LoanTransactionNewData retrieveNewLoanWaiveInterestDetails(Long loanId);
|
||||||
|
|
||||||
LoanTransactionData retrieveLoanTransactionDetails(Long loanId, Long transactionId);
|
LoanTransactionNewData retrieveLoanTransactionDetails(Long loanId, Long transactionId);
|
||||||
|
|
||||||
LoanTransactionNewData retrieveNewClosureDetails();
|
LoanTransactionNewData retrieveNewClosureDetails();
|
||||||
}
|
}
|
||||||
+28
-48
@@ -18,12 +18,11 @@ import org.mifosng.platform.api.data.LoanChargeData;
|
|||||||
import org.mifosng.platform.api.data.LoanPermissionData;
|
import org.mifosng.platform.api.data.LoanPermissionData;
|
||||||
import org.mifosng.platform.api.data.LoanProductData;
|
import org.mifosng.platform.api.data.LoanProductData;
|
||||||
import org.mifosng.platform.api.data.LoanSchedulePeriodData;
|
import org.mifosng.platform.api.data.LoanSchedulePeriodData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
import org.mifosng.platform.api.data.LoanTransactionNewData;
|
||||||
import org.mifosng.platform.api.data.MoneyData;
|
|
||||||
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
||||||
import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
||||||
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
||||||
|
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||||
import org.mifosng.platform.currency.domain.Money;
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
import org.mifosng.platform.exceptions.CurrencyNotFoundException;
|
import org.mifosng.platform.exceptions.CurrencyNotFoundException;
|
||||||
import org.mifosng.platform.exceptions.LoanNotFoundException;
|
import org.mifosng.platform.exceptions.LoanNotFoundException;
|
||||||
@@ -142,8 +141,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
|
|
||||||
final BigDecimal totalOverdue = wrapper.deriveCumulativeTotalOverdue();
|
final BigDecimal totalOverdue = wrapper.deriveCumulativeTotalOverdue();
|
||||||
|
|
||||||
MoneyData tolerance = MoneyData.of(currency, inArrearsTolerance);
|
final MonetaryCurrency monetaryCurrency = new MonetaryCurrency(currency.getCode(), currency.getDecimalPlaces());
|
||||||
MoneyData totalOverdueMoney = MoneyData.of(currency, totalOverdue);
|
final Money tolerance = Money.of(monetaryCurrency, inArrearsTolerance);
|
||||||
|
final Money totalOverdueMoney = Money.of(monetaryCurrency, totalOverdue);
|
||||||
boolean isWaiveAllowed = totalOverdueMoney.isGreaterThanZero() && (tolerance.isGreaterThan(totalOverdueMoney) || tolerance.isEqualTo(totalOverdueMoney));
|
boolean isWaiveAllowed = totalOverdueMoney.isGreaterThanZero() && (tolerance.isGreaterThan(totalOverdueMoney) || tolerance.isEqualTo(totalOverdueMoney));
|
||||||
|
|
||||||
BigDecimal totalInArrears = null;
|
BigDecimal totalInArrears = null;
|
||||||
@@ -262,7 +262,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanTransactionData retrieveNewLoanRepaymentDetails(final Long loanId) {
|
public LoanTransactionNewData retrieveNewLoanRepaymentDetails(final Long loanId) {
|
||||||
|
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
@@ -273,31 +273,21 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
throw new LoanNotFoundException(loanId);
|
throw new LoanNotFoundException(loanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String currencyCode = loan.repaymentScheduleDetail()
|
final String currencyCode = loan.repaymentScheduleDetail().getPrincipal().getCurrencyCode();
|
||||||
.getPrincipal().getCurrencyCode();
|
ApplicationCurrency currency = this.applicationCurrencyRepository.findOneByCode(currencyCode);
|
||||||
ApplicationCurrency currency = this.applicationCurrencyRepository
|
|
||||||
.findOneByCode(currencyCode);
|
|
||||||
if (currency == null) {
|
if (currency == null) {
|
||||||
throw new CurrencyNotFoundException(currencyCode);
|
throw new CurrencyNotFoundException(currencyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
final CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
||||||
currency.getName(), currency.getDecimalPlaces(),
|
currency.getName(), currency.getDecimalPlaces(),
|
||||||
currency.getDisplaySymbol(), currency.getNameCode());
|
currency.getDisplaySymbol(), currency.getNameCode());
|
||||||
|
|
||||||
LocalDate earliestUnpaidInstallmentDate = loan
|
final LocalDate earliestUnpaidInstallmentDate = loan.possibleNextRepaymentDate();
|
||||||
.possibleNextRepaymentDate();
|
|
||||||
Money possibleNextRepaymentAmount = loan.possibleNextRepaymentAmount();
|
final Money possibleNextRepaymentAmount = loan.possibleNextRepaymentAmount();
|
||||||
MoneyData possibleNextRepayment = MoneyData.of(currencyData,
|
final EnumOptionData transactionType = LoanEnumerations.transactionType(LoanTransactionType.REPAYMENT);
|
||||||
possibleNextRepaymentAmount.getAmount());
|
return new LoanTransactionNewData(null, transactionType, currencyData, earliestUnpaidInstallmentDate, possibleNextRepaymentAmount.getAmount());
|
||||||
|
|
||||||
LoanTransactionData newRepaymentDetails = new LoanTransactionData();
|
|
||||||
newRepaymentDetails.setTransactionType(LoanEnumerations
|
|
||||||
.transactionType(LoanTransactionType.REPAYMENT));
|
|
||||||
newRepaymentDetails.setDate(earliestUnpaidInstallmentDate);
|
|
||||||
newRepaymentDetails.setTotal(possibleNextRepayment);
|
|
||||||
|
|
||||||
return newRepaymentDetails;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -306,23 +296,24 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
// TODO - OPTIMIZE - write simple sql query to fetch back overdue interest that can be waived along with the date of repayment period interest is overdue.
|
// TODO - OPTIMIZE - write simple sql query to fetch back overdue interest that can be waived along with the date of repayment period interest is overdue.
|
||||||
Loan loan = this.loanRepository.findOne(loanId);
|
final Loan loan = this.loanRepository.findOne(loanId);
|
||||||
if (loan == null) {
|
if (loan == null) {
|
||||||
throw new LoanNotFoundException(loanId);
|
throw new LoanNotFoundException(loanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String currencyCode = loan.repaymentScheduleDetail().getPrincipal().getCurrencyCode();
|
final String currencyCode = loan.repaymentScheduleDetail().getPrincipal().getCurrencyCode();
|
||||||
ApplicationCurrency currency = this.applicationCurrencyRepository.findOneByCode(currencyCode);
|
final ApplicationCurrency currency = this.applicationCurrencyRepository.findOneByCode(currencyCode);
|
||||||
if (currency == null) {
|
if (currency == null) {
|
||||||
throw new CurrencyNotFoundException(currencyCode);
|
throw new CurrencyNotFoundException(currencyCode);
|
||||||
}
|
}
|
||||||
CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
|
||||||
|
final CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
||||||
currency.getName(), currency.getDecimalPlaces(),
|
currency.getName(), currency.getDecimalPlaces(),
|
||||||
currency.getDisplaySymbol(), currency.getNameCode());
|
currency.getDisplaySymbol(), currency.getNameCode());
|
||||||
|
|
||||||
LoanTransaction waiveOfInterest = loan.deriveDefaultInterestWaiverTransaction();
|
final LoanTransaction waiveOfInterest = loan.deriveDefaultInterestWaiverTransaction();
|
||||||
|
|
||||||
EnumOptionData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WAIVE_INTEREST);
|
final EnumOptionData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WAIVE_INTEREST);
|
||||||
|
|
||||||
return new LoanTransactionNewData(null, transactionType, currencyData, waiveOfInterest.getTransactionDate(), waiveOfInterest.getAmount());
|
return new LoanTransactionNewData(null, transactionType, currencyData, waiveOfInterest.getTransactionDate(), waiveOfInterest.getAmount());
|
||||||
}
|
}
|
||||||
@@ -338,26 +329,23 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanTransactionData retrieveLoanTransactionDetails(
|
public LoanTransactionNewData retrieveLoanTransactionDetails(
|
||||||
final Long loanId, final Long transactionId) {
|
final Long loanId, final Long transactionId) {
|
||||||
|
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
Loan loan = this.loanRepository.findOne(loanId);
|
final Loan loan = this.loanRepository.findOne(loanId);
|
||||||
if (loan == null) {
|
if (loan == null) {
|
||||||
throw new LoanNotFoundException(loanId);
|
throw new LoanNotFoundException(loanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String currencyCode = loan.repaymentScheduleDetail()
|
final String currencyCode = loan.repaymentScheduleDetail().getPrincipal().getCurrencyCode();
|
||||||
.getPrincipal().getCurrencyCode();
|
final ApplicationCurrency currency = this.applicationCurrencyRepository.findOneByCode(currencyCode);
|
||||||
ApplicationCurrency currency = this.applicationCurrencyRepository
|
|
||||||
.findOneByCode(currencyCode);
|
|
||||||
if (currency == null) {
|
if (currency == null) {
|
||||||
throw new CurrencyNotFoundException(currencyCode);
|
throw new CurrencyNotFoundException(currencyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoanTransaction transaction = this.loanTransactionRepository
|
final LoanTransaction transaction = this.loanTransactionRepository.findOne(transactionId);
|
||||||
.findOne(transactionId);
|
|
||||||
if (transaction == null) {
|
if (transaction == null) {
|
||||||
throw new LoanTransactionNotFoundException(transactionId);
|
throw new LoanTransactionNotFoundException(transactionId);
|
||||||
}
|
}
|
||||||
@@ -366,20 +354,12 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
throw new LoanTransactionNotFoundException(transactionId, loanId);
|
throw new LoanTransactionNotFoundException(transactionId, loanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
final CurrencyData currencyData = new CurrencyData(currency.getCode(),
|
||||||
currency.getName(), currency.getDecimalPlaces(),
|
currency.getName(), currency.getDecimalPlaces(),
|
||||||
currency.getDisplaySymbol(), currency.getNameCode());
|
currency.getDisplaySymbol(), currency.getNameCode());
|
||||||
MoneyData total = MoneyData.of(currencyData, transaction.getAmount());
|
|
||||||
LocalDate date = transaction.getTransactionDate();
|
final EnumOptionData transactionType = LoanEnumerations.transactionType(transaction.getTypeOf());
|
||||||
|
return new LoanTransactionNewData(transactionId, transactionType, currencyData, transaction.getTransactionDate(), transaction.getAmount());
|
||||||
LoanTransactionData loanRepaymentData = new LoanTransactionData();
|
|
||||||
loanRepaymentData.setTransactionType(LoanEnumerations
|
|
||||||
.transactionType(transaction.getTypeOf()));
|
|
||||||
loanRepaymentData.setId(transactionId);
|
|
||||||
loanRepaymentData.setTotal(total);
|
|
||||||
loanRepaymentData.setDate(date);
|
|
||||||
|
|
||||||
return loanRepaymentData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class LoanMapper implements
|
private static final class LoanMapper implements
|
||||||
|
|||||||
Reference in New Issue
Block a user