Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SU-198] Facturación electrónica: Parametrizaciones #1309

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ public class LoanProductParameterizationData {
private Long lastCreditNoteNumber;

private Long lastDebitNoteNumber;

private String technicalKey;

private String note;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,5 @@
<include file="parts/20243008011009140_SU_441_update_report.xml" relativeToChangelogFile="true"/>
<include file="parts/20242708011009113_SU-199_invoice_job.xml" relativeToChangelogFile="true"/>
<include file="parts/20243008011009141_SU_441_update_report.xml" relativeToChangelogFile="true"/>
<include file="parts/20240529122200_SU_198_loan-product-parameters-1.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="fineract" id="1">
<addColumn tableName="m_product_type_parameters">
<column name="clave_tecnica" type="varchar(100)" remarks="Clave técnica de la resolución"/>
<column name="nota" type="text" remarks="Nota completa de la resolución"/>
</addColumn>
</changeSet>


</databaseChangeLog>
Loading