Skip to content

Commit

Permalink
[SU-536]Electronic Invoice - changes
Browse files Browse the repository at this point in the history
  • Loading branch information
oluexpert99 committed Dec 26, 2024
1 parent 47bc164 commit ef73b18
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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");
Expand All @@ -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, "")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum LoanDocumentConcept {

Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ private List<LoanDocumentData> groupByClientIdAndProductType(final List<LoanDocu
.clientCedula(loanDocumentData.getClientCedula()).clientAddress(loanDocumentData.getClientAddress())
.clientCityCode(loanDocumentData.getClientCityCode())
.clientCityName(loanDocumentData.getClientCityName())
.clientFirstName(loanDocumentData.getClientFirstName())
.clientMiddleName(loanDocumentData.getClientMiddleName())
.clientTelephone(loanDocumentData.getClientTelephone()).build();
})))
.values().stream().toList();
Expand Down Expand Up @@ -584,9 +586,9 @@ public LoanDocumentData mapRow(@NotNull ResultSet rs, int rowNum) throws SQLExce
.totalPaid(JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "totalPaid"))
.mandatoryInsuranceCode(rs.getString("mandatoryInsuranceCode"))
.voluntaryInsuranceCode(rs.getString("voluntaryInsuranceCode"))
.voluntaryInsuranceName(rs.getString("voluntaryInsuranceName"))
.clientFirstName(rs.getString("clientFirstName")).clientMiddleName(rs.getString("clientMiddleName"))
.mandatoryInsuranceName(rs.getString("mandatoryInsuranceName")).build();
.voluntaryInsuranceName(rs.getString("voluntaryInsuranceName")).clientFirstName(rs.getString("clientFirstName"))
.clientMiddleName(rs.getString("clientMiddleName")).mandatoryInsuranceName(rs.getString("mandatoryInsuranceName"))
.build();
}
}

Expand Down

0 comments on commit ef73b18

Please sign in to comment.