ptuomola commented on a change in pull request #1784:
URL: https://github.com/apache/fineract/pull/1784#discussion_r706918928
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
##########
@@ -622,6 +647,7 @@ private void
saveAndFlushLoanWithDataIntegrityViolationChecks(final Loan loan) {
try {
List<LoanRepaymentScheduleInstallment> installments =
loan.getRepaymentScheduleInstallments();
for (LoanRepaymentScheduleInstallment installment : installments) {
+ // installment.setPostDatedChecksToNull();
Review comment:
Should this be removed?
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/repaymentwithpostdatedchecks/api/RepaymentWithPostDatedChecksApiResource.java
##########
@@ -0,0 +1,152 @@
+/**
+ * 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.portfolio.repaymentwithpostdatedchecks.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.parameters.RequestBody;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import java.util.List;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import
org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import
org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import
org.apache.fineract.portfolio.repaymentwithpostdatedchecks.data.PostDatedChecksData;
+import
org.apache.fineract.portfolio.repaymentwithpostdatedchecks.service.RepaymentWithPostDatedChecksReadPlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Path("/loans/{loanId}/postdatedchecks")
+@Component
+@Scope("singleton")
+@Tag(name = "repayment with post dated checks", description = "Repay with post
dated checks")
+public class RepaymentWithPostDatedChecksApiResource {
+
+ private final PlatformSecurityContext context;
+ private final FromJsonHelper fromJsonHelper;
+ private final DefaultToApiJsonSerializer<PostDatedChecksData>
apiJsonSerializer;
+ private final PortfolioCommandSourceWritePlatformService
commandsSourceWritePlatformService;
+ private final RepaymentWithPostDatedChecksReadPlatformService
repaymentWithPostDatedChecksReadPlatformService;
+
+ @Autowired
+ public RepaymentWithPostDatedChecksApiResource(final
PlatformSecurityContext context, final FromJsonHelper fromJsonHelper,
+ final DefaultToApiJsonSerializer<PostDatedChecksData>
apiJsonSerializer,
+ final PortfolioCommandSourceWritePlatformService
portfolioCommandSourceWritePlatformService,
+ final RepaymentWithPostDatedChecksReadPlatformService
repaymentWithPostDatedChecksReadPlatformService) {
+ this.context = context;
+ this.fromJsonHelper = fromJsonHelper;
+ this.apiJsonSerializer = apiJsonSerializer;
+ this.commandsSourceWritePlatformService =
portfolioCommandSourceWritePlatformService;
+ this.repaymentWithPostDatedChecksReadPlatformService =
repaymentWithPostDatedChecksReadPlatformService;
+ }
+
+ @GET
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(summary = "Get All Post Dated Checks", description = "Get All
Post dated Checks")
+ @ApiResponses({
+ @ApiResponse(responseCode = "200", description = "OK", content =
@Content(array = @ArraySchema(schema = @Schema(implementation =
PostDatedChecksApiResourceSwagger.GetPostDatedChecks.class)))) })
+ public String getPostDatedChecks(@PathParam("loanId")
@Parameter(description = "loanId") final Long loanId) {
+ this.context.authenticatedUser();
+ final List<PostDatedChecksData> postDatedChecksDataList =
this.repaymentWithPostDatedChecksReadPlatformService
+ .getPostDatedChecks(loanId);
+ return this.apiJsonSerializer.serialize(postDatedChecksDataList);
+ }
+
+ @GET
+ @Path("{installmentId}")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(summary = "Get Post Dated Check", description = "Get Post Dated
Check")
+ @ApiResponses({
+ @ApiResponse(responseCode = "200", description = "OK", content =
@Content(array = @ArraySchema(schema = @Schema(implementation =
PostDatedChecksApiResourceSwagger.GetPostDatedChecks.class)))) })
+ public String getPostDatedCheck(@PathParam("installmentId")
@Parameter(description = "installmentId") final Integer installmentId,
+ @PathParam("loanId") @Parameter(description = "loanId") final Long
loanId) {
+ /**
+ * TODO: Check the permission to read data.
Review comment:
Is this TODO still valid?
##########
File path:
integration-tests/src/test/java/org/apache/fineract/integrationtests/RepaymentWithPostDatedChecksTest.java
##########
@@ -0,0 +1,162 @@
+/**
+ * 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.integrationtests;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.builder.ResponseSpecBuilder;
+import io.restassured.http.ContentType;
+import io.restassured.specification.RequestSpecification;
+import io.restassured.specification.ResponseSpecification;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import org.apache.fineract.integrationtests.common.ClientHelper;
+import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
+import
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
+import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
+import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class RepaymentWithPostDatedChecksTest {
+
+ private ResponseSpecification responseSpec;
+ private RequestSpecification requestSpec;
+ private final SimpleDateFormat dateFormatterStandard = new
SimpleDateFormat("dd MMMM yyyy");
+ private LoanTransactionHelper loanTransactionHelper;
+
+ @BeforeEach
+ public void setup() {
+ Utils.initializeRESTAssured();
+ this.requestSpec = new
RequestSpecBuilder().setContentType(ContentType.JSON).build();
+ this.requestSpec.header("Authorization", "Basic " +
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+ this.responseSpec = new
ResponseSpecBuilder().expectStatusCode(200).build();
+ }
+
+ @Test
+ public void testRepaymentWithPostDatedChecks() {
Review comment:
This seems to test only that the loan can be disbursed. Could you add
integration tests for the other functionalities as well? i.e. repayment etc
##########
File path:
fineract-provider/src/main/resources/sql/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql
##########
@@ -19,48 +19,3 @@
ALTER TABLE `m_loan`
ADD COLUMN `loan_type_enum` SMALLINT NOT NULL AFTER `loan_status_id`;
-
--- create collateral management table
-CREATE TABLE IF NOT EXISTS `m_collateral_management` (
Review comment:
Hmm... why are we deleting the lines relating to collateral management
tables? Is this in the right PR?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]