From ef73b180bdc0ac2e4705a022884aaf55f29ec37c Mon Sep 17 00:00:00 2001 From: Farooq Date: Thu, 26 Dec 2024 17:18:32 +0100 Subject: [PATCH] [SU-536]Electronic Invoice - changes --- .../invoice/data/LoanDocumentData.java | 17 ++++++++++++----- .../invoice/domain/LoanDocumentConcept.java | 7 ++++++- .../FacturaElectronicaMensualTasklet.java | 8 +++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/data/LoanDocumentData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/data/LoanDocumentData.java index f5ca51d844..cd7997c646 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/data/LoanDocumentData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/data/LoanDocumentData.java @@ -21,12 +21,12 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.Objects; - import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.portfolio.client.domain.LegalForm; import org.apache.fineract.portfolio.loanaccount.invoice.domain.FacturaElectronicaMensual; @@ -153,7 +153,8 @@ public FacturaElectronicaMensual toEntity() { } // INFORMATION AT COMPANY LEVEL - final String taxInformation = "RESPONSABLE DEL IVA. No Somos Grandes Contribuyentes. Autorretenedores Renta según Resol. No. 04314 may 16 de 20028. Auterretenedores especiales según Decreto No. 2201 dic 30 de 2016. Autorretenedores de ICA según Resol. No. 202150186360 del 22 de dic de 2021 Medellín."; + final String taxInformation = StringUtils.stripAccents( + "RESPONSABLE DEL IVA. No Somos Grandes Contribuyentes. Autorretenedores Renta según Resol. No. 04314 may 16 de 20028. Auterretenedores especiales según Decreto No. 2201 dic 30 de 2016. Autorretenedores de ICA según Resol. No. 202150186360 del 22 de dic de 2021 Medellín."); facturaElectronicaMensual.setInf_tributaria(taxInformation); facturaElectronicaMensual.setCantidad(BigDecimal.ONE); if (LegalForm.fromInt(this.clientLegalForm).isEntity()) { @@ -197,7 +198,8 @@ public FacturaElectronicaMensual toEntity() { // SU+ Constant Fields facturaElectronicaMensual.setNit_emisor("800139398-6"); - facturaElectronicaMensual.setNom_emisor("Intercrédito de Colombia S.A.S"); + String companyName = StringUtils.stripAccents("Intercrédito de Colombia S.A.S"); + facturaElectronicaMensual.setNom_emisor(companyName); // Static values for specified fields facturaElectronicaMensual.setCod_pais_tienda("CO"); @@ -224,7 +226,12 @@ public enum LoanDocumentType { private final String code; } - private String getFirstNameAndMiddleName(){ - return String.format("%s %s", Objects.toString(this.clientFirstName,""), Objects.toString(this.clientMiddleName,"")); + + private String getFirstNameAndMiddleName() { + if (StringUtils.isAllBlank(this.clientFirstName, this.clientMiddleName)) { + return StringUtils.stripAccents(this.clientDisplayName); + } + return StringUtils.stripAccents( + String.format("%s %s", Objects.toString(this.clientFirstName, ""), Objects.toString(this.clientMiddleName, ""))); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/domain/LoanDocumentConcept.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/domain/LoanDocumentConcept.java index 39094eed5c..452d9c4ed5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/domain/LoanDocumentConcept.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/invoice/domain/LoanDocumentConcept.java @@ -2,8 +2,8 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import org.apache.commons.lang3.StringUtils; -@Getter @AllArgsConstructor public enum LoanDocumentConcept { @@ -13,6 +13,11 @@ public enum LoanDocumentConcept { HONORARIOS("HON", "HONORARIOS"), // SEGUROS_VOLUNTARIOS("SEGV", "SEGURO VOLUNTARIO"); + @Getter private final String sku; private final String name; + + public String getName() { + return StringUtils.stripAccents(this.name); + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/facturaelectronicamensual/FacturaElectronicaMensualTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/facturaelectronicamensual/FacturaElectronicaMensualTasklet.java index 354101a05c..bd1d7075a4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/facturaelectronicamensual/FacturaElectronicaMensualTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/facturaelectronicamensual/FacturaElectronicaMensualTasklet.java @@ -135,6 +135,8 @@ private List groupByClientIdAndProductType(final List