FINERACT-2326: Tax component and group issue serialization
This commit is contained in:
committed by
Adam Saghy
parent
6b7df527de
commit
c55cfe9d08
+3
-25
@@ -24,11 +24,13 @@ import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public final class TaxComponentData implements Serializable {
|
||||
|
||||
@@ -84,23 +86,6 @@ public final class TaxComponentData implements Serializable {
|
||||
taxComponentHistories, glAccountOptions, glAccountTypeOptions);
|
||||
}
|
||||
|
||||
private TaxComponentData(final Long id, final String name, final BigDecimal percentage, final EnumOptionData debitAccountType,
|
||||
final GLAccountData debitAcount, final EnumOptionData creditAccountType, final GLAccountData creditAcount,
|
||||
final LocalDate startDate, final Collection<TaxComponentHistoryData> taxComponentHistories,
|
||||
final Map<String, List<GLAccountData>> glAccountOptions, final Collection<EnumOptionData> glAccountTypeOptions) {
|
||||
this.id = id;
|
||||
this.percentage = percentage;
|
||||
this.name = name;
|
||||
this.debitAccountType = debitAccountType;
|
||||
this.debitAccount = debitAcount;
|
||||
this.creditAccountType = creditAccountType;
|
||||
this.creditAccount = creditAcount;
|
||||
this.startDate = startDate;
|
||||
this.taxComponentHistories = taxComponentHistories;
|
||||
this.glAccountOptions = glAccountOptions;
|
||||
this.glAccountTypeOptions = glAccountTypeOptions;
|
||||
}
|
||||
|
||||
private TaxComponentData(final Long id, final BigDecimal percentage, final GLAccountData debitAcount,
|
||||
final GLAccountData creditAcount) {
|
||||
this.id = id;
|
||||
@@ -137,14 +122,7 @@ public final class TaxComponentData implements Serializable {
|
||||
}
|
||||
|
||||
private boolean occursOnDayFrom(final LocalDate target) {
|
||||
return DateUtils.isAfter(target, startDate());
|
||||
return DateUtils.isAfter(target, getStartDate());
|
||||
}
|
||||
|
||||
public LocalDate startDate() {
|
||||
LocalDate startDate = null;
|
||||
if (this.startDate != null) {
|
||||
startDate = this.startDate;
|
||||
}
|
||||
return startDate;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-20
@@ -21,8 +21,10 @@ package org.apache.fineract.portfolio.tax.data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@Getter
|
||||
public class TaxComponentHistoryData implements Serializable {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -39,26 +41,7 @@ public class TaxComponentHistoryData implements Serializable {
|
||||
}
|
||||
|
||||
public boolean occursOnDayFromAndUpToAndIncluding(final LocalDate target) {
|
||||
return DateUtils.isAfter(target, startDate()) && (endDate == null || !DateUtils.isAfter(target, endDate()));
|
||||
return DateUtils.isAfter(target, getStartDate()) && (endDate == null || !DateUtils.isAfter(target, getEndDate()));
|
||||
}
|
||||
|
||||
public LocalDate startDate() {
|
||||
LocalDate startDate = null;
|
||||
if (this.startDate != null) {
|
||||
startDate = this.startDate;
|
||||
}
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public LocalDate endDate() {
|
||||
LocalDate endDate = null;
|
||||
if (this.endDate != null) {
|
||||
endDate = this.endDate;
|
||||
}
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public BigDecimal getPercentage() {
|
||||
return this.percentage;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-17
@@ -20,7 +20,11 @@ package org.apache.fineract.portfolio.tax.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public final class TaxGroupData implements Serializable {
|
||||
|
||||
private final Long id;
|
||||
@@ -31,11 +35,6 @@ public final class TaxGroupData implements Serializable {
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<TaxComponentData> taxComponents;
|
||||
|
||||
public static TaxGroupData instance(final Long id, final String name, final Collection<TaxGroupMappingsData> taxAssociations) {
|
||||
final Collection<TaxComponentData> taxComponents = null;
|
||||
return new TaxGroupData(id, name, taxAssociations, taxComponents);
|
||||
}
|
||||
|
||||
public static TaxGroupData lookup(final Long id, final String name) {
|
||||
final Collection<TaxComponentData> taxComponents = null;
|
||||
final Collection<TaxGroupMappingsData> taxAssociations = null;
|
||||
@@ -53,16 +52,4 @@ public final class TaxGroupData implements Serializable {
|
||||
return new TaxGroupData(taxGroupData.id, taxGroupData.name, taxGroupData.taxAssociations, taxComponents);
|
||||
}
|
||||
|
||||
private TaxGroupData(final Long id, final String name, final Collection<TaxGroupMappingsData> taxAssociations,
|
||||
final Collection<TaxComponentData> taxComponents) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.taxAssociations = taxAssociations;
|
||||
this.taxComponents = taxComponents;
|
||||
}
|
||||
|
||||
public Collection<TaxGroupMappingsData> getTaxAssociations() {
|
||||
return this.taxAssociations;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-11
@@ -20,8 +20,14 @@ package org.apache.fineract.portfolio.tax.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class TaxGroupMappingsData implements Serializable {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -33,17 +39,6 @@ public class TaxGroupMappingsData implements Serializable {
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate endDate;
|
||||
|
||||
public TaxGroupMappingsData(final Long id, final TaxComponentData taxComponent, final LocalDate startDate, final LocalDate endDate) {
|
||||
this.id = id;
|
||||
this.taxComponent = taxComponent;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public TaxComponentData getTaxComponent() {
|
||||
return this.taxComponent;
|
||||
}
|
||||
|
||||
public boolean occursOnDayFromAndUpToAndIncluding(final LocalDate target) {
|
||||
return DateUtils.isAfter(target, startDate()) && (endDate == null || !DateUtils.isAfter(target, endDate()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TaxGroupData.instance(id, name, taxAssociations);
|
||||
return new TaxGroupData(id, name, taxAssociations, null);
|
||||
}
|
||||
|
||||
public String getSchema() {
|
||||
|
||||
Reference in New Issue
Block a user