diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 6b2cd40ce..236cfa1b7 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -13001,6 +13001,22 @@ POST https://DomainName/api/v1/makercheckers/{auditId}?command=approve POST makercheckers/1?command=approve +Content-Type: application/json + + { "auditId": 1 } + + +   +
+
+

Reject Maker Checker Entry

+
+
+ +PUT https://DomainName/api/v1/makercheckers/{auditId} + + +PUT makercheckers/1 Content-Type: application/json { "auditId": 1 } @@ -30534,7 +30550,15 @@ No Request Body: - + + + makercheckers/{auditId} + + + Reject Maker Checker Entry + + + Scheduler jobs jobs diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java old mode 100644 new mode 100755 index 4fda4c837..ad5c879f1 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java @@ -10,14 +10,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; @@ -110,13 +103,23 @@ public class MakercheckersApiResource { CommandProcessingResult result = null; if (is(commandParam, "approve")) { result = this.writePlatformService.approveEntry(auditId); - } else { + }else { throw new UnrecognizedQueryParamException("command", commandParam); } return this.toApiJsonSerializerAudit.serialize(result); } + @PUT + @Path("{auditId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String rejectMakerCheckerEntry(@PathParam("auditId") final Long auditId) { + final Long id = this.writePlatformService.rejectEntry(auditId); + + return this.toApiJsonSerializerAudit.serialize(CommandProcessingResult.commandOnlyResult(id)); + } + private boolean is(final String commandParam, final String commandValue) { return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); } @@ -132,6 +135,9 @@ public class MakercheckersApiResource { return this.toApiJsonSerializerAudit.serialize(CommandProcessingResult.commandOnlyResult(id)); } + + + private String getExtraCriteria(final String actionName, final String entityName, final Long resourceId, final Long makerId, final String makerDateTimeFrom, final String makerDateTimeTo, final Integer officeId, final Integer groupId, final Integer clientId, final Integer loanId, final Integer savingsAccountId) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java old mode 100644 new mode 100755 index 747c7d8e9..8fd3a8cc4 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java @@ -111,6 +111,12 @@ public class CommandSource extends AbstractPersistable { this.processingResult = CommandProcessingResultType.PROCESSED.getValue(); } + public void markAsRejected(final AppUser checker, final DateTime checkedOnDate){ + this.checker = checker; + this.checkedOnDate = checkedOnDate.toDate(); + this.processingResult = CommandProcessingResultType.REJECTED.getValue(); + } + public void updateResourceId(final Long resourceId) { this.resourceId = resourceId; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformService.java old mode 100644 new mode 100755 index 1b11e1515..8e159d9e7 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformService.java @@ -14,5 +14,7 @@ public interface PortfolioCommandSourceWritePlatformService { CommandProcessingResult approveEntry(Long id); + Long rejectEntry(Long id); + Long deleteEntry(Long makerCheckerId); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java old mode 100644 new mode 100755 index 988ef29e6..d77700c92 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java @@ -5,6 +5,7 @@ */ package org.mifosplatform.commands.service; +import org.joda.time.DateTime; import org.mifosplatform.commands.domain.CommandSource; import org.mifosplatform.commands.domain.CommandSourceRepository; import org.mifosplatform.commands.domain.CommandWrapper; @@ -16,6 +17,7 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; import org.mifosplatform.infrastructure.jobs.service.SchedulerJobRunnerReadService; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; +import org.mifosplatform.useradministration.domain.AppUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -127,4 +129,14 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio return this.schedulerJobRunnerReadService.isUpdatesAllowed(); } + + @Override + public Long rejectEntry(final Long makerCheckerId) { + final CommandSource commandSourceInput = validateMakerCheckerTransaction(makerCheckerId); + validateIsUpdateAllowed(); + final AppUser maker = this.context.authenticatedUser(); + commandSourceInput.markAsRejected(maker, DateTime.now()); + this.commandSourceRepository.save(commandSourceInput); + return makerCheckerId ; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java index 206307db8..f98c29e04 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java @@ -63,7 +63,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer CommandSource commandSourceResult = null; if (command.commandId() != null) { commandSourceResult = this.commandSourceRepository.findOne(command.commandId()); - commandSourceResult.markAsChecked(maker, DateTime.now()); + commandSourceResult.markAsChecked(maker, DateTime.now()); } else { commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker); }