[FINERACT-1678] Internal API for placing lock on loan account
This commit is contained in:
committed by
Arnold Gálovics
parent
c1def37088
commit
5a19995e35
+76
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.cob.api;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.fineract.cob.domain.LoanAccountLock;
|
||||||
|
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
||||||
|
import org.apache.fineract.cob.domain.LockOwner;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Profile("test")
|
||||||
|
@Component
|
||||||
|
@Path("/internal/loans")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class InternalLoanAccountLockApiResource implements InitializingBean {
|
||||||
|
|
||||||
|
private final LoanAccountLockRepository loanAccountLockRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
log.warn("------------------------------------------------------------");
|
||||||
|
log.warn(" ");
|
||||||
|
log.warn("DO NOT USE THIS IN PRODUCTION!");
|
||||||
|
log.warn("Internal client services mode is enabled");
|
||||||
|
log.warn("DO NOT USE THIS IN PRODUCTION!");
|
||||||
|
log.warn(" ");
|
||||||
|
log.warn("------------------------------------------------------------");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("{loanId}/place-lock/{lockOwner}")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public Response placeLockOnLoanAccount(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
|
||||||
|
@PathParam("lockOwner") String lockOwner) {
|
||||||
|
log.warn("------------------------------------------------------------");
|
||||||
|
log.warn(" ");
|
||||||
|
log.warn("Placing lock on loan: {}", loanId);
|
||||||
|
log.warn(" ");
|
||||||
|
log.warn("------------------------------------------------------------");
|
||||||
|
|
||||||
|
LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.valueOf(lockOwner));
|
||||||
|
loanAccountLockRepository.save(loanAccountLock);
|
||||||
|
return Response.status(Response.Status.ACCEPTED).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user