Skip to content

Commit

Permalink
Merge pull request #220 from fiterlatam/fix/FBR-329
Browse files Browse the repository at this point in the history
Add client Name to Print cheques for cheques paid to guarantees
  • Loading branch information
BrianMuhimbura authored Oct 16, 2023
2 parents 195a32f + eae60a3 commit df2c622
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class BankChequeApiConstants {
public static String OLD_CHEQUE_ID = "oldChequeId";
public static String CHEQUE_ID = "chequeId";
public static String GUARANTEE_CASE_ID = "caseId";
public static String GUARANTEE_NAME = "guaranteeName";
public static String GUARANTEE_ID = "guaranteeId";
public static String GUARANTEE_AMOUNT = "guaranteeAmount";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class PayGuaranteeByChequeCommand {

private Long chequeId;
private Long guaranteeId;
private String guaranteeName;
private BigDecimal guaranteeAmount;
private String caseId;
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public class Cheque extends AbstractAuditableCustom {
@Column(name = "guarantee_id")
private Long guaranteeId;

@Column(name = "guarantee_name")
private String guaranteeName;

public Cheque setChequeNo(Long chequeNo) {
this.chequeNo = chequeNo;
return this;
Expand Down Expand Up @@ -195,4 +198,8 @@ public void setRequiredGuaranteeAmount(BigDecimal requiredGuaranteeAmount) {
public void setDepositGuaranteeNo(String depositGuaranteeNo) {
this.depositGuaranteeNo = depositGuaranteeNo;
}

public void setGuaranteeName(String guaranteeName) {
this.guaranteeName = guaranteeName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public List<PayGuaranteeByChequeCommand> commandFromApiJson(String json) {
element, locale);
baseDataValidator.reset().parameter(BankChequeApiConstants.GUARANTEE_AMOUNT).value(guaranteeAmount).longGreaterThanZero()
.notNull();
final String guaranteeName = this.fromApiJsonHelper.extractStringNamed(BankChequeApiConstants.GUARANTEE_NAME, element);

final PayGuaranteeByChequeCommand payGuaranteeByChequeCommand = PayGuaranteeByChequeCommand.builder().chequeId(chequeId)
.caseId(caseId).guaranteeId(guaranteeId).guaranteeAmount(guaranteeAmount).build();
.caseId(caseId).guaranteeId(guaranteeId).guaranteeAmount(guaranteeAmount).guaranteeName(guaranteeName).build();
payGuaranteeByChequeCommands.add(payGuaranteeByChequeCommand);
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.configuration.data.ExternalServicesPropertiesData;
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants;
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesPropertiesReadPlatformService;
Expand Down Expand Up @@ -148,6 +149,7 @@ private static final class ChequeMapper implements RowMapper<ChequeData> {
mbc.guarantee_id AS guaranteeId,
mc.account_no AS clientNo,
mc.display_name AS clientName,
mbc.guarantee_name AS guaranteeName,
mg.display_name AS groupName,
mg.account_no AS groupNo,
ml.account_no AS loanAccNo,
Expand Down Expand Up @@ -212,7 +214,11 @@ public ChequeData mapRow(final ResultSet rs, final int rowNum) throws SQLExcepti
final String printedByUsername = rs.getString("printedByUsername");
final String voidAuthorizedByUsername = rs.getString("voidAuthorizedByUsername");
final String lastModifiedByUsername = rs.getString("lastModifiedByUsername");
final String clientName = rs.getString("clientName");
String clientName = rs.getString("clientName");
final String guaranteeName = rs.getString("guaranteeName");
if (StringUtils.isBlank(clientName)) {
clientName = guaranteeName;
}
final String clientNo = rs.getString("clientNo");
final String groupName = rs.getString("groupName");
final String loanAccNo = rs.getString("loanAccNo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ public CommandProcessingResult payGuaranteeByCheque(JsonCommand command) {
cheque.setStatus(BankChequeStatus.PENDING_ISSUANCE.getValue());
cheque.setCaseId(payGuaranteeByChequeCommand.getCaseId());
cheque.setGuaranteeId(payGuaranteeByChequeCommand.getGuaranteeId());
cheque.setGuaranteeName(payGuaranteeByChequeCommand.getGuaranteeName());
cheque.setDescription(payGuaranteeByChequeCommand.getDescription());
cheque.setGuaranteeAmount(payGuaranteeByChequeCommand.getGuaranteeAmount());
final LocalDateTime localDateTime = DateUtils.getLocalDateTimeOfSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,15 @@
</addColumn>
</changeSet>

<changeSet author="fineract" id="48">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_bank_check" columnName="guarantee_name"/>
</not>
</preConditions>
<addColumn tableName="m_bank_check">
<column name="guarantee_name" type="VARCHAR(200)"></column>
</addColumn>
</changeSet>

</databaseChangeLog>

0 comments on commit df2c622

Please sign in to comment.