Skip to content

Commit

Permalink
Merge pull request #1388 from fiterlatam/rebase_su_changes
Browse files Browse the repository at this point in the history
Rebase su changes
  • Loading branch information
Napho authored Dec 12, 2024
2 parents 73157dc + c7323a8 commit 911e7d7
Show file tree
Hide file tree
Showing 167 changed files with 8,594 additions and 790 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ configure(project.fineractJavaProjects) {
errorprone "com.google.errorprone:error_prone_core:2.24.1"
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.errorprone {
enabled = project.gradle.startParameter.taskNames.contains('build') || project.gradle.startParameter.taskNames.contains('check')
disableWarningsInGeneratedCode = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ class EmailService {

this.properties = new Properties()
this.properties.put("mail.smtp.host", config.host)
this.properties.put("mail.smtp.auth", "true")
this.properties.put("mail.smtp.auth", "false")
this.properties.put("mail.smtp.starttls.enable", config.tls.toString())
if(config.ssl) {
this.properties.put("mail.smtp.port", "465")
this.properties.put("mail.smtp.socketFactory.port", "465");
this.properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

} else {
} else if (config.tls) {
this.properties.put("mail.smtp.port", "587")
} else {
this.properties.put("mail.smtp.port", "25")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,29 @@ public CommandWrapperBuilder assignDelinquency(final Long loanId) {
return this;
}

public CommandWrapperBuilder createClasificacionConcepto() {
this.actionName = "CREATE";
this.entityName = "CLASIFICACION_CONCEPTO";
this.href = "/clasificacionconceptos";
return this;
}

public CommandWrapperBuilder updateClasificacionConcepto(final Long id) {
this.actionName = "UPDATE";
this.entityName = "CLASIFICACION_CONCEPTO";
this.href = "/clasificacionconceptos";
this.entityId = id;
return this;
}

public CommandWrapperBuilder deleteClasificacionConcepto(final Long id) {
this.actionName = "DELETE";
this.entityName = "CLASIFICACION_CONCEPTO";
this.href = "/clasificacionconceptos";
this.entityId = id;
return this;
}

public CommandWrapperBuilder createCodeValue(final Long codeId) {
this.actionName = "CREATE";
this.entityName = "CODEVALUE";
Expand Down Expand Up @@ -4083,4 +4106,28 @@ public CommandWrapperBuilder excludeFromReclaim(final Long loanId) {
this.href = "reclaim/exclude/" + loanId;
return this;
}

public CommandWrapperBuilder createCollectionHouse() {
this.actionName = "CREATE";
this.entityName = "PRODUCTCOLLECTIONHOUSE";
this.entityId = null;
this.href = "/collectionhousemanagement";
return this;
}

public CommandWrapperBuilder updateCollectionHouse(final Long parameterId) {
this.actionName = "UPDATE";
this.entityName = "PRODUCTCOLLECTIONHOUSE";
this.entityId = parameterId;
this.href = "/collectionhousemanagement/" + parameterId;
return this;
}

public CommandWrapperBuilder createCollectionHouseHistory() {
this.actionName = "CREATE";
this.entityName = "COLLECTIONHOUSEHISTORY";
this.entityId = null;
this.href = "/collectionhousehistory";
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,39 @@
*/
package org.apache.fineract.infrastructure.codes.domain;

import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CodeValueRepository extends JpaRepository<CodeValue, Long>, JpaSpecificationExecutor<CodeValue> {

CodeValue findByCodeNameAndId(String codeName, Long id);

CodeValue findByCodeNameAndLabel(String codeName, String label);

@Query(value = """
SELECT
mv2.code_score AS ciudad_code_score,
mv2.code_value AS ciudad_code_value,
mcv.code_score AS departamento_code_score,
mcv.code_id AS departamento_code_id,
mcv.code_value AS departamento_code_value
FROM m_code_value mcv
INNER JOIN (
SELECT *,
CASE
WHEN LEFT(LPAD(code_score::TEXT, 5, '0'), 2)::INTEGER < 10 THEN
LEFT(LPAD(code_score::TEXT, 5, '0'), 2)::INTEGER::VARCHAR
ELSE
LEFT(LPAD(code_score::TEXT, 5, '0'), 2)
END AS ciudadCoderScore
FROM m_code_value mcv2
WHERE code_id = (select * from m_code mc where mc.code_name ='Ciudad')
) mv2
ON mv2.ciudadCoderScore = mcv.code_score
WHERE mcv.code_id = (select * from m_code mc where mc.code_name ='Departamento') AND mv2.code_score = :codeScore
""", nativeQuery = true)
Optional<CodeValue> findCiudadAndDepartamentoData(@Param("codeScore") String codeScore);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.configuration.domain;

import java.time.LocalDate;
import java.util.List;
import org.apache.fineract.infrastructure.cache.domain.CacheType;

public interface ConfigurationDomainService {
Expand All @@ -37,6 +38,8 @@ public interface ConfigurationDomainService {

boolean allowTransactionsOnNonWorkingDayEnabled();

boolean enableMonthlyInvoiceGenerationOnJobTrigger();

boolean isConstraintApproachEnabledForDatatables();

boolean isEhcacheEnabled();
Expand Down Expand Up @@ -149,4 +152,14 @@ public interface ConfigurationDomainService {

Long retriveMinimumDaysOfArrearsToWriteOff();

Long retriveMinimumDaysInArrearsToSuspendLoanAccount();

Long retrieveInvoiceResolutionExpiryDays();

Long retrieveInvoiceThreshold();

List<String> retrieveInvoiceJobNotificationEmails();

Integer retriveIvaConfiguration();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.ToString;
Expand Down Expand Up @@ -58,6 +59,7 @@ public class CommandProcessingResult implements Serializable {
private Long usuarioId;
private String rolId;
private BigDecimal eaRate;
private final List<Map<String, Object>> collectionHouseUpdates;

private CommandProcessingResult(final Long commandId, final Long officeId, final Long groupId, final Long clientId, final Long loanId,
final Long savingsId, final String resourceIdentifier, final Long resourceId, final String transactionId,
Expand All @@ -82,6 +84,33 @@ private CommandProcessingResult(final Long commandId, final Long officeId, final
this.subResourceId = subResourceId;
this.resourceExternalId = resourceExternalId;
this.subResourceExternalId = subResourceExternalId;
this.collectionHouseUpdates = null;
}

public CommandProcessingResult(final Long commandId, final Long officeId, final Long groupId, final Long clientId, final Long loanId,
final Long savingsId, final String resourceIdentifier, final Long resourceId, final String transactionId,
final Map<String, Object> changes, final Long productId, final Long gsimId, final Long glimId,
final Map<String, Object> creditBureauReportData, Boolean rollbackTransaction, final Long subResourceId,
final ExternalId resourceExternalId, final ExternalId subResourceExternalId, List<Map<String, Object>> collectionHouseUpdates) {
this.commandId = commandId;
this.officeId = officeId;
this.groupId = groupId;
this.clientId = clientId;
this.loanId = loanId;
this.savingsId = savingsId;
this.resourceIdentifier = resourceIdentifier;
this.resourceId = resourceId;
this.changes = changes;
this.transactionId = transactionId;
this.productId = productId;
this.gsimId = gsimId;
this.glimId = glimId;
this.creditBureauReportData = creditBureauReportData;
this.rollbackTransaction = rollbackTransaction;
this.subResourceId = subResourceId;
this.resourceExternalId = resourceExternalId;
this.subResourceExternalId = subResourceExternalId;
this.collectionHouseUpdates = collectionHouseUpdates;
}

protected CommandProcessingResult(final Long resourceId, final Long officeId, final Long commandId, final Map<String, Object> changes,
Expand Down Expand Up @@ -120,6 +149,17 @@ public static CommandProcessingResult fromDetails(final Long commandId, final Lo
resourceExternalId, subResourceExternalId);
}

public static CommandProcessingResult fromDetails(final Long commandId, final Long officeId, final Long groupId, final Long clientId,
final Long loanId, final Long savingsId, final String resourceIdentifier, final Long entityId, final Long gsimId,
final Long glimId, final Map<String, Object> creditBureauReportData, final String transactionId,
final Map<String, Object> changes, final Long productId, final Boolean rollbackTransaction, final Long subResourceId,
final ExternalId resourceExternalId, final ExternalId subResourceExternalId,
final List<Map<String, Object>> collectionHouseUpdates) {
return new CommandProcessingResult(commandId, officeId, groupId, clientId, loanId, savingsId, resourceIdentifier, entityId,
transactionId, changes, productId, gsimId, glimId, creditBureauReportData, rollbackTransaction, subResourceId,
resourceExternalId, subResourceExternalId, collectionHouseUpdates);
}

public static CommandProcessingResult commandOnlyResult(final Long commandId) {
return new CommandProcessingResult(null, null, commandId, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.core.data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.apache.fineract.infrastructure.core.domain.ExternalId;

Expand All @@ -41,6 +42,7 @@ public class CommandProcessingResultBuilder {
private String transactionId;
private Map<String, Object> changes;
private Map<String, Object> creditBureauReportData;
private List<Map<String, Object>> collectionHouseUpdates;
private Long productId;
private boolean rollbackTransaction = false;
private ExternalId entityExternalId = ExternalId.empty();
Expand All @@ -60,7 +62,7 @@ public CommandProcessingResult build() {
CommandProcessingResult commandProcessingResult = CommandProcessingResult.fromDetails(this.commandId, this.officeId, this.groupId,
this.clientId, this.loanId, this.savingsId, this.resourceIdentifier, this.entityId, this.gsimId, this.glimId,
this.creditBureauReportData, this.transactionId, this.changes, this.productId, this.rollbackTransaction, this.subEntityId,
this.entityExternalId, this.subEntityExternalId);
this.entityExternalId, this.subEntityExternalId, this.collectionHouseUpdates);
commandProcessingResult.setRegistroAnterior(this.registroAnterior);
commandProcessingResult.setRegistroPosterior(this.registroPosterior);
commandProcessingResult.setUsuarioNombre(this.usuarioNombre);
Expand Down Expand Up @@ -147,6 +149,11 @@ public CommandProcessingResultBuilder withCreditReport(final Map<String, Object>
return this;
}

public CommandProcessingResultBuilder withCollectionHouse(final List<Map<String, Object>> withCollectionHouse) {
this.collectionHouseUpdates = withCollectionHouse;
return this;
}

public CommandProcessingResultBuilder setRollbackTransaction(final boolean rollbackTransaction) {
this.rollbackTransaction |= rollbackTransaction;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ public static boolean isOnOrAfter(LocalDate first, LocalDate second) {
return first != null && (second == null || first.isAfter(second) || first.isEqual(second));
}

public static boolean isOnOrBefore(LocalDate first, LocalDate second) {
return second != null && (first == null || first.isBefore(second) || first.isEqual(second));
}

public static long getDifferenceInDays(final LocalDate localDateBefore, final LocalDate localDateAfter) {
return DAYS.between(localDateBefore, localDateAfter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,20 @@ public enum JobName {
REACTIVATE_BLOCKED_APP_USERS("Reactivate Blocked App Users"), //
BLOCK_INACTIVE_CLIENTS("Block Inactive Clients"), //
LOAN_CUSTOM_CHARGE_HONORARIO_UPDATE("Loans - Custom Charge Honorario Update"), //
LIQUIDACION_DE_RECAUDOS("Liquidacion de Recaudos"), RECALCULATE_LOAN_INTEREST_AFTER_MAXIMUM_LEGAL_RATE_CHANGE(
"Recalculate Loan Interest After Maximum Legal Rate Change"), LIQUIDACION_DE_COMPRAS("Liquidacion de Compras"), COMPENSATION(
"Compensation"), COMPENSATION_ALERT_EMAIL("Compensation Alert Email"), DAILY_LOAN_ACCRUAL("Devengo de Interés diario"), //
INSURANCE_CHARGE_CANCELLATION_DUE_TO_DEFAULT("Cancel Default Insurance Charges"), INSTALLMENT_LOAN_CHARGE_ACCRUAL(
"Devengo de seguro"), ARCHIVE_LOAN_HISTORY("Archivo de cartera"), //
INSURANCE_CHARGE_SUSPENSION_DUE_TO_DEFAULT("Suspension temporal por mora") // ;
;
LIQUIDACION_DE_RECAUDOS("Liquidacion de Recaudos"), //
RECALCULATE_LOAN_INTEREST_AFTER_MAXIMUM_LEGAL_RATE_CHANGE("Recalculate Loan Interest After Maximum Legal Rate Change"), //
LIQUIDACION_DE_COMPRAS("Liquidacion de Compras"), //
COMPENSATION("Compensation"), //
COMPENSATION_ALERT_EMAIL("Compensation Alert Email"), //
DAILY_LOAN_ACCRUAL("Devengo de Interés diario"), //
INSURANCE_CHARGE_CANCELLATION_DUE_TO_DEFAULT("Cancel Default Insurance Charges"), //
INSTALLMENT_LOAN_CHARGE_ACCRUAL("Devengo de seguro"), //
ARCHIVE_LOAN_HISTORY("Archivo de cartera"), //
INSURANCE_CHARGE_SUSPENSION_DUE_TO_DEFAULT("Suspension temporal por mora"), //
FACTURA_ELECTRONICA_MENSUAL("Factura Electronica Mensual"), //
INVOICE_NUMBERING_LIMIT("Control de Límite de Numeración de Facturación Electrónica"), //
INVOICE_EXPIRY_RESOLUTION("Control de Vencimiento de Resolución de Facturación Electrónica"), //
COLLECTION_HOUSE_HISTORY("Casas de Cobro para Clientes");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ public MonetaryCurrency getCurrency() {
return monetaryCurrency();
}

public void setCurrency(final MonetaryCurrency currency) {
this.currencyCode = currency.getCode();
this.currencyDigitsAfterDecimal = currency.getDigitsAfterDecimal();
this.inMultiplesOf = currency.getCurrencyInMultiplesOf();
}

private MonetaryCurrency monetaryCurrency() {
return new MonetaryCurrency(this.currencyCode, this.currencyDigitsAfterDecimal, this.inMultiplesOf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ public boolean isAvalCharge() {
return ChargeCalculationType.fromInt(this.chargeCalculation).isPercentageOfAval();
}

public boolean isAvalChargeFlatForMigration() {
// Charge is distributed among the installments
return ChargeCalculationType.fromInt(this.chargeCalculation).isFlatAvalForMigration();
}

public boolean isMandatoryInsurance() {
// Charge is distributed among the installments
return ChargeCalculationType.fromInt(this.chargeCalculation).isMandatoryInsuranceCharge();
Expand Down Expand Up @@ -1048,6 +1053,9 @@ public void validateChargeIsSetupCorrectly() {
} else if (this.isFlatHono()) {
verifyChargeConfiguration(code, ChargeCalculationTypeBaseItemsEnum.FLAT.getIndex(),
ChargeCalculationTypeBaseItemsEnum.HOORARIOS.getIndex(), null, null, null);
} else if (this.isAvalChargeFlatForMigration()) {
verifyChargeConfiguration(code, ChargeCalculationTypeBaseItemsEnum.AVAL.getIndex(),
ChargeCalculationTypeBaseItemsEnum.FLAT.getIndex(), null, null, null);
} else {
throw new GeneralPlatformDomainRuleException("error.msg.charge.not.setup.correctly", "Charge not setup correctly",
this.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,11 @@ public boolean isPercentageOfAval() {
&& isPercentageOfDisbursement();
}

public boolean isFlatAvalForMigration() {
return this.byteRepresentation.charAt(ChargeCalculationTypeBaseItemsEnum.AVAL.getIndex()) == '1' && this.equals(FLAT_AVAL)
&& isFlat();
}

public boolean isPercentageOfHonorarios() {
return this.byteRepresentation.charAt(ChargeCalculationTypeBaseItemsEnum.HOORARIOS.getIndex()) == '1'
&& this.byteRepresentation.charAt(ChargeCalculationTypeBaseItemsEnum.FLAT.getIndex()) == '1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
import org.springframework.integration.annotation.Default;

@Getter
@Setter
Expand All @@ -46,13 +47,31 @@ public class DelinquencyRange extends AbstractAuditableWithUTCDateTimeCustom {
@Column(name = "max_age_days", nullable = true)
private Integer maximumAgeDays;

@Column(name = "percentage_value", nullable = true)
private Integer percentageValue;

@Version
private Long version;

@Default
protected DelinquencyRange(@NotNull String classification, @NotNull Integer minimumAgeDays, Integer maximumAgeDays,
Integer percentageValue) {
this.classification = classification;
this.minimumAgeDays = minimumAgeDays;
this.maximumAgeDays = maximumAgeDays;
this.percentageValue = percentageValue;
}

protected DelinquencyRange(@NotNull String classification, @NotNull Integer minimumAgeDays, Integer maximumAgeDays) {
this.classification = classification;
this.minimumAgeDays = minimumAgeDays;
this.maximumAgeDays = maximumAgeDays;
this.percentageValue = null;
}

public static DelinquencyRange instance(@NotNull String classification, @NotNull Integer minimumAge, Integer maximumAge,
Integer percentageValue) {
return new DelinquencyRange(classification, minimumAge, maximumAge, percentageValue);
}

public static DelinquencyRange instance(@NotNull String classification, @NotNull Integer minimumAge, Integer maximumAge) {
Expand Down
Loading

0 comments on commit 911e7d7

Please sign in to comment.