Skip to content

Commit

Permalink
Feature/FBR-45: Implement Job Batch Payments (#291)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Peter Oketayot <[email protected]>
  • Loading branch information
fiter-julius-oketayot and Julius Peter Oketayot authored Nov 21, 2023
1 parent c1d30ad commit 89f5514
Show file tree
Hide file tree
Showing 16 changed files with 717 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*/
public final class JsonCommand {

private final String jsonCommand;
private String jsonCommand;
private final JsonElement parsedCommand;
private final FromJsonHelper fromApiJsonHelper;
private final Long commandId;
Expand Down Expand Up @@ -681,4 +681,8 @@ private boolean differenceExists(final LocalDate baseValue, final LocalDate work

return differenceExists;
}

public void setJsonCommand(String jsonCommand) {
this.jsonCommand = jsonCommand;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public enum JobName {
"Execute All Dirty Jobs"), INCREASE_BUSINESS_DATE_BY_1_DAY(
"Increase Business Date by 1 day"), INCREASE_COB_DATE_BY_1_DAY(
"Increase COB Date by 1 day"), DISABLE_EXPIRED_PREQUALIFICATIONS(
"Disable Expired Prequalifications");
"Disable Expired Prequalifications"), IMPORT_BATCHES_OF_LOAN_REPAYMENTS(
"Import Batches of Loan Repayments");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public void setGuaranteeName(String guaranteeName) {
public void setAmountInWords(String amountInWords) {
this.amountInWords = amountInWords;
}

public void setIsReassigned(Boolean isReassigned) {
this.isReassigned = isReassigned;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ public ChequeData mapRow(final ResultSet rs, final int rowNum) throws SQLExcepti
.printedByUsername(printedByUsername).voidAuthorizedByUsername(voidAuthorizedByUsername)
.lastModifiedByUsername(lastModifiedByUsername).clientName(clientName).clientNo(clientNo).groupName(groupName)
.loanAccNo(loanAccNo).loanAmount(loanAmount).guaranteeAmount(guaranteeAmount).groupNo(groupNo).guaranteeId(guaranteeId)
.caseId(caseId).chequeAmount(chequeAmount).agencyId(agencyId).loanAccId(loanAccId).reassingedCheque(Boolean.valueOf(reassinged)).build();
.caseId(caseId).chequeAmount(chequeAmount).agencyId(agencyId).loanAccId(loanAccId)
.reassingedCheque(Boolean.valueOf(reassinged)).build();

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public CommandProcessingResult printCheques(JsonCommand command) {
throw new BankChequeException(
"print.cheques.loan:" + loan.getAccountNumber() + " is.not.in.disbursement.authorization.status");
}
if (!chequeData.getReassingedCheque()){
if (!chequeData.getReassingedCheque()) {
CommandProcessingResult result = this.loanWritePlatformService.disburseLoan(loanAccId, command, false);
if (result.getLoanId() == null) {
throw new BankChequeException("print.cheques", "failed.to.disburse.loan " + loanAccId);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.portfolio.loanaccount.data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class LoanRepaymentImportData {

private Long id;
private String bankingAgency;
private Long customerCode;
private String agency;
private String loanCode;
private String productCode;
private BigDecimal amount;
private String receiptNumber;
private Long status;
private LocalDateTime uploadDate;
private LocalTime uploadTime;
private LocalDateTime mifosProcessingDate;
private LocalTime mifosProcessingTime;
private String mifosFileName;
private String bankName;
private Long groupNumber;
private Long mifosProductCode;
private LocalDate paymentDate;
private String operationResult;
private BigDecimal scheduledPaymentAmount;
private Long paymentNumber;
private String lastPayment;
private String tolerance;
private Long errorId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class LoanTransactionData {
private Collection<CodeValueData> writeOffReasonOptions = null;

private Integer numberOfRepayments = 0;
private Integer installmentNumber;

// import fields
private transient Integer rowIndex;
Expand Down Expand Up @@ -192,13 +193,16 @@ public Integer getRowIndex() {

public static LoanTransactionData templateOnTop(final LoanTransactionData loanTransactionData,
final Collection<PaymentTypeData> paymentTypeOptions) {
return new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId, loanTransactionData.officeName,
loanTransactionData.type, loanTransactionData.paymentDetailData, loanTransactionData.currency, loanTransactionData.date,
loanTransactionData.amount, loanTransactionData.netDisbursalAmount, loanTransactionData.principalPortion,
loanTransactionData.interestPortion, loanTransactionData.feeChargesPortion, loanTransactionData.penaltyChargesPortion,
loanTransactionData.overpaymentPortion, loanTransactionData.unrecognizedIncomePortion, paymentTypeOptions,
loanTransactionData.externalId, loanTransactionData.transfer, loanTransactionData.fixedEmiAmount,
loanTransactionData.outstandingLoanBalance, loanTransactionData.manuallyReversed);
final LoanTransactionData loanTransactionTemplate = new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId,
loanTransactionData.officeName, loanTransactionData.type, loanTransactionData.paymentDetailData,
loanTransactionData.currency, loanTransactionData.date, loanTransactionData.amount, loanTransactionData.netDisbursalAmount,
loanTransactionData.principalPortion, loanTransactionData.interestPortion, loanTransactionData.feeChargesPortion,
loanTransactionData.penaltyChargesPortion, loanTransactionData.overpaymentPortion,
loanTransactionData.unrecognizedIncomePortion, paymentTypeOptions, loanTransactionData.externalId,
loanTransactionData.transfer, loanTransactionData.fixedEmiAmount, loanTransactionData.outstandingLoanBalance,
loanTransactionData.manuallyReversed);
loanTransactionTemplate.setInstallmentNumber(loanTransactionData.getInstallmentNumber());
return loanTransactionTemplate;

}

Expand Down Expand Up @@ -371,4 +375,20 @@ public Collection<LoanChargePaidByData> getLoanChargePaidByList() {
public void setLoanChargePaidByList(Collection<LoanChargePaidByData> loanChargePaidByList) {
this.loanChargePaidByList = loanChargePaidByList;
}

public Integer getInstallmentNumber() {
return installmentNumber;
}

public void setInstallmentNumber(Integer installmentNumber) {
this.installmentNumber = installmentNumber;
}

public Collection<PaymentTypeData> getPaymentTypeOptions() {
return paymentTypeOptions;
}

public BigDecimal getOutstandingLoanBalance() {
return outstandingLoanBalance;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
/**
* 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 java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Getter;

@Getter
@Entity
@Table(name = "PDA_Pagos")
public class LoanRepaymentImport {

/*
* Uploaded by ETL
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id_pagos")
private Long id;

/*
* Uploaded by ETL
*/
@Column(name = "Agencia_bancaria")
private String bankingAgency;

/*
* Uploaded by ETL
*/
@Column(name = "Codigo_cliente")
private Long customerCode;

/*
* Uploaded by ETL
*/
@Column(name = "Agencia")
private String agency;

/*
* Uploaded by ETL
*/
@Column(name = "Codigo_prestamo", nullable = false)
private String loanCode;

/*
* Uploaded by ETL
*/
@Column(name = "Codigo_producto")
private String productCode;

/*
* Uploaded by ETL
*/
@Column(name = "Monto")
private BigDecimal amount;

/*
* Uploaded by ETL
*/
@Column(name = "Boleta")
private String receiptNumber;

/*
* Uploaded by ETL & update by Mifos
*/
@Column(name = "Estado")
private Long status;

/*
* Uploaded by ETL
*/
@Column(name = "Fecha_carga")
private LocalDateTime uploadDate;

/*
* Uploaded by ETL
*/
@Column(name = "Hora_carga")
private LocalTime uploadTime;

/*
* Generated by Mifos
*/
@Column(name = "Feha_procesamiento_mifos")
private LocalDateTime mifosProcessingDate;

/*
* Generated by Mifos
*/
@Column(name = "Hora_procesamiento_mifos")
private LocalTime mifosProcessingTime;

/*
* Generated by Mifos
*/
@Column(name = "Nombre_archivo")
private String mifosFileName;

/*
* Uploaded by ETL
*/
@Column(name = "Banco")
private String bankName;

/*
* Uploaded by ETL
*/
@Column(name = "Grupo")
private Long groupNumber;

/*
* Uploaded by ETL
*/
@Column(name = "Codigo_producto_mifos")
private Long mifosProductCode;

/*
* Uploaded by ETL
*/
@Column(name = "Fecha_pago")
private LocalDate paymentDate;

/*
* Generated by Mifos
*/
@Column(name = "Resultado_operacion")
private String operationResult;

/*
* Generated by Mifos
*/
@Column(name = "Monto_pago_programado")
private BigDecimal scheduledPaymentAmount;

/*
* Generated by Mifos
*/
@Column(name = "Numero_de_pago")
private Long paymentNumber;

/*
* Generated by Mifos
*/
@Column(name = "Ultimo_pago")
private String lastPayment;

/*
* Generated by Mifos
*/
@Column(name = "Tolerancia")
private String tolerance;

/*
* Generated by Mifos
*/
@Column(name = "Id_error")
private Long errorId;

public void setStatus(Long status) {
this.status = status;
}

public void setMifosProcessingDate(LocalDateTime mifosProcessingDate) {
this.mifosProcessingDate = mifosProcessingDate;
}

public void setMifosProcessingTime(LocalTime mifosProcessingTime) {
this.mifosProcessingTime = mifosProcessingTime;
}

public void setMifosFileName(String mifosFileName) {
this.mifosFileName = mifosFileName;
}

public void setOperationResult(String operationResult) {
this.operationResult = operationResult;
}

public void setScheduledPaymentAmount(BigDecimal schedulePaymentAmount) {
this.scheduledPaymentAmount = schedulePaymentAmount;
}

public void setPaymentNumber(Long paymentNumber) {
this.paymentNumber = paymentNumber;
}

public void setLastPayment(String lastPayment) {
this.lastPayment = lastPayment;
}

public void setTolerance(String tolerance) {
this.tolerance = tolerance;
}

public void setErrorId(Long errorId) {
this.errorId = errorId;
}
}
Loading

0 comments on commit 89f5514

Please sign in to comment.