abraham-menyhart commented on code in PR #3369: URL: https://github.com/apache/fineract/pull/3369#discussion_r1291080951
########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanPaymentAllocationRule.java: ########## @@ -0,0 +1,87 @@ +/** + * 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.loanproduct.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +@Entity +@Table(name = "m_loan_payment_allocation", uniqueConstraints = { + @UniqueConstraint(columnNames = { "loan_id", "transaction_type" }, name = "loan_payment_allocation_unique_transaction_type") }) +public class LoanPaymentAllocationRule extends AbstractPersistableCustom { + + @ManyToOne + @JoinColumn(name = "loan_id", nullable = false) + private Loan loan; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private TransactionType transactionType; + + @ElementCollection(fetch = FetchType.EAGER) + @Column(name = "allocation_type", nullable = false) Review Comment: In the 0122_add_payment_allocation_rule.xml you used `allocation_types` columnName, here is `allocation_type`, withouth `s`. ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanPaymentAllocationRule.java: ########## @@ -0,0 +1,87 @@ +/** + * 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.loanproduct.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +@Entity +@Table(name = "m_loan_payment_allocation", uniqueConstraints = { + @UniqueConstraint(columnNames = { "loan_id", "transaction_type" }, name = "loan_payment_allocation_unique_transaction_type") }) +public class LoanPaymentAllocationRule extends AbstractPersistableCustom { + + @ManyToOne + @JoinColumn(name = "loan_id", nullable = false) + private Loan loan; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private TransactionType transactionType; + + @ElementCollection(fetch = FetchType.EAGER) + @Column(name = "allocation_type", nullable = false) + private List<AllocationType> allocationTypes; + + @Column(name = "future_installment_allocation_rule", nullable = false) + @Enumerated(EnumType.STRING) + private FutureInstallmentType futureInstallmentAllocationRule; + + public Loan getLoan() { Review Comment: Why don't you use `@Getter`,`@Setter` annotation here? ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java: ########## @@ -0,0 +1,63 @@ +/** + * 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.loanproduct.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; + +@Getter +@Setter +@Entity +@Table(name = "m_loan_product_payment_allocation", uniqueConstraints = { @UniqueConstraint(columnNames = { "loan_product_id", + "transaction_type" }, name = "loan_product_payment_allocation_unique_transaction_type") }) Review Comment: The unique constraint name defined here differs from the one in the xml. ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/PaymentAllocationType.java: ########## @@ -0,0 +1,61 @@ +/** + * 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.loanproduct.domain; + +import static org.apache.fineract.portfolio.loanproduct.domain.AllocationType.FEE; +import static org.apache.fineract.portfolio.loanproduct.domain.AllocationType.INTEREST; +import static org.apache.fineract.portfolio.loanproduct.domain.AllocationType.PENALTY; +import static org.apache.fineract.portfolio.loanproduct.domain.AllocationType.PRINCIPAL; +import static org.apache.fineract.portfolio.loanproduct.domain.DueType.DUE; +import static org.apache.fineract.portfolio.loanproduct.domain.DueType.IN_ADVANCE; +import static org.apache.fineract.portfolio.loanproduct.domain.DueType.PAST_DUE; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PaymentAllocationType { + + PAST_DUE_PENALTY(PAST_DUE, PENALTY), + + PAST_DUE_FEE(PAST_DUE, FEE), + + PAST_DUE_PRINCIPAL(PAST_DUE, PRINCIPAL), + + PAST_DUE_INTEREST(PAST_DUE, INTEREST), + + DUE_PENALTY(DUE, PENALTY), + + DUE_FEE(DUE, FEE), + + DUE_PRINCIPAL(DUE, PRINCIPAL), + + DUE_INTEREST(DUE, INTEREST), + + IN_ADVANCE_PENALTY(IN_ADVANCE, PENALTY), + + IN_ADVANCE_FEE(IN_ADVANCE, FEE), + + IN_ADVANCE_PRINCIPAL(IN_ADVANCE, PRINCIPAL); Review Comment: IN_ADVANCE_INTEREST is missing. ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanPaymentAllocationRule.java: ########## @@ -0,0 +1,67 @@ +/** + * 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.loanaccount.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; +import org.apache.fineract.portfolio.loanproduct.domain.FutureInstallmentAllocationRule; +import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationTransactionType; +import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType; + +@Getter +@Setter +@Entity +@Table(name = "m_loan_payment_allocation", uniqueConstraints = { + @UniqueConstraint(columnNames = { "loan_id", "transaction_type" }, name = "loan_payment_allocation_unique_transaction_type") }) Review Comment: The unique constraint name defined here differs from the one in the xml. ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java: ########## @@ -0,0 +1,86 @@ +/** + * 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.loanproduct.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; + +@Entity +@Table(name = "m_loan_product_payment_allocation", uniqueConstraints = { @UniqueConstraint(columnNames = { "loan_product_id", + "transaction_type" }, name = "loan_product_payment_allocation_unique_transaction_type") }) +public class LoanProductPaymentAllocationRule extends AbstractPersistableCustom { + + @ManyToOne + @JoinColumn(name = "loan_product_id", nullable = false) + private LoanProduct loanProduct; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private TransactionType transactionType; + + @ElementCollection(fetch = FetchType.EAGER) + @Column(name = "allocation_type", nullable = false) + private List<AllocationType> allocationTypes; + + @Enumerated(EnumType.STRING) + @Column(name = "future_installment_allocation_rule", nullable = false) + private FutureInstallmentType futureInstallmentAllocationRule; + + public LoanProduct getLoanProduct() { Review Comment: Why don't you use `@Getter`,`@Setter` annotation here? ########## fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java: ########## @@ -0,0 +1,86 @@ +/** + * 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.loanproduct.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +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.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; + +@Entity +@Table(name = "m_loan_product_payment_allocation", uniqueConstraints = { @UniqueConstraint(columnNames = { "loan_product_id", + "transaction_type" }, name = "loan_product_payment_allocation_unique_transaction_type") }) +public class LoanProductPaymentAllocationRule extends AbstractPersistableCustom { + + @ManyToOne + @JoinColumn(name = "loan_product_id", nullable = false) + private LoanProduct loanProduct; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private TransactionType transactionType; + + @ElementCollection(fetch = FetchType.EAGER) + @Column(name = "allocation_type", nullable = false) Review Comment: In the 0122_add_payment_allocation_rule.xml you used `allocation_types` columnName, here is `allocation_type`, withouth `s.` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
