You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "mariiaKraievska (via GitHub)" <gi...@apache.org> on 2026/03/04 11:23:04 UTC
[PR] FINERACT-2455: WC - Loan account creation [fineract]
mariiaKraievska opened a new pull request, #5584:
URL: https://github.com/apache/fineract/pull/5584
## Description
Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)
## Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
- [ ] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
- [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
- [ ] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made.
- [ ] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
- [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
- [ ] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute).
Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924624205
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
+ @Mapping(target = "externalId", source = "externalId", qualifiedByName = "externalIdToString")
+ @Mapping(target = "productId", source = "loan", qualifiedByName = "productIdFromLoan")
+ @Mapping(target = "productName", source = "loan", qualifiedByName = "productNameFromLoan")
+ @Mapping(target = "shortProductName", source = "loan", qualifiedByName = "shortProductNameFromLoan")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusToEnumData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "loanType", expression = "java((org.apache.fineract.infrastructure.core.data.EnumOptionData) null)")
+ @Mapping(target = "loanCycle", expression = "java((Integer) null)")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "buildTimeline")
+ @Mapping(target = "inArrears", expression = "java(Boolean.FALSE)")
+ @Mapping(target = "originalLoan", source = "loan", qualifiedByName = "toOriginalLoan")
Review Comment:
Lets remove `originalLoan`, its N/A for working capital loans.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924452842
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
Review Comment:
Lets store expected details:
- date
- amount
- maturityDate
Lets store actual details:
- date
- amount
- disbursed by
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939873398
##########
fineract-working-capital-loan/src/main/resources/db/changelog/tenant/module/workingcapitalloan/parts/0005_alter_wc_loan_add_columns.xml:
##########
@@ -0,0 +1,437 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <!-- Add business columns to existing m_wc_loan (table and id, version, created_by, last_modified_by, created_on_utc, last_modified_on_utc already exist) -->
+ <changeSet author="fineract" id="wcl-0005-1">
+ <preConditions onFail="MARK_RAN">
+ <tableExists tableName="m_wc_loan"/>
+ </preConditions>
+ <addColumn tableName="m_wc_loan">
+ <column defaultValueComputed="NULL" name="client_id" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="fund_id" type="BIGINT"/>
+ <column name="product_id" type="BIGINT">
+ <constraints nullable="false"/>
+ </column>
+ <column defaultValueComputed="NULL" name="submittedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="rejectedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="rejectedon_userid" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="approvedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="approvedon_userid" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="expected_disbursedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="disbursedon_userid" type="BIGINT"/>
Review Comment:
Removed
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939380417
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/service/WorkingCapitalLoanProductWritePlatformServiceImpl.java:
##########
@@ -145,10 +148,9 @@ public CommandProcessingResult deleteWorkingCapitalLoanProduct(final Long produc
final WorkingCapitalLoanProduct product = this.repository.findById(productId)
.orElseThrow(() -> new WorkingCapitalLoanProductNotFoundException(productId));
- // TODO: Check if product is used in any loans (when Working Capital Loan entity is created)
Review Comment:
Do we need this?
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5584:
URL: https://github.com/apache/fineract/pull/5584
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924616593
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
+ @Mapping(target = "discount", source = "loanProductRelatedDetails.discount")
+ @Mapping(target = "delinquencyBucket", source = "loanProductRelatedDetails.delinquencyBucket")
+ @Mapping(target = "paymentAllocation", source = "paymentAllocationRules", qualifiedByName = "paymentAllocationRulesToData")
+ @Mapping(target = "repaymentFrequencyType", source = "loanProductRelatedDetails", qualifiedByName = "repaymentFrequencyTypeData")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "timelineData")
+ @Mapping(target = "fundOptions", ignore = true)
Review Comment:
Move options to template DTO only!
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924607217
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
Review Comment:
Let's remove `parentAccountNumber` its dummy for Working Capital.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932041315
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/api/WorkingCapitalLoanApiResource.java:
##########
@@ -0,0 +1,213 @@
+/**
+ * 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.workingcapitalloan.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
+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.api.jersey.Pagination;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.portfolio.workingcapitalloan.WorkingCapitalLoanConstants;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.exception.WorkingCapitalLoanNotFoundException;
+import org.apache.fineract.portfolio.workingcapitalloan.service.WorkingCapitalLoanApplicationReadPlatformService;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Component;
+
+@Component
+@Path("/v1/working-capital-loans")
+@Tag(name = "Working Capital Loans", description = "Working Capital Loan applications")
+@RequiredArgsConstructor
+public class WorkingCapitalLoanApiResource {
+
+ private static final String RESOURCE_NAME_FOR_PERMISSIONS = WorkingCapitalLoanConstants.WCL_RESOURCE_NAME;
+
+ private final PlatformSecurityContext context;
+ private final WorkingCapitalLoanApplicationReadPlatformService readPlatformService;
+ private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+
+ @GET
+ @Path("template")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId = "retrieveWorkingCapitalLoanTemplate", summary = "Retrieve Working Capital Loan application template", description = "Returns productOptions and fundOptions. If productId is provided, template fields (productId, productName, currency, periodPaymentRate, etc.) are prefilled from that product.")
+ @ApiResponses({
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = WorkingCapitalLoanApiResourceSwagger.GetWorkingCapitalLoansTemplateResponse.class))) })
+ public WorkingCapitalLoanData retrieveTemplate(@QueryParam("productId") @Parameter(description = "productId") final Long productId,
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2922744769
##########
fineract-avro-schemas/src/main/avro/workingcapitalloan/v1/WorkingCapitalLoanDataV1.avsc:
##########
@@ -0,0 +1,207 @@
+{
+ "name": "WorkingCapitalLoanDataV1",
+ "namespace": "org.apache.fineract.avro.workingcapitalloan.v1",
+ "type": "record",
+ "fields": [
+ {
+ "default": null,
+ "name": "id",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "accountNo",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "externalId",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "client",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.client.v1.ClientDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "officeId",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "fundId",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "fundName",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "product",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.workingcapitalloan.v1.WorkingCapitalLoanProductDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "status",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.loan.v1.LoanStatusEnumDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "submittedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "expectedDisbursementDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "approvedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "rejectedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "principal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "proposedPrincipal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "approvedPrincipal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "totalPayment",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "currency",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.generic.v1.CurrencyDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "periodPaymentRate",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "repaymentEvery",
+ "type": [
+ "null",
+ "int"
+ ]
+ },
+ {
+ "default": null,
+ "name": "repaymentFrequencyType",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.generic.v1.StringEnumOptionDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "flatPercentageAmount",
Review Comment:
This field is the WCL product’s flatPercentageAmount and it is returned by the WCL API. I included it here to keep the external event schema aligned with the WCL API response
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924647165
##########
fineract-working-capital-loan/src/main/resources/db/changelog/tenant/module/workingcapitalloan/parts/0006_add_wc_business_events_external_configuration.xml:
##########
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
Review Comment:
We dont need this for now. Lets move it out.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939875878
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,176 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
Review Comment:
Thank you.
I’ve updated the migration so that loan_status_id is stored as a numeric id (SMALLINT), aligned with the core loan table.
On the entity side I’m now using LoanStatus with @Convert(LoanStatusConverter.class), so the db keeps the numeric id, but the domain model and mappers work with the enum directly. What do you think?
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939872259
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java:
##########
@@ -67,10 +69,4 @@ public interface WorkingCapitalLoanProductRepository
@Query("select wclp FROM WorkingCapitalLoanProduct wclp where wclp.closeDate is null or wclp.closeDate >= :businessDate")
List<WorkingCapitalLoanProduct> fetchActiveWorkingCapitalLoanProducts(LocalDate businessDate);
-
- // TODO: Check if product is used in any loans (for deletion validation)
- // This will be implemented when Working Capital Loan entity is created
- // @Query("SELECT CASE WHEN COUNT(l)>0 THEN TRUE ELSE FALSE END FROM WorkingCapitalLoan l WHERE l.wcpProduct.id =
- // :productId")
- // boolean isProductInUse(@Param("productId") Long productId);
Review Comment:
no, we don’t need this anymore.
The commented–out isProductInUse query was placeholder from the time when the WC loan entity didn’t exist yet. Now that the entity and the actual usage checks are in place, I’ve removed the commented code.
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/service/WorkingCapitalLoanProductWritePlatformServiceImpl.java:
##########
@@ -145,10 +148,9 @@ public CommandProcessingResult deleteWorkingCapitalLoanProduct(final Long produc
final WorkingCapitalLoanProduct product = this.repository.findById(productId)
.orElseThrow(() -> new WorkingCapitalLoanProductNotFoundException(productId));
- // TODO: Check if product is used in any loans (when Working Capital Loan entity is created)
Review Comment:
Same here
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2940399807
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java:
##########
@@ -67,10 +69,4 @@ public interface WorkingCapitalLoanProductRepository
@Query("select wclp FROM WorkingCapitalLoanProduct wclp where wclp.closeDate is null or wclp.closeDate >= :businessDate")
List<WorkingCapitalLoanProduct> fetchActiveWorkingCapitalLoanProducts(LocalDate businessDate);
-
- // TODO: Check if product is used in any loans (for deletion validation)
- // This will be implemented when Working Capital Loan entity is created
- // @Query("SELECT CASE WHEN COUNT(l)>0 THEN TRUE ELSE FALSE END FROM WorkingCapitalLoan l WHERE l.wcpProduct.id =
- // :productId")
- // boolean isProductInUse(@Param("productId") Long productId);
Review Comment:
Can you please double check as it is still there :D
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924614100
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
Review Comment:
Add LoanCycle field, which contains how many WC loan was already opened to this client +1.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932022401
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932026344
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
+
+ @Setter
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932030917
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
+
+ @Setter
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
+
+ @Setter
+ @Column(name = "principal_amount_proposed", scale = 6, precision = 19, nullable = false)
+ private BigDecimal proposedPrincipal;
+
+ @Setter
+ @Column(name = "approved_principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal approvedPrincipal;
+
+ @Setter
+ @Column(name = "total_payment", scale = 6, precision = 19, nullable = false)
+ private BigDecimal totalPayment;
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2919795625
##########
fineract-avro-schemas/src/main/avro/workingcapitalloan/v1/WorkingCapitalLoanDataV1.avsc:
##########
@@ -0,0 +1,207 @@
+{
+ "name": "WorkingCapitalLoanDataV1",
+ "namespace": "org.apache.fineract.avro.workingcapitalloan.v1",
+ "type": "record",
+ "fields": [
+ {
+ "default": null,
+ "name": "id",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "accountNo",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "externalId",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "client",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.client.v1.ClientDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "officeId",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "fundId",
+ "type": [
+ "null",
+ "long"
+ ]
+ },
+ {
+ "default": null,
+ "name": "fundName",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "product",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.workingcapitalloan.v1.WorkingCapitalLoanProductDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "status",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.loan.v1.LoanStatusEnumDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "submittedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "expectedDisbursementDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "approvedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "rejectedOnDate",
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ {
+ "default": null,
+ "name": "principal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "proposedPrincipal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "approvedPrincipal",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "totalPayment",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "currency",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.generic.v1.CurrencyDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "periodPaymentRate",
+ "type": [
+ "null",
+ "bigdecimal"
+ ]
+ },
+ {
+ "default": null,
+ "name": "repaymentEvery",
+ "type": [
+ "null",
+ "int"
+ ]
+ },
+ {
+ "default": null,
+ "name": "repaymentFrequencyType",
+ "type": [
+ "null",
+ "org.apache.fineract.avro.generic.v1.StringEnumOptionDataV1"
+ ]
+ },
+ {
+ "default": null,
+ "name": "flatPercentageAmount",
Review Comment:
what is this?
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924528213
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
Review Comment:
Lets rename to `maturedOnDate` and update only if loan is fully paid.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924452842
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
Review Comment:
Lets store expected details:
- date
- amount
Lets store actual details:
- date
- amount
- disbursed by
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924434631
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Column(name = "disbursedon_date")
Review Comment:
we don need actualDisbursementDate... it doesnt matter, we will have Disbursement transaction anyway which tells and effect the amortization schedule. So for that reason we wont be using this...
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924554731
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
Review Comment:
Lets drop this field for now... we are supporting EIR at first and that should be the only option for now.
Feel free to drop from the LP too.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924437576
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
Review Comment:
Lets repurpose to be `expectedDisbursementAmount`.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924532964
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
+
+ @Setter
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
+
+ @Setter
+ @Column(name = "principal_amount_proposed", scale = 6, precision = 19, nullable = false)
+ private BigDecimal proposedPrincipal;
+
+ @Setter
+ @Column(name = "approved_principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal approvedPrincipal;
+
+ @Setter
+ @Column(name = "total_payment", scale = 6, precision = 19, nullable = false)
+ private BigDecimal totalPayment;
Review Comment:
lets remove this. Running balances should be stored in separate table!
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932040070
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
Review Comment:
Done, @alberto-art3ch please update the UI accordingly
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939452751
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,176 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
Review Comment:
Either use the enum id and keep the `loan_status_id` field or rename this field. I guess we can keep the id. It takes less space.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939426147
##########
fineract-working-capital-loan/src/main/resources/db/changelog/tenant/module/workingcapitalloan/parts/0005_alter_wc_loan_add_columns.xml:
##########
@@ -0,0 +1,437 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
+ <!-- Add business columns to existing m_wc_loan (table and id, version, created_by, last_modified_by, created_on_utc, last_modified_on_utc already exist) -->
+ <changeSet author="fineract" id="wcl-0005-1">
+ <preConditions onFail="MARK_RAN">
+ <tableExists tableName="m_wc_loan"/>
+ </preConditions>
+ <addColumn tableName="m_wc_loan">
+ <column defaultValueComputed="NULL" name="client_id" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="fund_id" type="BIGINT"/>
+ <column name="product_id" type="BIGINT">
+ <constraints nullable="false"/>
+ </column>
+ <column defaultValueComputed="NULL" name="submittedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="rejectedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="rejectedon_userid" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="approvedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="approvedon_userid" type="BIGINT"/>
+ <column defaultValueComputed="NULL" name="expected_disbursedon_date" type="date"/>
+ <column defaultValueComputed="NULL" name="disbursedon_userid" type="BIGINT"/>
Review Comment:
We dont need this.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924434631
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Column(name = "disbursedon_date")
Review Comment:
we don need actualDisbursementDate... it doesnt matter, we will have Disbursement transaction anyway which tells and effect the amortization schedule. So for that reason we wont be using this...
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanDisbursementDetails.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "m_wc_loan_disbursement_detail")
+public class WorkingCapitalLoanDisbursementDetails extends AbstractPersistableCustom<Long> {
+
+ @OneToOne
+ @JoinColumn(name = "wc_loan_id", nullable = false)
+ private WorkingCapitalLoan wcLoan;
+
+ @Column(name = "expected_disburse_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
Review Comment:
Lets repurpose to be `expectedDisbursementAmount`.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924530968
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
+
+ @Setter
+ @Column(name = "closedon_date")
+ private LocalDate closedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "closedon_userid")
+ private AppUser closedBy;
+
+ @Setter
+ @Column(name = "expected_maturedon_date")
+ private LocalDate expectedMaturityDate;
+
+ @Setter
+ @Column(name = "maturedon_date")
+ private LocalDate actualMaturityDate;
+
+ @Setter
+ @Column(name = "principal", scale = 6, precision = 19, nullable = false)
+ private BigDecimal principal;
Review Comment:
lets remove this. Running balances should be stored in separate table!
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924595685
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
Review Comment:
Remove it. (feel free to do the same for Loan as well. it was always `null`)
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924264424
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/workingcapitalloan/WorkingCapitalLoanBusinessEventSerializer.java:
##########
@@ -0,0 +1,56 @@
+/**
+ * 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.infrastructure.event.external.service.serialization.serializer.workingcapitalloan;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.avro.generic.GenericContainer;
+import org.apache.fineract.avro.generator.ByteBufferSerializable;
+import org.apache.fineract.avro.workingcapitalloan.v1.WorkingCapitalLoanDataV1;
+import org.apache.fineract.infrastructure.event.business.domain.BusinessEvent;
+import org.apache.fineract.infrastructure.event.business.domain.workingcapitalloan.WorkingCapitalLoanBusinessEvent;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.workingcapitalloan.WorkingCapitalLoanDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.service.WorkingCapitalLoanApplicationReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class WorkingCapitalLoanBusinessEventSerializer implements BusinessEventSerializer {
Review Comment:
Lets move this out of this PR. We will cover it later.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932054561
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
Review Comment:
Done, I did usinfg the same pattern as for the basic Loan (with loanCounter and loanProductCounter)
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932020591
##########
fineract-avro-schemas/src/main/avro/workingcapitalloan/v1/WorkingCapitalLoanDataV1.avsc:
##########
Review Comment:
Done, removed all the changes related to the event handling for wc module
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/workingcapitalloan/WorkingCapitalLoanBusinessEventSerializer.java:
##########
@@ -0,0 +1,56 @@
+/**
+ * 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.infrastructure.event.external.service.serialization.serializer.workingcapitalloan;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.avro.generic.GenericContainer;
+import org.apache.fineract.avro.generator.ByteBufferSerializable;
+import org.apache.fineract.avro.workingcapitalloan.v1.WorkingCapitalLoanDataV1;
+import org.apache.fineract.infrastructure.event.business.domain.BusinessEvent;
+import org.apache.fineract.infrastructure.event.business.domain.workingcapitalloan.WorkingCapitalLoanBusinessEvent;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.workingcapitalloan.WorkingCapitalLoanDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.service.WorkingCapitalLoanApplicationReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class WorkingCapitalLoanBusinessEventSerializer implements BusinessEventSerializer {
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924245983
##########
fineract-avro-schemas/src/main/avro/workingcapitalloan/v1/WorkingCapitalLoanDataV1.avsc:
##########
Review Comment:
Lets not cover the avro schemas just yet. We will have a follow up story.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924446308
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "disbursedon_userid")
+ private AppUser disbursedBy;
Review Comment:
We dont need this here.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924582082
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
+ @Mapping(target = "discount", source = "loanProductRelatedDetails.discount")
+ @Mapping(target = "delinquencyBucket", source = "loanProductRelatedDetails.delinquencyBucket")
+ @Mapping(target = "paymentAllocation", source = "paymentAllocationRules", qualifiedByName = "paymentAllocationRulesToData")
+ @Mapping(target = "repaymentFrequencyType", source = "loanProductRelatedDetails", qualifiedByName = "repaymentFrequencyTypeData")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "timelineData")
+ @Mapping(target = "fundOptions", ignore = true)
+ @Mapping(target = "delinquencyBucketOptions", ignore = true)
+ @Mapping(target = "productOptions", ignore = true)
+ @Mapping(target = "periodFrequencyTypeOptions", ignore = true)
+ WorkingCapitalLoanData toData(WorkingCapitalLoan loan);
+
+ List<WorkingCapitalLoanData> toDataList(List<WorkingCapitalLoan> loans);
+
+ @Named("clientToData")
+ default ClientData clientToData(final Client client) {
+ ClientData clientData = ClientData.instance(client.getId(), client.getDisplayName());
+ clientData.setAccountNo(client.getAccountNumber());
+ return clientData;
+ }
+
+ @Named("loanStatusData")
+ default LoanStatusEnumData loanStatusData(final LoanStatus loanStatus) {
+ return LoanEnumerations.status(loanStatus);
+ }
+
+ @Named("monetaryCurrencyToCurrencyData")
+ default CurrencyData monetaryCurrencyToCurrencyData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getCurrency() != null) ? detail.getCurrency().toData() : null;
+ }
+
+ @Named("repaymentFrequencyTypeData")
+ default StringEnumOptionData repaymentFrequencyTypeData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getRepaymentFrequencyType() != null) ? detail.getRepaymentFrequencyType().toStringEnumOptionData()
+ : null;
+ }
+
+ @Named("paymentAllocationRulesToData")
+ default List<WorkingCapitalPaymentAllocationData> paymentAllocationRulesToData(
+ final List<WorkingCapitalLoanPaymentAllocationRule> rules) {
+ if (rules == null || rules.isEmpty()) {
+ return null;
+ }
+ final List<WorkingCapitalPaymentAllocationData> result = new ArrayList<>();
+ for (WorkingCapitalLoanPaymentAllocationRule rule : rules) {
+ final AtomicInteger counter = new AtomicInteger(1);
+ final List<WorkingCapitalPaymentAllocationData.PaymentAllocationOrder> orders = new ArrayList<>();
+ if (rule.getAllocationTypes() != null) {
+ for (WorkingCapitalPaymentAllocationType type : rule.getAllocationTypes()) {
+ orders.add(new WorkingCapitalPaymentAllocationData.PaymentAllocationOrder(type.name(), counter.getAndIncrement()));
+ }
+ }
+ result.add(new WorkingCapitalPaymentAllocationData(rule.getTransactionType(), orders));
+ }
+ return result;
+ }
+
+ @Named("timelineData")
+ default LoanApplicationTimelineData timelineData(final WorkingCapitalLoan loan) {
+ final LoanApplicationTimelineData timelineData = new LoanApplicationTimelineData();
+ timelineData.setExpectedDisbursementDate(loan.getExpectedDisbursementDate());
+ timelineData.setSubmittedOnDate(loan.getSubmittedOnDate());
+ if (loan.getApprovedBy() != null) {
+ timelineData.setApprovedByUsername(loan.getApprovedBy().getUsername());
+ timelineData.setApprovedByFirstname(loan.getApprovedBy().getFirstname());
+ timelineData.setApprovedByLastname(loan.getApprovedBy().getLastname());
+ timelineData.setApprovedOnDate(loan.getApprovedOnDate());
+ }
+ if (loan.getDisbursedBy() != null) {
+ timelineData.setDisbursedByUsername(loan.getDisbursedBy().getUsername());
+ timelineData.setDisbursedByFirstname(loan.getDisbursedBy().getFirstname());
+ timelineData.setDisbursedByLastname(loan.getDisbursedBy().getLastname());
+ timelineData.setActualDisbursementDate(loan.getActualDisbursementDate());
Review Comment:
This should be a list.... (if we ever wanna support multi-disbursements).
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939374670
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java:
##########
@@ -38,9 +38,11 @@ public interface WorkingCapitalLoanProductRepository
boolean existsByShortName(String shortName);
@Query("""
- SELECT wclp FROM WorkingCapitalLoanProduct wclp
+ SELECT DISTINCT wclp FROM WorkingCapitalLoanProduct wclp
Review Comment:
why distinct?
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932045728
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
+ @Mapping(target = "discount", source = "loanProductRelatedDetails.discount")
+ @Mapping(target = "delinquencyBucket", source = "loanProductRelatedDetails.delinquencyBucket")
+ @Mapping(target = "paymentAllocation", source = "paymentAllocationRules", qualifiedByName = "paymentAllocationRulesToData")
+ @Mapping(target = "repaymentFrequencyType", source = "loanProductRelatedDetails", qualifiedByName = "repaymentFrequencyTypeData")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "timelineData")
+ @Mapping(target = "fundOptions", ignore = true)
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
+ @Mapping(target = "externalId", source = "externalId", qualifiedByName = "externalIdToString")
+ @Mapping(target = "productId", source = "loan", qualifiedByName = "productIdFromLoan")
+ @Mapping(target = "productName", source = "loan", qualifiedByName = "productNameFromLoan")
+ @Mapping(target = "shortProductName", source = "loan", qualifiedByName = "shortProductNameFromLoan")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusToEnumData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "loanType", expression = "java((org.apache.fineract.infrastructure.core.data.EnumOptionData) null)")
+ @Mapping(target = "loanCycle", expression = "java((Integer) null)")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "buildTimeline")
+ @Mapping(target = "inArrears", expression = "java(Boolean.FALSE)")
+ @Mapping(target = "originalLoan", source = "loan", qualifiedByName = "toOriginalLoan")
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/resources/db/changelog/tenant/module/workingcapitalloan/parts/0007_drop_flat_percentage_amount.xml:
##########
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939452751
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,176 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
Review Comment:
Either use the enum id and keep the `loan_status_id` field or rename this field.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "MarianaDmytrivBinariks (via GitHub)" <gi...@apache.org>.
MarianaDmytrivBinariks commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2918706607
##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalProductLoanAccountStepDef.java:
##########
@@ -0,0 +1,618 @@
+/**
+ * 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.test.stepdef.loan;
+
+import static org.apache.fineract.client.feign.util.FeignCalls.fail;
+import static org.apache.fineract.client.feign.util.FeignCalls.ok;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.cucumber.datatable.DataTable;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import java.math.BigDecimal;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.client.feign.FineractFeignClient;
+import org.apache.fineract.client.feign.util.CallFailedRuntimeException;
+import org.apache.fineract.client.models.DeleteWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.GetWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.PostClientsResponse;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansRequest;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansResponse;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdRequest;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.test.data.workingcapitalproduct.DefaultWorkingCapitalLoanProduct;
+import org.apache.fineract.test.data.workingcapitalproduct.WorkingCapitalLoanProductResolver;
+import org.apache.fineract.test.factory.WorkingCapitalLoanRequestFactory;
+import org.apache.fineract.test.messaging.event.EventCheckHelper;
+import org.apache.fineract.test.stepdef.AbstractStepDef;
+import org.apache.fineract.test.support.TestContextKey;
+
+@Slf4j
+@RequiredArgsConstructor
+public class WorkingCapitalProductLoanAccountStepDef extends AbstractStepDef {
+
+ private static final String DATE_FORMAT = "dd MMMM yyyy";
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT);
+ private static final Long NON_EXISTENT_LOAN_ID = 999_999_999L;
+
+ private final FineractFeignClient fineractClient;
+ private final WorkingCapitalLoanProductResolver workingCapitalLoanProductResolver;
+ private final WorkingCapitalLoanRequestFactory workingCapitalLoanRequestFactory;
+ private final EventCheckHelper eventCheckHelper;
+
+ @When("Admin creates a working capital loan with the following data:")
+ public void createWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ createWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void createWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final PostWorkingCapitalLoansResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
+ log.info("Working Capital Loan created with ID: {}", response.getLoanId());
+ }
+
+ @Then("Working capital loan creation was successful")
+ public void verifyWorkingCapitalLoanCreationSuccess() {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+
+ assertNotNull(loanResponse, "Loan creation response should not be null");
+ assertNotNull(loanResponse.getLoanId(), "Loan ID should not be null");
+ assertNotNull(loanResponse.getResourceId(), "Resource ID should not be null");
+ assertTrue(loanResponse.getLoanId() > 0, "Loan ID should be greater than 0");
+
+ log.info("Verified working capital loan creation was successful. Loan ID: {}", loanResponse.getLoanId());
+ }
+
+ @Then("Working capital loan account has the correct data:")
+ public void verifyWorkingCapitalLoanAccountData(final DataTable table) {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+ final Long loanId = loanResponse.getLoanId();
+
+ final GetWorkingCapitalLoansLoanIdResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().retrieveWorkingCapitalLoanById(loanId));
+
+ final List<List<String>> data = table.asLists();
+ final List<String> expectedData = data.get(1);
+
+ final String expectedProductName = expectedData.get(0);
+ final String expectedSubmittedOnDate = expectedData.get(1);
+ final String expectedDisbursementDate = expectedData.get(2);
+ final String expectedStatus = expectedData.get(3);
+ final String expectedPrincipal = expectedData.get(4);
+ final String expectedTotalPayment = expectedData.get(5);
+ final String expectedPeriodPaymentRate = expectedData.get(6);
+ final String expectedDiscount = expectedData.get(7);
+
+ assertNotNull(response, "Loan response should not be null");
+ assertNotNull(response.getProduct(), "Product should not be null");
+ assertThat(response.getProduct().getName()).as("Product name should match").isEqualTo(expectedProductName);
+ assertThat(response.getSubmittedOnDate().toString()).as("Submitted on date should match").isEqualTo(expectedSubmittedOnDate);
+ assertThat(response.getExpectedDisbursementDate().toString()).as("Expected disbursement date should match")
+ .isEqualTo(expectedDisbursementDate);
+ assertThat(response.getStatus().getValue()).as("Status should match").isEqualTo(expectedStatus);
+ assertThat(response.getPrincipal()).as("Principal should match").isEqualByComparingTo(new BigDecimal(expectedPrincipal));
+ assertThat(response.getTotalPayment()).as("Total payment should match").isEqualByComparingTo(new BigDecimal(expectedTotalPayment));
+ assertThat(response.getPeriodPaymentRate()).as("Period payment rate should match")
+ .isEqualByComparingTo(new BigDecimal(expectedPeriodPaymentRate));
+
+ if ("null".equals(expectedDiscount)) {
+ assertThat(response.getDiscount()).as("Discount should be null").isNull();
+ } else {
+ assertThat(response.getDiscount()).as("Discount should match").isEqualByComparingTo(new BigDecimal(expectedDiscount));
+ }
+
+ log.info("Verified working capital loan account data for loan ID: {}", loanId);
+ }
+
+ @Then("Creating a working capital loan with LP overridables disabled and with the following data will result an error:")
+ public void creatingWorkingCapitalLoanWithLpOverridablesDisabledWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+ final String flatPercentageAmount = loanData.get(7);
+ final String delinquencyBucketId = loanData.get(8);
+ final String repaymentEvery = loanData.get(9);
+ final String repaymentFrequencyType = loanData.get(10);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null)
+ .flatPercentageAmount(
+ flatPercentageAmount != null && !flatPercentageAmount.isEmpty() ? new BigDecimal(flatPercentageAmount) : null)
+ .delinquencyBucketId(
+ delinquencyBucketId != null && !delinquencyBucketId.isEmpty() ? Long.valueOf(delinquencyBucketId) : null)
+ .repaymentEvery(repaymentEvery != null && !repaymentEvery.isEmpty() ? Integer.valueOf(repaymentEvery) : null)
+ .repaymentFrequencyType(repaymentFrequencyType != null && !repaymentFrequencyType.isEmpty()
+ ? PostWorkingCapitalLoansRequest.RepaymentFrequencyTypeEnum.valueOf(repaymentFrequencyType)
+ : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error 1: validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain flatPercentageAmount override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+
+ log.info("Validation error 2: validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain delinquencyBucketId override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+
+ log.info("Validation error 3: validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentEvery override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+
+ log.info("Validation error 4: validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentFrequencyType override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+
+ log.info("Verified working capital loan creation failed with expected validation errors for LP overridables disabled");
+ }
+
+ @Then("Creating a working capital loan with principal amount greater than Working Capital Loan Product max will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountGreaterThanWorkingCapitalLoanProductMaxWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
Review Comment:
please move all occurrences of repeating at least this part of code(from parsing datatable to creating a model PostWorkingCapitalLoansRequest, that can be as returning value) into separate method, as this part repeats a few times
rows 218-239
##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalProductLoanAccountStepDef.java:
##########
@@ -0,0 +1,618 @@
+/**
+ * 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.test.stepdef.loan;
+
+import static org.apache.fineract.client.feign.util.FeignCalls.fail;
+import static org.apache.fineract.client.feign.util.FeignCalls.ok;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.cucumber.datatable.DataTable;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import java.math.BigDecimal;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.client.feign.FineractFeignClient;
+import org.apache.fineract.client.feign.util.CallFailedRuntimeException;
+import org.apache.fineract.client.models.DeleteWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.GetWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.PostClientsResponse;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansRequest;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansResponse;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdRequest;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.test.data.workingcapitalproduct.DefaultWorkingCapitalLoanProduct;
+import org.apache.fineract.test.data.workingcapitalproduct.WorkingCapitalLoanProductResolver;
+import org.apache.fineract.test.factory.WorkingCapitalLoanRequestFactory;
+import org.apache.fineract.test.messaging.event.EventCheckHelper;
+import org.apache.fineract.test.stepdef.AbstractStepDef;
+import org.apache.fineract.test.support.TestContextKey;
+
+@Slf4j
+@RequiredArgsConstructor
+public class WorkingCapitalProductLoanAccountStepDef extends AbstractStepDef {
+
+ private static final String DATE_FORMAT = "dd MMMM yyyy";
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT);
+ private static final Long NON_EXISTENT_LOAN_ID = 999_999_999L;
+
+ private final FineractFeignClient fineractClient;
+ private final WorkingCapitalLoanProductResolver workingCapitalLoanProductResolver;
+ private final WorkingCapitalLoanRequestFactory workingCapitalLoanRequestFactory;
+ private final EventCheckHelper eventCheckHelper;
+
+ @When("Admin creates a working capital loan with the following data:")
+ public void createWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ createWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void createWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final PostWorkingCapitalLoansResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
+ log.info("Working Capital Loan created with ID: {}", response.getLoanId());
+ }
+
+ @Then("Working capital loan creation was successful")
+ public void verifyWorkingCapitalLoanCreationSuccess() {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+
+ assertNotNull(loanResponse, "Loan creation response should not be null");
+ assertNotNull(loanResponse.getLoanId(), "Loan ID should not be null");
+ assertNotNull(loanResponse.getResourceId(), "Resource ID should not be null");
+ assertTrue(loanResponse.getLoanId() > 0, "Loan ID should be greater than 0");
+
+ log.info("Verified working capital loan creation was successful. Loan ID: {}", loanResponse.getLoanId());
+ }
+
+ @Then("Working capital loan account has the correct data:")
+ public void verifyWorkingCapitalLoanAccountData(final DataTable table) {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+ final Long loanId = loanResponse.getLoanId();
+
+ final GetWorkingCapitalLoansLoanIdResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().retrieveWorkingCapitalLoanById(loanId));
+
+ final List<List<String>> data = table.asLists();
+ final List<String> expectedData = data.get(1);
+
+ final String expectedProductName = expectedData.get(0);
+ final String expectedSubmittedOnDate = expectedData.get(1);
+ final String expectedDisbursementDate = expectedData.get(2);
+ final String expectedStatus = expectedData.get(3);
+ final String expectedPrincipal = expectedData.get(4);
+ final String expectedTotalPayment = expectedData.get(5);
+ final String expectedPeriodPaymentRate = expectedData.get(6);
+ final String expectedDiscount = expectedData.get(7);
+
+ assertNotNull(response, "Loan response should not be null");
+ assertNotNull(response.getProduct(), "Product should not be null");
+ assertThat(response.getProduct().getName()).as("Product name should match").isEqualTo(expectedProductName);
+ assertThat(response.getSubmittedOnDate().toString()).as("Submitted on date should match").isEqualTo(expectedSubmittedOnDate);
+ assertThat(response.getExpectedDisbursementDate().toString()).as("Expected disbursement date should match")
+ .isEqualTo(expectedDisbursementDate);
+ assertThat(response.getStatus().getValue()).as("Status should match").isEqualTo(expectedStatus);
+ assertThat(response.getPrincipal()).as("Principal should match").isEqualByComparingTo(new BigDecimal(expectedPrincipal));
+ assertThat(response.getTotalPayment()).as("Total payment should match").isEqualByComparingTo(new BigDecimal(expectedTotalPayment));
+ assertThat(response.getPeriodPaymentRate()).as("Period payment rate should match")
+ .isEqualByComparingTo(new BigDecimal(expectedPeriodPaymentRate));
+
+ if ("null".equals(expectedDiscount)) {
+ assertThat(response.getDiscount()).as("Discount should be null").isNull();
+ } else {
+ assertThat(response.getDiscount()).as("Discount should match").isEqualByComparingTo(new BigDecimal(expectedDiscount));
+ }
+
+ log.info("Verified working capital loan account data for loan ID: {}", loanId);
+ }
+
+ @Then("Creating a working capital loan with LP overridables disabled and with the following data will result an error:")
+ public void creatingWorkingCapitalLoanWithLpOverridablesDisabledWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+ final String flatPercentageAmount = loanData.get(7);
+ final String delinquencyBucketId = loanData.get(8);
+ final String repaymentEvery = loanData.get(9);
+ final String repaymentFrequencyType = loanData.get(10);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null)
+ .flatPercentageAmount(
+ flatPercentageAmount != null && !flatPercentageAmount.isEmpty() ? new BigDecimal(flatPercentageAmount) : null)
+ .delinquencyBucketId(
+ delinquencyBucketId != null && !delinquencyBucketId.isEmpty() ? Long.valueOf(delinquencyBucketId) : null)
+ .repaymentEvery(repaymentEvery != null && !repaymentEvery.isEmpty() ? Integer.valueOf(repaymentEvery) : null)
+ .repaymentFrequencyType(repaymentFrequencyType != null && !repaymentFrequencyType.isEmpty()
+ ? PostWorkingCapitalLoansRequest.RepaymentFrequencyTypeEnum.valueOf(repaymentFrequencyType)
+ : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error 1: validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain flatPercentageAmount override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+
+ log.info("Validation error 2: validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain delinquencyBucketId override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+
+ log.info("Validation error 3: validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentEvery override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+
+ log.info("Validation error 4: validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentFrequencyType override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+
+ log.info("Verified working capital loan creation failed with expected validation errors for LP overridables disabled");
+ }
+
+ @Then("Creating a working capital loan with principal amount greater than Working Capital Loan Product max will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountGreaterThanWorkingCapitalLoanProductMaxWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error: validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.less.than.or.equal.to.max");
+ assertThat(exception.getMessage()).as("Should contain principalAmount max validation error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.less.than.or.equal.to.max");
+
+ log.info("Verified working capital loan creation failed with principal amount exceeding max");
+ }
+
+ @Then("Creating a working capital loan with principal amount smaller than Working Capital Loan Product min will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountSmallerThanWorkingCapitalLoanProductMinWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error: validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.greater.than.or.equal.to.min");
+ assertThat(exception.getMessage()).as("Should contain principalAmount min validation error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.greater.than.or.equal.to.min");
+
+ log.info("Verified working capital loan creation failed with principal amount below min");
+ }
+
+ @Then("Creating a working capital loan with missing mandatory fields will result an error:")
+ public void creatingAWorkingCapitalLoanWithMissingMandatoryFieldsWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate != null && !submittedOnDate.isEmpty() ? submittedOnDate : null)
+ .expectedDisbursementDate(
+ expectedDisbursementDate != null && !expectedDisbursementDate.isEmpty() ? expectedDisbursementDate : null)
+ .principalAmount(principal != null && !principal.isEmpty() ? new BigDecimal(principal) : null)
+ .totalPayment(totalPayment != null && !totalPayment.isEmpty() ? new BigDecimal(totalPayment) : null)
+ .periodPaymentRate(periodPaymentRate != null && !periodPaymentRate.isEmpty() ? new BigDecimal(periodPaymentRate) : null)
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ // Check for missing mandatory field errors
+ if (principal == null || principal.isEmpty()) {
+ log.info("Checking for principalAmount error: The parameter `principalAmount` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain principalAmount mandatory error")
+ .contains("The parameter `principalAmount` is mandatory.");
+ }
+
+ if (totalPayment == null || totalPayment.isEmpty()) {
+ log.info("Checking for totalPayment error: The parameter `totalPayment` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain totalPayment mandatory error")
+ .contains("The parameter `totalPayment` is mandatory.");
+ }
+
+ if (periodPaymentRate == null || periodPaymentRate.isEmpty()) {
+ log.info("Checking for periodPaymentRate error: The parameter `periodPaymentRate` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain periodPaymentRate mandatory error")
+ .contains("The parameter `periodPaymentRate` is mandatory.");
+ }
+
+ if (expectedDisbursementDate == null || expectedDisbursementDate.isEmpty()) {
+ log.info("Checking for expectedDisbursementDate error: The parameter `expectedDisbursementDate` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain expectedDisbursementDate mandatory error")
+ .contains("The parameter `expectedDisbursementDate` is mandatory.");
+ }
+
+ log.info("Verified working capital loan creation failed with missing mandatory fields");
+ }
+
+ @When("Admin modifies the working capital loan with the following data:")
+ public void modifyWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ modifyWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void modifyWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String submittedOnDate = loanData.get(0);
Review Comment:
also, this part od code is repeating and can be put into separate method - get data from data table and create PutWorkingCapitalLoansLoanIdRequest modifyRequest
*rows 369-385, repeating the same 400-421 etc.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924441446
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoan.java:
##########
@@ -0,0 +1,172 @@
+/**
+ * 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.workingcapitalloan.domain;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.fund.domain.Fund;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Entity
+@Table(name = "m_wc_loan", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "wc_loan_account_no_UNIQUE"),
+ @UniqueConstraint(columnNames = { "external_id" }, name = "wc_loan_externalid_UNIQUE") })
+@Getter
+public class WorkingCapitalLoan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
+
+ @Version
+ int version;
+
+ @Setter
+ @Column(name = "last_closed_business_date")
+ private LocalDate lastClosedBusinessDate;
+
+ @Setter
+ @Column(name = "account_no", length = 20, unique = true, nullable = false)
+ private String accountNumber;
+
+ @Setter
+ @Column(name = "external_id")
+ private ExternalId externalId;
+
+ @Setter
+ @ManyToOne
+ @JoinColumn(name = "client_id")
+ private Client client;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "fund_id")
+ private Fund fund;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id", nullable = false)
+ private WorkingCapitalLoanProduct loanProduct;
+
+ @Setter
+ @Column(name = "loan_status_id", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private LoanStatus loanStatus;
+
+ @Setter
+ @Column(name = "submittedon_date")
+ private LocalDate submittedOnDate;
+
+ @Setter
+ @Column(name = "rejectedon_date")
+ private LocalDate rejectedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "rejectedon_userid")
+ private AppUser rejectedBy;
+
+ @Setter
+ @Column(name = "approvedon_date")
+ private LocalDate approvedOnDate;
+
+ @Setter
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "approvedon_userid")
+ private AppUser approvedBy;
+
+ @Setter
+ @Column(name = "expected_disbursedon_date")
+ private LocalDate expectedDisbursementDate;
+
+ @Setter
+ @Column(name = "disbursedon_date")
+ private LocalDate actualDisbursementDate;
Review Comment:
We dont need this. use `List<WorkingCapitalLoanDisbursementDetails>` instead
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924589284
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
+ @Mapping(target = "discount", source = "loanProductRelatedDetails.discount")
+ @Mapping(target = "delinquencyBucket", source = "loanProductRelatedDetails.delinquencyBucket")
+ @Mapping(target = "paymentAllocation", source = "paymentAllocationRules", qualifiedByName = "paymentAllocationRulesToData")
+ @Mapping(target = "repaymentFrequencyType", source = "loanProductRelatedDetails", qualifiedByName = "repaymentFrequencyTypeData")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "timelineData")
+ @Mapping(target = "fundOptions", ignore = true)
+ @Mapping(target = "delinquencyBucketOptions", ignore = true)
+ @Mapping(target = "productOptions", ignore = true)
+ @Mapping(target = "periodFrequencyTypeOptions", ignore = true)
+ WorkingCapitalLoanData toData(WorkingCapitalLoan loan);
+
+ List<WorkingCapitalLoanData> toDataList(List<WorkingCapitalLoan> loans);
+
+ @Named("clientToData")
+ default ClientData clientToData(final Client client) {
+ ClientData clientData = ClientData.instance(client.getId(), client.getDisplayName());
+ clientData.setAccountNo(client.getAccountNumber());
+ return clientData;
+ }
+
+ @Named("loanStatusData")
+ default LoanStatusEnumData loanStatusData(final LoanStatus loanStatus) {
+ return LoanEnumerations.status(loanStatus);
+ }
+
+ @Named("monetaryCurrencyToCurrencyData")
+ default CurrencyData monetaryCurrencyToCurrencyData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getCurrency() != null) ? detail.getCurrency().toData() : null;
+ }
+
+ @Named("repaymentFrequencyTypeData")
+ default StringEnumOptionData repaymentFrequencyTypeData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getRepaymentFrequencyType() != null) ? detail.getRepaymentFrequencyType().toStringEnumOptionData()
+ : null;
+ }
+
+ @Named("paymentAllocationRulesToData")
+ default List<WorkingCapitalPaymentAllocationData> paymentAllocationRulesToData(
+ final List<WorkingCapitalLoanPaymentAllocationRule> rules) {
+ if (rules == null || rules.isEmpty()) {
+ return null;
+ }
+ final List<WorkingCapitalPaymentAllocationData> result = new ArrayList<>();
+ for (WorkingCapitalLoanPaymentAllocationRule rule : rules) {
+ final AtomicInteger counter = new AtomicInteger(1);
+ final List<WorkingCapitalPaymentAllocationData.PaymentAllocationOrder> orders = new ArrayList<>();
+ if (rule.getAllocationTypes() != null) {
+ for (WorkingCapitalPaymentAllocationType type : rule.getAllocationTypes()) {
+ orders.add(new WorkingCapitalPaymentAllocationData.PaymentAllocationOrder(type.name(), counter.getAndIncrement()));
+ }
+ }
+ result.add(new WorkingCapitalPaymentAllocationData(rule.getTransactionType(), orders));
+ }
+ return result;
+ }
+
+ @Named("timelineData")
+ default LoanApplicationTimelineData timelineData(final WorkingCapitalLoan loan) {
+ final LoanApplicationTimelineData timelineData = new LoanApplicationTimelineData();
+ timelineData.setExpectedDisbursementDate(loan.getExpectedDisbursementDate());
+ timelineData.setSubmittedOnDate(loan.getSubmittedOnDate());
+ if (loan.getApprovedBy() != null) {
+ timelineData.setApprovedByUsername(loan.getApprovedBy().getUsername());
+ timelineData.setApprovedByFirstname(loan.getApprovedBy().getFirstname());
+ timelineData.setApprovedByLastname(loan.getApprovedBy().getLastname());
+ timelineData.setApprovedOnDate(loan.getApprovedOnDate());
+ }
+ if (loan.getDisbursedBy() != null) {
+ timelineData.setDisbursedByUsername(loan.getDisbursedBy().getUsername());
+ timelineData.setDisbursedByFirstname(loan.getDisbursedBy().getFirstname());
+ timelineData.setDisbursedByLastname(loan.getDisbursedBy().getLastname());
+ timelineData.setActualDisbursementDate(loan.getActualDisbursementDate());
Review Comment:
I guess for now we can go with the 1st disbursement here and introduce a new field on this DTO where the full disbursement list as well returned.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924578095
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/api/WorkingCapitalLoanApiResource.java:
##########
@@ -0,0 +1,213 @@
+/**
+ * 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.workingcapitalloan.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
+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.api.jersey.Pagination;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.portfolio.workingcapitalloan.WorkingCapitalLoanConstants;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.exception.WorkingCapitalLoanNotFoundException;
+import org.apache.fineract.portfolio.workingcapitalloan.service.WorkingCapitalLoanApplicationReadPlatformService;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Component;
+
+@Component
+@Path("/v1/working-capital-loans")
+@Tag(name = "Working Capital Loans", description = "Working Capital Loan applications")
+@RequiredArgsConstructor
+public class WorkingCapitalLoanApiResource {
+
+ private static final String RESOURCE_NAME_FOR_PERMISSIONS = WorkingCapitalLoanConstants.WCL_RESOURCE_NAME;
+
+ private final PlatformSecurityContext context;
+ private final WorkingCapitalLoanApplicationReadPlatformService readPlatformService;
+ private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+
+ @GET
+ @Path("template")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId = "retrieveWorkingCapitalLoanTemplate", summary = "Retrieve Working Capital Loan application template", description = "Returns productOptions and fundOptions. If productId is provided, template fields (productId, productName, currency, periodPaymentRate, etc.) are prefilled from that product.")
+ @ApiResponses({
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = WorkingCapitalLoanApiResourceSwagger.GetWorkingCapitalLoansTemplateResponse.class))) })
+ public WorkingCapitalLoanData retrieveTemplate(@QueryParam("productId") @Parameter(description = "productId") final Long productId,
Review Comment:
Lets not reuse and bloat `WorkingCapitalLoanData` DTO unnecessarily.
If we need template informations as well, use a new DTO instead.
So
`WorkingCapitalLoanData` for fetching the loan details
`WorkingCapitalLoanDataWithOptions` (horrible name, feel free to rename it!) -> for fetching the loan details + template informations.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2924595685
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
Review Comment:
Remove it. (feel free to do the same for Loan as well. it was always `null`)
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "peter-kovacs-dpc (via GitHub)" <gi...@apache.org>.
peter-kovacs-dpc commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2918913297
##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalProductLoanAccountStepDef.java:
##########
@@ -0,0 +1,618 @@
+/**
+ * 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.test.stepdef.loan;
+
+import static org.apache.fineract.client.feign.util.FeignCalls.fail;
+import static org.apache.fineract.client.feign.util.FeignCalls.ok;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.cucumber.datatable.DataTable;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import java.math.BigDecimal;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.client.feign.FineractFeignClient;
+import org.apache.fineract.client.feign.util.CallFailedRuntimeException;
+import org.apache.fineract.client.models.DeleteWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.GetWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.PostClientsResponse;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansRequest;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansResponse;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdRequest;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.test.data.workingcapitalproduct.DefaultWorkingCapitalLoanProduct;
+import org.apache.fineract.test.data.workingcapitalproduct.WorkingCapitalLoanProductResolver;
+import org.apache.fineract.test.factory.WorkingCapitalLoanRequestFactory;
+import org.apache.fineract.test.messaging.event.EventCheckHelper;
+import org.apache.fineract.test.stepdef.AbstractStepDef;
+import org.apache.fineract.test.support.TestContextKey;
+
+@Slf4j
+@RequiredArgsConstructor
+public class WorkingCapitalProductLoanAccountStepDef extends AbstractStepDef {
+
+ private static final String DATE_FORMAT = "dd MMMM yyyy";
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT);
+ private static final Long NON_EXISTENT_LOAN_ID = 999_999_999L;
+
+ private final FineractFeignClient fineractClient;
+ private final WorkingCapitalLoanProductResolver workingCapitalLoanProductResolver;
+ private final WorkingCapitalLoanRequestFactory workingCapitalLoanRequestFactory;
+ private final EventCheckHelper eventCheckHelper;
+
+ @When("Admin creates a working capital loan with the following data:")
+ public void createWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ createWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void createWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final PostWorkingCapitalLoansResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
+ log.info("Working Capital Loan created with ID: {}", response.getLoanId());
+ }
+
+ @Then("Working capital loan creation was successful")
+ public void verifyWorkingCapitalLoanCreationSuccess() {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+
+ assertNotNull(loanResponse, "Loan creation response should not be null");
+ assertNotNull(loanResponse.getLoanId(), "Loan ID should not be null");
+ assertNotNull(loanResponse.getResourceId(), "Resource ID should not be null");
+ assertTrue(loanResponse.getLoanId() > 0, "Loan ID should be greater than 0");
+
+ log.info("Verified working capital loan creation was successful. Loan ID: {}", loanResponse.getLoanId());
+ }
+
+ @Then("Working capital loan account has the correct data:")
+ public void verifyWorkingCapitalLoanAccountData(final DataTable table) {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+ final Long loanId = loanResponse.getLoanId();
+
+ final GetWorkingCapitalLoansLoanIdResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().retrieveWorkingCapitalLoanById(loanId));
+
+ final List<List<String>> data = table.asLists();
+ final List<String> expectedData = data.get(1);
+
+ final String expectedProductName = expectedData.get(0);
+ final String expectedSubmittedOnDate = expectedData.get(1);
+ final String expectedDisbursementDate = expectedData.get(2);
+ final String expectedStatus = expectedData.get(3);
+ final String expectedPrincipal = expectedData.get(4);
+ final String expectedTotalPayment = expectedData.get(5);
+ final String expectedPeriodPaymentRate = expectedData.get(6);
+ final String expectedDiscount = expectedData.get(7);
+
+ assertNotNull(response, "Loan response should not be null");
+ assertNotNull(response.getProduct(), "Product should not be null");
+ assertThat(response.getProduct().getName()).as("Product name should match").isEqualTo(expectedProductName);
+ assertThat(response.getSubmittedOnDate().toString()).as("Submitted on date should match").isEqualTo(expectedSubmittedOnDate);
+ assertThat(response.getExpectedDisbursementDate().toString()).as("Expected disbursement date should match")
+ .isEqualTo(expectedDisbursementDate);
+ assertThat(response.getStatus().getValue()).as("Status should match").isEqualTo(expectedStatus);
+ assertThat(response.getPrincipal()).as("Principal should match").isEqualByComparingTo(new BigDecimal(expectedPrincipal));
+ assertThat(response.getTotalPayment()).as("Total payment should match").isEqualByComparingTo(new BigDecimal(expectedTotalPayment));
+ assertThat(response.getPeriodPaymentRate()).as("Period payment rate should match")
+ .isEqualByComparingTo(new BigDecimal(expectedPeriodPaymentRate));
+
+ if ("null".equals(expectedDiscount)) {
+ assertThat(response.getDiscount()).as("Discount should be null").isNull();
+ } else {
+ assertThat(response.getDiscount()).as("Discount should match").isEqualByComparingTo(new BigDecimal(expectedDiscount));
+ }
+
+ log.info("Verified working capital loan account data for loan ID: {}", loanId);
+ }
+
+ @Then("Creating a working capital loan with LP overridables disabled and with the following data will result an error:")
+ public void creatingWorkingCapitalLoanWithLpOverridablesDisabledWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+ final String flatPercentageAmount = loanData.get(7);
+ final String delinquencyBucketId = loanData.get(8);
+ final String repaymentEvery = loanData.get(9);
+ final String repaymentFrequencyType = loanData.get(10);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null)
+ .flatPercentageAmount(
+ flatPercentageAmount != null && !flatPercentageAmount.isEmpty() ? new BigDecimal(flatPercentageAmount) : null)
+ .delinquencyBucketId(
+ delinquencyBucketId != null && !delinquencyBucketId.isEmpty() ? Long.valueOf(delinquencyBucketId) : null)
+ .repaymentEvery(repaymentEvery != null && !repaymentEvery.isEmpty() ? Integer.valueOf(repaymentEvery) : null)
+ .repaymentFrequencyType(repaymentFrequencyType != null && !repaymentFrequencyType.isEmpty()
+ ? PostWorkingCapitalLoansRequest.RepaymentFrequencyTypeEnum.valueOf(repaymentFrequencyType)
+ : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error 1: validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain flatPercentageAmount override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+
+ log.info("Validation error 2: validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain delinquencyBucketId override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+
+ log.info("Validation error 3: validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentEvery override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+
+ log.info("Validation error 4: validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentFrequencyType override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+
+ log.info("Verified working capital loan creation failed with expected validation errors for LP overridables disabled");
+ }
+
+ @Then("Creating a working capital loan with principal amount greater than Working Capital Loan Product max will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountGreaterThanWorkingCapitalLoanProductMaxWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
Review Comment:
Fixed
##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalProductLoanAccountStepDef.java:
##########
@@ -0,0 +1,618 @@
+/**
+ * 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.test.stepdef.loan;
+
+import static org.apache.fineract.client.feign.util.FeignCalls.fail;
+import static org.apache.fineract.client.feign.util.FeignCalls.ok;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.cucumber.datatable.DataTable;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import java.math.BigDecimal;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.client.feign.FineractFeignClient;
+import org.apache.fineract.client.feign.util.CallFailedRuntimeException;
+import org.apache.fineract.client.models.DeleteWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.GetWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.client.models.PostClientsResponse;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansRequest;
+import org.apache.fineract.client.models.PostWorkingCapitalLoansResponse;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdRequest;
+import org.apache.fineract.client.models.PutWorkingCapitalLoansLoanIdResponse;
+import org.apache.fineract.test.data.workingcapitalproduct.DefaultWorkingCapitalLoanProduct;
+import org.apache.fineract.test.data.workingcapitalproduct.WorkingCapitalLoanProductResolver;
+import org.apache.fineract.test.factory.WorkingCapitalLoanRequestFactory;
+import org.apache.fineract.test.messaging.event.EventCheckHelper;
+import org.apache.fineract.test.stepdef.AbstractStepDef;
+import org.apache.fineract.test.support.TestContextKey;
+
+@Slf4j
+@RequiredArgsConstructor
+public class WorkingCapitalProductLoanAccountStepDef extends AbstractStepDef {
+
+ private static final String DATE_FORMAT = "dd MMMM yyyy";
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT);
+ private static final Long NON_EXISTENT_LOAN_ID = 999_999_999L;
+
+ private final FineractFeignClient fineractClient;
+ private final WorkingCapitalLoanProductResolver workingCapitalLoanProductResolver;
+ private final WorkingCapitalLoanRequestFactory workingCapitalLoanRequestFactory;
+ private final EventCheckHelper eventCheckHelper;
+
+ @When("Admin creates a working capital loan with the following data:")
+ public void createWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ createWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void createWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final PostWorkingCapitalLoansResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
+ log.info("Working Capital Loan created with ID: {}", response.getLoanId());
+ }
+
+ @Then("Working capital loan creation was successful")
+ public void verifyWorkingCapitalLoanCreationSuccess() {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+
+ assertNotNull(loanResponse, "Loan creation response should not be null");
+ assertNotNull(loanResponse.getLoanId(), "Loan ID should not be null");
+ assertNotNull(loanResponse.getResourceId(), "Resource ID should not be null");
+ assertTrue(loanResponse.getLoanId() > 0, "Loan ID should be greater than 0");
+
+ log.info("Verified working capital loan creation was successful. Loan ID: {}", loanResponse.getLoanId());
+ }
+
+ @Then("Working capital loan account has the correct data:")
+ public void verifyWorkingCapitalLoanAccountData(final DataTable table) {
+ final PostWorkingCapitalLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+ final Long loanId = loanResponse.getLoanId();
+
+ final GetWorkingCapitalLoansLoanIdResponse response = ok(
+ () -> fineractClient.workingCapitalLoans().retrieveWorkingCapitalLoanById(loanId));
+
+ final List<List<String>> data = table.asLists();
+ final List<String> expectedData = data.get(1);
+
+ final String expectedProductName = expectedData.get(0);
+ final String expectedSubmittedOnDate = expectedData.get(1);
+ final String expectedDisbursementDate = expectedData.get(2);
+ final String expectedStatus = expectedData.get(3);
+ final String expectedPrincipal = expectedData.get(4);
+ final String expectedTotalPayment = expectedData.get(5);
+ final String expectedPeriodPaymentRate = expectedData.get(6);
+ final String expectedDiscount = expectedData.get(7);
+
+ assertNotNull(response, "Loan response should not be null");
+ assertNotNull(response.getProduct(), "Product should not be null");
+ assertThat(response.getProduct().getName()).as("Product name should match").isEqualTo(expectedProductName);
+ assertThat(response.getSubmittedOnDate().toString()).as("Submitted on date should match").isEqualTo(expectedSubmittedOnDate);
+ assertThat(response.getExpectedDisbursementDate().toString()).as("Expected disbursement date should match")
+ .isEqualTo(expectedDisbursementDate);
+ assertThat(response.getStatus().getValue()).as("Status should match").isEqualTo(expectedStatus);
+ assertThat(response.getPrincipal()).as("Principal should match").isEqualByComparingTo(new BigDecimal(expectedPrincipal));
+ assertThat(response.getTotalPayment()).as("Total payment should match").isEqualByComparingTo(new BigDecimal(expectedTotalPayment));
+ assertThat(response.getPeriodPaymentRate()).as("Period payment rate should match")
+ .isEqualByComparingTo(new BigDecimal(expectedPeriodPaymentRate));
+
+ if ("null".equals(expectedDiscount)) {
+ assertThat(response.getDiscount()).as("Discount should be null").isNull();
+ } else {
+ assertThat(response.getDiscount()).as("Discount should match").isEqualByComparingTo(new BigDecimal(expectedDiscount));
+ }
+
+ log.info("Verified working capital loan account data for loan ID: {}", loanId);
+ }
+
+ @Then("Creating a working capital loan with LP overridables disabled and with the following data will result an error:")
+ public void creatingWorkingCapitalLoanWithLpOverridablesDisabledWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+ final String flatPercentageAmount = loanData.get(7);
+ final String delinquencyBucketId = loanData.get(8);
+ final String repaymentEvery = loanData.get(9);
+ final String repaymentFrequencyType = loanData.get(10);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null)
+ .flatPercentageAmount(
+ flatPercentageAmount != null && !flatPercentageAmount.isEmpty() ? new BigDecimal(flatPercentageAmount) : null)
+ .delinquencyBucketId(
+ delinquencyBucketId != null && !delinquencyBucketId.isEmpty() ? Long.valueOf(delinquencyBucketId) : null)
+ .repaymentEvery(repaymentEvery != null && !repaymentEvery.isEmpty() ? Integer.valueOf(repaymentEvery) : null)
+ .repaymentFrequencyType(repaymentFrequencyType != null && !repaymentFrequencyType.isEmpty()
+ ? PostWorkingCapitalLoansRequest.RepaymentFrequencyTypeEnum.valueOf(repaymentFrequencyType)
+ : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error 1: validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain flatPercentageAmount override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.flatPercentageAmount.override.not.allowed.by.product");
+
+ log.info("Validation error 2: validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain delinquencyBucketId override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.delinquencyBucketId.override.not.allowed.by.product");
+
+ log.info("Validation error 3: validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentEvery override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentEvery.override.not.allowed.by.product");
+
+ log.info("Validation error 4: validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+ assertThat(exception.getMessage()).as("Should contain repaymentFrequencyType override error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.repaymentFrequencyType.override.not.allowed.by.product");
+
+ log.info("Verified working capital loan creation failed with expected validation errors for LP overridables disabled");
+ }
+
+ @Then("Creating a working capital loan with principal amount greater than Working Capital Loan Product max will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountGreaterThanWorkingCapitalLoanProductMaxWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error: validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.less.than.or.equal.to.max");
+ assertThat(exception.getMessage()).as("Should contain principalAmount max validation error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.less.than.or.equal.to.max");
+
+ log.info("Verified working capital loan creation failed with principal amount exceeding max");
+ }
+
+ @Then("Creating a working capital loan with principal amount smaller than Working Capital Loan Product min will result an error:")
+ public void creatingAWorkingCapitalLoanWithPrincipalAmountSmallerThanWorkingCapitalLoanProductMinWillResultAnError(
+ final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisbursementDate)
+ .principalAmount(new BigDecimal(principal)).totalPayment(new BigDecimal(totalPayment))
+ .periodPaymentRate(new BigDecimal(periodPaymentRate))
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ log.info("Validation error: validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.greater.than.or.equal.to.min");
+ assertThat(exception.getMessage()).as("Should contain principalAmount min validation error")
+ .contains("validation.msg.WORKINGCAPITALLOAN.principalAmount.must.be.greater.than.or.equal.to.min");
+
+ log.info("Verified working capital loan creation failed with principal amount below min");
+ }
+
+ @Then("Creating a working capital loan with missing mandatory fields will result an error:")
+ public void creatingAWorkingCapitalLoanWithMissingMandatoryFieldsWillResultAnError(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ final List<String> loanData = data.get(1);
+
+ final String loanProduct = loanData.get(0);
+ final String submittedOnDate = loanData.get(1);
+ final String expectedDisbursementDate = loanData.get(2);
+ final String principal = loanData.get(3);
+ final String totalPayment = loanData.get(4);
+ final String periodPaymentRate = loanData.get(5);
+ final String discount = loanData.get(6);
+
+ final PostClientsResponse clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
+ final Long clientId = clientResponse.getClientId();
+
+ final DefaultWorkingCapitalLoanProduct product = DefaultWorkingCapitalLoanProduct.valueOf(loanProduct);
+ final Long loanProductId = workingCapitalLoanProductResolver.resolve(product);
+
+ final PostWorkingCapitalLoansRequest loansRequest = workingCapitalLoanRequestFactory.defaultWorkingCapitalLoansRequest(clientId)
+ .productId(loanProductId).submittedOnDate(submittedOnDate != null && !submittedOnDate.isEmpty() ? submittedOnDate : null)
+ .expectedDisbursementDate(
+ expectedDisbursementDate != null && !expectedDisbursementDate.isEmpty() ? expectedDisbursementDate : null)
+ .principalAmount(principal != null && !principal.isEmpty() ? new BigDecimal(principal) : null)
+ .totalPayment(totalPayment != null && !totalPayment.isEmpty() ? new BigDecimal(totalPayment) : null)
+ .periodPaymentRate(periodPaymentRate != null && !periodPaymentRate.isEmpty() ? new BigDecimal(periodPaymentRate) : null)
+ .discount(discount != null && !discount.isEmpty() ? new BigDecimal(discount) : null);
+
+ final CallFailedRuntimeException exception = fail(
+ () -> fineractClient.workingCapitalLoans().submitWorkingCapitalLoanApplication(loansRequest));
+ testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, exception);
+
+ log.info("HTTP status code: {}", exception.getStatus());
+
+ assertThat(exception.getStatus()).as("HTTP status code should be 400").isEqualTo(400);
+
+ // Check for missing mandatory field errors
+ if (principal == null || principal.isEmpty()) {
+ log.info("Checking for principalAmount error: The parameter `principalAmount` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain principalAmount mandatory error")
+ .contains("The parameter `principalAmount` is mandatory.");
+ }
+
+ if (totalPayment == null || totalPayment.isEmpty()) {
+ log.info("Checking for totalPayment error: The parameter `totalPayment` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain totalPayment mandatory error")
+ .contains("The parameter `totalPayment` is mandatory.");
+ }
+
+ if (periodPaymentRate == null || periodPaymentRate.isEmpty()) {
+ log.info("Checking for periodPaymentRate error: The parameter `periodPaymentRate` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain periodPaymentRate mandatory error")
+ .contains("The parameter `periodPaymentRate` is mandatory.");
+ }
+
+ if (expectedDisbursementDate == null || expectedDisbursementDate.isEmpty()) {
+ log.info("Checking for expectedDisbursementDate error: The parameter `expectedDisbursementDate` is mandatory.");
+ assertThat(exception.getMessage()).as("Should contain expectedDisbursementDate mandatory error")
+ .contains("The parameter `expectedDisbursementDate` is mandatory.");
+ }
+
+ log.info("Verified working capital loan creation failed with missing mandatory fields");
+ }
+
+ @When("Admin modifies the working capital loan with the following data:")
+ public void modifyWorkingCapitalLoan(final DataTable table) {
+ final List<List<String>> data = table.asLists();
+ modifyWorkingCapitalLoanAccount(data.get(1));
+ }
+
+ private void modifyWorkingCapitalLoanAccount(final List<String> loanData) {
+ final String submittedOnDate = loanData.get(0);
Review Comment:
fixed
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2932043181
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanMapper.java:
##########
@@ -0,0 +1,146 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.delinquency.mapper.DelinquencyBucketMapper;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.data.WorkingCapitalLoanData;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanPaymentAllocationRule;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.data.WorkingCapitalPaymentAllocationData;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProductRelatedDetails;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalPaymentAllocationType;
+import org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductMapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { DelinquencyBucketMapper.class, WorkingCapitalLoanProductMapper.class })
+public interface WorkingCapitalLoanMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "client", source = "client", qualifiedByName = "clientToData")
+ @Mapping(target = "officeId", source = "client.office.id")
+ @Mapping(target = "fundId", source = "fund.id")
+ @Mapping(target = "fundName", source = "fund.name")
+ @Mapping(target = "product", source = "loanProduct")
+ @Mapping(target = "status", source = "loanStatus", qualifiedByName = "loanStatusData")
+ @Mapping(target = "currency", source = "loanProductRelatedDetails", qualifiedByName = "monetaryCurrencyToCurrencyData")
+ @Mapping(target = "periodPaymentRate", source = "loanProductRelatedDetails.periodPaymentRate")
+ @Mapping(target = "repaymentEvery", source = "loanProductRelatedDetails.repaymentEvery")
+ @Mapping(target = "flatPercentageAmount", source = "loanProductRelatedDetails.flatPercentageAmount")
+ @Mapping(target = "discount", source = "loanProductRelatedDetails.discount")
+ @Mapping(target = "delinquencyBucket", source = "loanProductRelatedDetails.delinquencyBucket")
+ @Mapping(target = "paymentAllocation", source = "paymentAllocationRules", qualifiedByName = "paymentAllocationRulesToData")
+ @Mapping(target = "repaymentFrequencyType", source = "loanProductRelatedDetails", qualifiedByName = "repaymentFrequencyTypeData")
+ @Mapping(target = "timeline", source = "loan", qualifiedByName = "timelineData")
+ @Mapping(target = "fundOptions", ignore = true)
+ @Mapping(target = "delinquencyBucketOptions", ignore = true)
+ @Mapping(target = "productOptions", ignore = true)
+ @Mapping(target = "periodFrequencyTypeOptions", ignore = true)
+ WorkingCapitalLoanData toData(WorkingCapitalLoan loan);
+
+ List<WorkingCapitalLoanData> toDataList(List<WorkingCapitalLoan> loans);
+
+ @Named("clientToData")
+ default ClientData clientToData(final Client client) {
+ ClientData clientData = ClientData.instance(client.getId(), client.getDisplayName());
+ clientData.setAccountNo(client.getAccountNumber());
+ return clientData;
+ }
+
+ @Named("loanStatusData")
+ default LoanStatusEnumData loanStatusData(final LoanStatus loanStatus) {
+ return LoanEnumerations.status(loanStatus);
+ }
+
+ @Named("monetaryCurrencyToCurrencyData")
+ default CurrencyData monetaryCurrencyToCurrencyData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getCurrency() != null) ? detail.getCurrency().toData() : null;
+ }
+
+ @Named("repaymentFrequencyTypeData")
+ default StringEnumOptionData repaymentFrequencyTypeData(final WorkingCapitalLoanProductRelatedDetails detail) {
+ return (detail != null && detail.getRepaymentFrequencyType() != null) ? detail.getRepaymentFrequencyType().toStringEnumOptionData()
+ : null;
+ }
+
+ @Named("paymentAllocationRulesToData")
+ default List<WorkingCapitalPaymentAllocationData> paymentAllocationRulesToData(
+ final List<WorkingCapitalLoanPaymentAllocationRule> rules) {
+ if (rules == null || rules.isEmpty()) {
+ return null;
+ }
+ final List<WorkingCapitalPaymentAllocationData> result = new ArrayList<>();
+ for (WorkingCapitalLoanPaymentAllocationRule rule : rules) {
+ final AtomicInteger counter = new AtomicInteger(1);
+ final List<WorkingCapitalPaymentAllocationData.PaymentAllocationOrder> orders = new ArrayList<>();
+ if (rule.getAllocationTypes() != null) {
+ for (WorkingCapitalPaymentAllocationType type : rule.getAllocationTypes()) {
+ orders.add(new WorkingCapitalPaymentAllocationData.PaymentAllocationOrder(type.name(), counter.getAndIncrement()));
+ }
+ }
+ result.add(new WorkingCapitalPaymentAllocationData(rule.getTransactionType(), orders));
+ }
+ return result;
+ }
+
+ @Named("timelineData")
+ default LoanApplicationTimelineData timelineData(final WorkingCapitalLoan loan) {
+ final LoanApplicationTimelineData timelineData = new LoanApplicationTimelineData();
+ timelineData.setExpectedDisbursementDate(loan.getExpectedDisbursementDate());
+ timelineData.setSubmittedOnDate(loan.getSubmittedOnDate());
+ if (loan.getApprovedBy() != null) {
+ timelineData.setApprovedByUsername(loan.getApprovedBy().getUsername());
+ timelineData.setApprovedByFirstname(loan.getApprovedBy().getFirstname());
+ timelineData.setApprovedByLastname(loan.getApprovedBy().getLastname());
+ timelineData.setApprovedOnDate(loan.getApprovedOnDate());
+ }
+ if (loan.getDisbursedBy() != null) {
+ timelineData.setDisbursedByUsername(loan.getDisbursedBy().getUsername());
+ timelineData.setDisbursedByFirstname(loan.getDisbursedBy().getFirstname());
+ timelineData.setDisbursedByLastname(loan.getDisbursedBy().getLastname());
+ timelineData.setActualDisbursementDate(loan.getActualDisbursementDate());
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/mapper/WorkingCapitalLoanSummaryMapper.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.workingcapitalloan.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
+import org.apache.fineract.portfolio.accountdetails.data.WorkingCapitalLoanAccountSummaryData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
+import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
+import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
+import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoan;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class, uses = { WorkingCapitalLoanMapper.class })
+public interface WorkingCapitalLoanSummaryMapper {
+
+ @Mapping(target = "accountNo", source = "accountNumber")
+ @Mapping(target = "parentAccountNumber", expression = "java((String) null)")
Review Comment:
Done
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939377206
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java:
##########
@@ -67,10 +69,4 @@ public interface WorkingCapitalLoanProductRepository
@Query("select wclp FROM WorkingCapitalLoanProduct wclp where wclp.closeDate is null or wclp.closeDate >= :businessDate")
List<WorkingCapitalLoanProduct> fetchActiveWorkingCapitalLoanProducts(LocalDate businessDate);
-
- // TODO: Check if product is used in any loans (for deletion validation)
- // This will be implemented when Working Capital Loan entity is created
- // @Query("SELECT CASE WHEN COUNT(l)>0 THEN TRUE ELSE FALSE END FROM WorkingCapitalLoan l WHERE l.wcpProduct.id =
- // :productId")
- // boolean isProductInUse(@Param("productId") Long productId);
Review Comment:
Do we need this?
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2455: WC - Loan account CRUD [fineract]
Posted by "mariiaKraievska (via GitHub)" <gi...@apache.org>.
mariiaKraievska commented on code in PR #5584:
URL: https://github.com/apache/fineract/pull/5584#discussion_r2939861616
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java:
##########
@@ -38,9 +38,11 @@ public interface WorkingCapitalLoanProductRepository
boolean existsByShortName(String shortName);
@Query("""
- SELECT wclp FROM WorkingCapitalLoanProduct wclp
+ SELECT DISTINCT wclp FROM WorkingCapitalLoanProduct wclp
Review Comment:
I added distinct here because we using left join for paymentAllocationRules. With `SELECT DISTINCT wclp` we will get all paymentAllocationRules attached to that product, but the product itself will appear only once in the result.
--
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: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org