WIP associations parameter
This commit is contained in:
@@ -26,8 +26,8 @@ import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
|
|||||||
import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
|
import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
|
||||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||||
import org.mifosng.platform.api.data.LoanAccountData;
|
import org.mifosng.platform.api.data.LoanAccountData;
|
||||||
import org.mifosng.platform.api.data.LoanTransactionData;
|
|
||||||
import org.mifosng.platform.api.data.LoanSchedule;
|
import org.mifosng.platform.api.data.LoanSchedule;
|
||||||
|
import org.mifosng.platform.api.data.LoanTransactionData;
|
||||||
import org.mifosng.platform.api.data.NewLoanData;
|
import org.mifosng.platform.api.data.NewLoanData;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
||||||
@@ -69,8 +69,8 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveDetailsForNewLoanApplicationStepOne(
|
public String retrieveDetailsForNewLoanApplicationStepOne(
|
||||||
@QueryParam("clientId") final Long clientId,
|
@QueryParam("clientId") final Long clientId,
|
||||||
@QueryParam("productId") final Long productId,
|
@QueryParam("productId") final Long productId,
|
||||||
@@ -87,8 +87,8 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{loanId}")
|
@Path("{loanId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveLoanAccountDetails(
|
public String retrieveLoanAccountDetails(
|
||||||
@PathParam("loanId") final Long loanId, @Context UriInfo uriInfo) {
|
@PathParam("loanId") final Long loanId, @Context UriInfo uriInfo) {
|
||||||
|
|
||||||
@@ -103,41 +103,48 @@ public class LoansApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response calculateLoanSchedule(
|
public Response calculateLoanSchedule(
|
||||||
@QueryParam("command") final String commandParam,
|
@QueryParam("command") final String commandParam,
|
||||||
final SubmitLoanApplicationCommand command) {
|
final SubmitLoanApplicationCommand command) {
|
||||||
|
|
||||||
LocalDate expectedDisbursementLocalDate = apiDataConversionService
|
LocalDate expectedDisbursementLocalDate = apiDataConversionService
|
||||||
.convertFrom(command.getExpectedDisbursementDate(),
|
.convertFrom(command.getExpectedDisbursementDate(),
|
||||||
"expectedDisbursementDate",
|
"expectedDisbursementDate", command.getDateFormat());
|
||||||
command.getDateFormat());
|
|
||||||
LocalDate repaymentsStartingFromLocalDate = apiDataConversionService
|
LocalDate repaymentsStartingFromLocalDate = apiDataConversionService
|
||||||
.convertFrom(command.getRepaymentsStartingFromDate(),
|
.convertFrom(command.getRepaymentsStartingFromDate(),
|
||||||
"repaymentsStartingFromDate",
|
"repaymentsStartingFromDate", command.getDateFormat());
|
||||||
command.getDateFormat());
|
|
||||||
LocalDate interestChargedFromLocalDate = apiDataConversionService
|
LocalDate interestChargedFromLocalDate = apiDataConversionService
|
||||||
.convertFrom(command.getInterestChargedFromDate(),
|
.convertFrom(command.getInterestChargedFromDate(),
|
||||||
"interestChargedFromDate",
|
"interestChargedFromDate", command.getDateFormat());
|
||||||
command.getDateFormat());
|
|
||||||
LocalDate submittedOnLocalDate = apiDataConversionService.convertFrom(
|
LocalDate submittedOnLocalDate = apiDataConversionService.convertFrom(
|
||||||
command.getSubmittedOnDate(),
|
command.getSubmittedOnDate(), "submittedOnDate",
|
||||||
"submittedOnDate", command.getDateFormat());
|
command.getDateFormat());
|
||||||
|
|
||||||
command.setExpectedDisbursementLocalDate(expectedDisbursementLocalDate);
|
command.setExpectedDisbursementLocalDate(expectedDisbursementLocalDate);
|
||||||
command.setRepaymentsStartingFromLocalDate(repaymentsStartingFromLocalDate);
|
command.setRepaymentsStartingFromLocalDate(repaymentsStartingFromLocalDate);
|
||||||
command.setInterestChargedFromLocalDate(interestChargedFromLocalDate);
|
command.setInterestChargedFromLocalDate(interestChargedFromLocalDate);
|
||||||
command.setSubmittedOnLocalDate(submittedOnLocalDate);
|
command.setSubmittedOnLocalDate(submittedOnLocalDate);
|
||||||
|
|
||||||
Locale clientApplicationLocale = this.apiDataConversionService.localeFromString(command.getLocale());
|
Locale clientApplicationLocale = this.apiDataConversionService
|
||||||
BigDecimal principalValue = this.apiDataConversionService.convertFrom(command.getPrincipal(), "principal", clientApplicationLocale);
|
.localeFromString(command.getLocale());
|
||||||
BigDecimal inArrearsToleranceValue = this.apiDataConversionService.convertFrom(command.getInArrearsTolerance(), "inArrearsTolerance", clientApplicationLocale);
|
BigDecimal principalValue = this.apiDataConversionService.convertFrom(
|
||||||
BigDecimal interestRatePerPeriodValue = this.apiDataConversionService.convertFrom(command.getInterestRatePerPeriod(),"interestRatePerPeriod", clientApplicationLocale);
|
command.getPrincipal(), "principal", clientApplicationLocale);
|
||||||
|
BigDecimal inArrearsToleranceValue = this.apiDataConversionService
|
||||||
Integer repaymentEveryValue = this.apiDataConversionService.convertToInteger(command.getRepaymentEvery(), "repaymentEvery", clientApplicationLocale);
|
.convertFrom(command.getInArrearsTolerance(),
|
||||||
Integer numberOfRepaymentsValue = this.apiDataConversionService.convertToInteger(command.getNumberOfRepayments(), "numberOfRepayments", clientApplicationLocale);
|
"inArrearsTolerance", clientApplicationLocale);
|
||||||
|
BigDecimal interestRatePerPeriodValue = this.apiDataConversionService
|
||||||
|
.convertFrom(command.getInterestRatePerPeriod(),
|
||||||
|
"interestRatePerPeriod", clientApplicationLocale);
|
||||||
|
|
||||||
|
Integer repaymentEveryValue = this.apiDataConversionService
|
||||||
|
.convertToInteger(command.getRepaymentEvery(),
|
||||||
|
"repaymentEvery", clientApplicationLocale);
|
||||||
|
Integer numberOfRepaymentsValue = this.apiDataConversionService
|
||||||
|
.convertToInteger(command.getNumberOfRepayments(),
|
||||||
|
"numberOfRepayments", clientApplicationLocale);
|
||||||
|
|
||||||
command.setPrincipalValue(principalValue);
|
command.setPrincipalValue(principalValue);
|
||||||
command.setInArrearsToleranceValue(inArrearsToleranceValue);
|
command.setInArrearsToleranceValue(inArrearsToleranceValue);
|
||||||
command.setInterestRatePerPeriodValue(interestRatePerPeriodValue);
|
command.setInterestRatePerPeriodValue(interestRatePerPeriodValue);
|
||||||
@@ -168,8 +175,8 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{loanId}")
|
@Path("{loanId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response deleteLoanApplication(@PathParam("loanId") final Long loanId) {
|
public Response deleteLoanApplication(@PathParam("loanId") final Long loanId) {
|
||||||
|
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
@@ -180,43 +187,50 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{loanId}")
|
@Path("{loanId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response stateTransitions(@PathParam("loanId") final Long loanId, @QueryParam("command") final String commandParam,
|
public Response stateTransitions(@PathParam("loanId") final Long loanId,
|
||||||
|
@QueryParam("command") final String commandParam,
|
||||||
final LoanStateTransitionCommand command) {
|
final LoanStateTransitionCommand command) {
|
||||||
|
|
||||||
LocalDate eventLocalDate = this.apiDataConversionService.convertFrom(
|
LocalDate eventLocalDate = this.apiDataConversionService.convertFrom(
|
||||||
command.getEventDate(), "eventDate",
|
command.getEventDate(), "eventDate", command.getDateFormat());
|
||||||
command.getDateFormat());
|
|
||||||
|
|
||||||
command.setLoanId(loanId);
|
command.setLoanId(loanId);
|
||||||
command.setEventLocalDate(eventLocalDate);
|
command.setEventLocalDate(eventLocalDate);
|
||||||
|
|
||||||
Response response = null;
|
Response response = null;
|
||||||
|
|
||||||
if (is(commandParam, "reject")) {
|
if (is(commandParam, "reject")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.rejectLoan(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.rejectLoan(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
} else if (is(commandParam, "withdrewbyclient")) {
|
} else if (is(commandParam, "withdrewbyclient")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.withdrawLoan(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.withdrawLoan(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
} else if (is(commandParam, "approve")) {
|
} else if (is(commandParam, "approve")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.approveLoanApplication(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.approveLoanApplication(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
} else if (is(commandParam, "disburse")) {
|
} else if (is(commandParam, "disburse")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.disburseLoan(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.disburseLoan(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(loanId, command.getNote());
|
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(
|
||||||
|
loanId, command.getNote());
|
||||||
if (is(commandParam, "undoapproval")) {
|
if (is(commandParam, "undoapproval")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.undoLoanApproval(undoCommand);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.undoLoanApproval(undoCommand);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
} else if (is(commandParam, "undodisbursal")) {
|
} else if (is(commandParam, "undodisbursal")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.undoLoanDisbursal(undoCommand);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.undoLoanDisbursal(undoCommand);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam);
|
throw new UnrecognizedQueryParamException("command", commandParam);
|
||||||
}
|
}
|
||||||
@@ -225,13 +239,14 @@ public class LoansApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean is(final String commandParam, final String commandValue) {
|
private boolean is(final String commandParam, final String commandValue) {
|
||||||
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
|
return StringUtils.isNotBlank(commandParam)
|
||||||
|
&& commandParam.trim().equalsIgnoreCase(commandValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{loanId}/transactions")
|
@Path("{loanId}/transactions")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response executeLoanTransaction(
|
public Response executeLoanTransaction(
|
||||||
@PathParam("loanId") final Long loanId,
|
@PathParam("loanId") final Long loanId,
|
||||||
@QueryParam("command") final String commandParam,
|
@QueryParam("command") final String commandParam,
|
||||||
@@ -239,27 +254,30 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
Response response = null;
|
Response response = null;
|
||||||
command.setLoanId(loanId);
|
command.setLoanId(loanId);
|
||||||
|
|
||||||
Locale clientLocale = this.apiDataConversionService.localeFromString(command.getLocale());
|
Locale clientLocale = this.apiDataConversionService
|
||||||
|
.localeFromString(command.getLocale());
|
||||||
|
|
||||||
LocalDate transactionLocalDate = apiDataConversionService.convertFrom(
|
LocalDate transactionLocalDate = apiDataConversionService.convertFrom(
|
||||||
command.getTransactionDate(),
|
command.getTransactionDate(), "transactionDate",
|
||||||
"transactionDate", command.getDateFormat());
|
command.getDateFormat());
|
||||||
command.setTransactionLocalDate(transactionLocalDate);
|
command.setTransactionLocalDate(transactionLocalDate);
|
||||||
|
|
||||||
BigDecimal transactionAmountValue = apiDataConversionService.convertFrom(
|
BigDecimal transactionAmountValue = apiDataConversionService
|
||||||
command.getTransactionAmount(),
|
.convertFrom(command.getTransactionAmount(),
|
||||||
"transactionAmount", clientLocale);
|
"transactionAmount", clientLocale);
|
||||||
command.setTransactionAmountValue(transactionAmountValue);
|
command.setTransactionAmountValue(transactionAmountValue);
|
||||||
|
|
||||||
if (is(commandParam, "repayment")) {
|
if (is(commandParam, "repayment")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.makeLoanRepayment(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.makeLoanRepayment(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
} else if (is(commandParam, "waiver")) {
|
} else if (is(commandParam, "waiver")) {
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.waiveLoanAmount(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.waiveLoanAmount(command);
|
||||||
response = Response.ok().entity(identifier).build();
|
response = Response.ok().entity(identifier).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam);
|
throw new UnrecognizedQueryParamException("command", commandParam);
|
||||||
}
|
}
|
||||||
@@ -269,8 +287,8 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{loanId}/transactions/template")
|
@Path("{loanId}/transactions/template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveNewRepaymentDetails(
|
public String retrieveNewRepaymentDetails(
|
||||||
@PathParam("loanId") final Long loanId,
|
@PathParam("loanId") final Long loanId,
|
||||||
@QueryParam("command") final String commandParam,
|
@QueryParam("command") final String commandParam,
|
||||||
@@ -282,29 +300,28 @@ public class LoansApiResource {
|
|||||||
LoanTransactionData loanRepaymentData = this.loanReadPlatformService
|
LoanTransactionData loanRepaymentData = this.loanReadPlatformService
|
||||||
.retrieveNewLoanRepaymentDetails(loanId);
|
.retrieveNewLoanRepaymentDetails(loanId);
|
||||||
json = this.jsonFormattingService.convertRequest(loanRepaymentData,
|
json = this.jsonFormattingService.convertRequest(loanRepaymentData,
|
||||||
loanRepaymentFilterName, loanRepaymentAllowedFieldList, selectedFields,
|
loanRepaymentFilterName, loanRepaymentAllowedFieldList,
|
||||||
uriInfo.getQueryParameters());
|
selectedFields, uriInfo.getQueryParameters());
|
||||||
} else if (is(commandParam, "waiver")) {
|
} else if (is(commandParam, "waiver")) {
|
||||||
LoanTransactionData loanWaiverData = this.loanReadPlatformService
|
LoanTransactionData loanWaiverData = this.loanReadPlatformService
|
||||||
.retrieveNewLoanWaiverDetails(loanId);
|
.retrieveNewLoanWaiverDetails(loanId);
|
||||||
json = this.jsonFormattingService.convertRequest(loanWaiverData,
|
json = this.jsonFormattingService.convertRequest(loanWaiverData,
|
||||||
loanRepaymentFilterName, loanRepaymentAllowedFieldList, selectedFields,
|
loanRepaymentFilterName, loanRepaymentAllowedFieldList,
|
||||||
uriInfo.getQueryParameters());
|
selectedFields, uriInfo.getQueryParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(json)) {
|
if (StringUtils.isBlank(json)) {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam);
|
throw new UnrecognizedQueryParamException("command", commandParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{loanId}/transactions/{transactionId}")
|
@Path("{loanId}/transactions/{transactionId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveTransaction(
|
public String retrieveTransaction(@PathParam("loanId") final Long loanId,
|
||||||
@PathParam("loanId") final Long loanId,
|
|
||||||
@PathParam("transactionId") final Long transactionId,
|
@PathParam("transactionId") final Long transactionId,
|
||||||
@Context UriInfo uriInfo) {
|
@Context UriInfo uriInfo) {
|
||||||
|
|
||||||
@@ -313,14 +330,14 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
String selectedFields = loanRepaymentDefaultFieldList;
|
String selectedFields = loanRepaymentDefaultFieldList;
|
||||||
return this.jsonFormattingService.convertRequest(loanRepaymentData,
|
return this.jsonFormattingService.convertRequest(loanRepaymentData,
|
||||||
loanRepaymentFilterName, loanRepaymentAllowedFieldList, selectedFields,
|
loanRepaymentFilterName, loanRepaymentAllowedFieldList,
|
||||||
uriInfo.getQueryParameters());
|
selectedFields, uriInfo.getQueryParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{loanId}/transactions/{transactionId}")
|
@Path("{loanId}/transactions/{transactionId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response adjustLoanTransaction(
|
public Response adjustLoanTransaction(
|
||||||
@PathParam("loanId") final Long loanId,
|
@PathParam("loanId") final Long loanId,
|
||||||
@PathParam("transactionId") final Long transactionId,
|
@PathParam("transactionId") final Long transactionId,
|
||||||
@@ -328,20 +345,22 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
command.setLoanId(loanId);
|
command.setLoanId(loanId);
|
||||||
command.setTransactionId(transactionId);
|
command.setTransactionId(transactionId);
|
||||||
|
|
||||||
Locale clientLocale = this.apiDataConversionService.localeFromString(command.getLocale());
|
Locale clientLocale = this.apiDataConversionService
|
||||||
|
.localeFromString(command.getLocale());
|
||||||
|
|
||||||
LocalDate transactionLocalDate = apiDataConversionService.convertFrom(
|
LocalDate transactionLocalDate = apiDataConversionService.convertFrom(
|
||||||
command.getTransactionDate(),
|
command.getTransactionDate(), "transactionDate",
|
||||||
"transactionDate", command.getDateFormat());
|
command.getDateFormat());
|
||||||
command.setTransactionLocalDate(transactionLocalDate);
|
command.setTransactionLocalDate(transactionLocalDate);
|
||||||
|
|
||||||
BigDecimal transactionAmountValue = apiDataConversionService.convertFrom(
|
BigDecimal transactionAmountValue = apiDataConversionService
|
||||||
command.getTransactionAmount(),
|
.convertFrom(command.getTransactionAmount(),
|
||||||
"transactionAmount", clientLocale);
|
"transactionAmount", clientLocale);
|
||||||
command.setTransactionAmountValue(transactionAmountValue);
|
command.setTransactionAmountValue(transactionAmountValue);
|
||||||
|
|
||||||
EntityIdentifier identifier = this.loanWritePlatformService.adjustLoanTransaction(command);
|
EntityIdentifier identifier = this.loanWritePlatformService
|
||||||
|
.adjustLoanTransaction(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-1
@@ -14,12 +14,18 @@ import org.codehaus.jackson.map.ObjectWriter;
|
|||||||
import org.codehaus.jackson.map.ser.FilterProvider;
|
import org.codehaus.jackson.map.ser.FilterProvider;
|
||||||
import org.codehaus.jackson.map.ser.impl.SimpleBeanPropertyFilter;
|
import org.codehaus.jackson.map.ser.impl.SimpleBeanPropertyFilter;
|
||||||
import org.codehaus.jackson.map.ser.impl.SimpleFilterProvider;
|
import org.codehaus.jackson.map.ser.impl.SimpleFilterProvider;
|
||||||
|
import org.mifosng.platform.api.LoansApiResource;
|
||||||
import org.mifosng.platform.exceptions.PlatformInternalServerException;
|
import org.mifosng.platform.exceptions.PlatformInternalServerException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
|
public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory
|
||||||
|
.getLogger(ApiJSONFormattingServiceImpl.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertRequest(Object dataObject, String filterName,
|
public String convertRequest(Object dataObject, String filterName,
|
||||||
String allowedFieldList, String selectedFields,
|
String allowedFieldList, String selectedFields,
|
||||||
@@ -36,6 +42,7 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
|
|||||||
String allowedFieldList, String selectedFields,
|
String allowedFieldList, String selectedFields,
|
||||||
String associationFields, MultivaluedMap<String, String> queryParams) {
|
String associationFields, MultivaluedMap<String, String> queryParams) {
|
||||||
|
|
||||||
|
logger.info("in Loan Date Convert Request: " + associationFields);
|
||||||
return convertRequestCommon(dataObject, filterName, allowedFieldList,
|
return convertRequestCommon(dataObject, filterName, allowedFieldList,
|
||||||
selectedFields, associationFields, queryParams);
|
selectedFields, associationFields, queryParams);
|
||||||
|
|
||||||
@@ -99,11 +106,16 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
|
|||||||
fieldList = allowedFieldList;
|
fieldList = allowedFieldList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTrue(queryParams.getFirst("associations"))) {
|
if (isPassed(queryParams.getFirst("associations"))) {
|
||||||
|
logger.info("is associations");
|
||||||
// assume ALL for moment
|
// assume ALL for moment
|
||||||
if (filterType.equals("I"))
|
if (filterType.equals("I"))
|
||||||
fieldList += "," + associationFields;
|
fieldList += "," + associationFields;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
logger.info("no associations");
|
||||||
if (filterType.equals("E")) {
|
if (filterType.equals("E")) {
|
||||||
if (fieldList.equals(""))
|
if (fieldList.equals(""))
|
||||||
fieldList = associationFields;
|
fieldList = associationFields;
|
||||||
@@ -111,6 +123,9 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
|
|||||||
fieldList += "," + associationFields;
|
fieldList += "," + associationFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logger.info("fieldList to be process is: " + fieldList + " filter type is: " + filterType);
|
||||||
|
|
||||||
return convertDataObjectJSON(dataObject, filterName, filterType,
|
return convertDataObjectJSON(dataObject, filterName, filterType,
|
||||||
fieldList, isTrue(queryParams.getFirst("pretty")));
|
fieldList, isTrue(queryParams.getFirst("pretty")));
|
||||||
|
|||||||
Reference in New Issue
Block a user