From 89c4cda389d24a7e445f855cba6d65fd2e7c8916 Mon Sep 17 00:00:00 2001 From: Farooq Date: Thu, 21 Nov 2024 21:19:26 +0100 Subject: [PATCH] =?UTF-8?q?[SU-198]=20Facturaci=C3=B3n=20electr=C3=B3nica:?= =?UTF-8?q?=20Parametrizaciones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/LoanProductParameterizationData.java | 4 +++ .../domain/LoanProductParameterization.java | 19 +++++++++-- ...oductParameterizationWriteServiceImpl.java | 2 +- .../db/changelog/tenant/changelog-tenant.xml | 1 + ...22200_SU_198_loan-product-parameters-1.xml | 33 +++++++++++++++++++ 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 fineract-provider/src/main/resources/db/changelog/tenant/parts/20240529122200_SU_198_loan-product-parameters-1.xml diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/data/LoanProductParameterizationData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/data/LoanProductParameterizationData.java index 2af93e960d..8f7681b5f7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/data/LoanProductParameterizationData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/data/LoanProductParameterizationData.java @@ -51,4 +51,8 @@ public class LoanProductParameterizationData { private Long lastCreditNoteNumber; private Long lastDebitNoteNumber; + + private String technicalKey; + + private String note; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/domain/LoanProductParameterization.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/domain/LoanProductParameterization.java index 2ebac31b86..8d8166881f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/domain/LoanProductParameterization.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/domain/LoanProductParameterization.java @@ -71,9 +71,16 @@ public class LoanProductParameterization extends AbstractAuditableWithUTCDateTim @Column(name = "last_debit_note_number") private Long lastDebitNoteNumber; + @Column(name = "clave_tecnica") + private String technicalKey; + + @Column(name = "nota") + private String note; + public LoanProductParameterizationData toData() { return new LoanProductParameterizationData(getId(), productType, billingPrefix, billingResolutionNumber, generationDate, - expirationDate, rangeStartNumber, rangeEndNumber, lastInvoiceNumber, lastCreditNoteNumber, lastDebitNoteNumber); + expirationDate, rangeStartNumber, rangeEndNumber, lastInvoiceNumber, lastCreditNoteNumber, lastDebitNoteNumber, + technicalKey, note); } public static LoanProductParameterization create(JsonCommand command) { @@ -113,6 +120,12 @@ public void update(JsonCommand command) { if (updatedParameters.getLastDebitNoteNumber() != null) { this.lastDebitNoteNumber = updatedParameters.getLastDebitNoteNumber(); } + if (StringUtils.isNotBlank(updatedParameters.getTechnicalKey())) { + this.technicalKey = updatedParameters.getTechnicalKey(); + } + if (StringUtils.isNotBlank(updatedParameters.getNote())) { + this.note = updatedParameters.getNote(); + } } private static LoanProductParameterization extractParameters(JsonCommand command) { @@ -126,6 +139,8 @@ private static LoanProductParameterization extractParameters(JsonCommand command final Long lastInvoiceNumber = command.longValueOfParameterNamed("lastInvoiceNumber"); final Long lastCreditNoteNumber = command.longValueOfParameterNamed("lastCreditNoteNumber"); final Long lastDebitNoteNumber = command.longValueOfParameterNamed("lastDebitNoteNumber"); + final String note = command.stringValueOfParameterNamed("note"); + final String technicalKey = command.stringValueOfParameterNamed("technicalKey"); // validate that rangeStartNumber is less than rangeEndNumber if (rangeStartNumber > rangeEndNumber) { @@ -141,7 +156,7 @@ private static LoanProductParameterization extractParameters(JsonCommand command } return new LoanProductParameterization(productType, billingPrefix, billingResolutionNumber, generationDate, expirationDate, - rangeStartNumber, rangeEndNumber, lastInvoiceNumber, lastCreditNoteNumber, lastDebitNoteNumber); + rangeStartNumber, rangeEndNumber, lastInvoiceNumber, lastCreditNoteNumber, lastDebitNoteNumber, technicalKey, note); } public boolean isInvoiceResolutionExpiring(Long daysPrior) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/service/LoanProductParameterizationWriteServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/service/LoanProductParameterizationWriteServiceImpl.java index adc5436fcd..07d17e1022 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/service/LoanProductParameterizationWriteServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproductparameterization/service/LoanProductParameterizationWriteServiceImpl.java @@ -45,8 +45,8 @@ public class LoanProductParameterizationWriteServiceImpl implements LoanProductP @Override public CommandProcessingResult createProductParameterization(JsonCommand command) { - LoanProductParameterization productParameterization = LoanProductParameterization.create(command); loanProductParameterDataValidator.validateForCreate(command.json()); + LoanProductParameterization productParameterization = LoanProductParameterization.create(command); LoanProductParameterization savedProductParameterization = productParameterizationRepository.save(productParameterization); return CommandProcessingResult.commandOnlyResult(savedProductParameterization.getId()); diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index 29a91d0233..cb0aba62e7 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -320,4 +320,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/20240529122200_SU_198_loan-product-parameters-1.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/20240529122200_SU_198_loan-product-parameters-1.xml new file mode 100644 index 0000000000..21abd5f2d5 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/20240529122200_SU_198_loan-product-parameters-1.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + +