diff --git a/docs/energy_bill_fra_v1.md b/docs/energy_bill_fra_v1.md index 507d83dc7..c37335926 100644 --- a/docs/energy_bill_fra_v1.md +++ b/docs/energy_bill_fra_v1.md @@ -172,11 +172,19 @@ Details of energy consumption. A `EnergyBillV1EnergyUsage` implements the following attributes: +* **consumption** (`Double`): The price per unit of energy consumed. * **description** (`String`): Description or details of the energy usage. * **endDate** (`String`): The end date of the energy usage. * **startDate** (`String`): The start date of the energy usage. * **taxRate** (`Double`): The rate of tax applied to the total cost. * **total** (`Double`): The total cost of energy consumed. +* **unit** (`String`): The unit of measurement for energy consumption. + +#### Possible values include: + - kWh + - m3 + - L + * **unitPrice** (`Double`): The price per unit of energy consumed. Fields which are specific to this product; they are not used in any other product. @@ -194,7 +202,7 @@ A `EnergyBillV1MeterDetail` implements the following attributes: - water - None -* **unit** (`String`): The unit of measurement for energy consumption, which can be kW, m³, or L. +* **unit** (`String`): The unit of power for energy consumption. Fields which are specific to this product; they are not used in any other product. ### Subscription Field diff --git a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1Document.java b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1Document.java index 18c019713..160e6763a 100644 --- a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1Document.java +++ b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1Document.java @@ -13,7 +13,7 @@ import lombok.Getter; /** - * Energy Bill API version 1.0 document data. + * Energy Bill API version 1.2 document data. */ @Getter @EqualsAndHashCode(callSuper = false) @@ -164,14 +164,16 @@ public String toString() { ); String energyUsageSummary = ""; if (!this.getEnergyUsage().isEmpty()) { - int[] energyUsageColSizes = new int[]{38, 12, 12, 10, 11, 12}; + int[] energyUsageColSizes = new int[]{13, 38, 12, 12, 10, 11, 17, 12}; energyUsageSummary = String.format("%n%s%n ", SummaryHelper.lineSeparator(energyUsageColSizes, "-")) + + "| Consumption " + "| Description " + "| End Date " + "| Start Date " + "| Tax Rate " + "| Total " + + "| Unit of Measure " + "| Unit Price " + String.format("|%n%s%n ", SummaryHelper.lineSeparator(energyUsageColSizes, "=")); energyUsageSummary += SummaryHelper.arrayToString(this.getEnergyUsage(), energyUsageColSizes); diff --git a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1EnergyUsage.java b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1EnergyUsage.java index 5b85afc90..4bd929a56 100644 --- a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1EnergyUsage.java +++ b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1EnergyUsage.java @@ -16,6 +16,11 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField { + /** + * The price per unit of energy consumed. + */ + @JsonProperty("consumption") + Double consumption; /** * Description or details of the energy usage. */ @@ -41,6 +46,11 @@ public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField */ @JsonProperty("total") Double total; + /** + * The unit of measurement for energy consumption. + */ + @JsonProperty("unit") + String unit; /** * The price per unit of energy consumed. */ @@ -49,11 +59,13 @@ public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField public boolean isEmpty() { return ( - (description == null || description.isEmpty()) + consumption == null + && (description == null || description.isEmpty()) && (endDate == null || endDate.isEmpty()) && (startDate == null || startDate.isEmpty()) && taxRate == null && total == null + && (unit == null || unit.isEmpty()) && unitPrice == null ); } @@ -61,6 +73,10 @@ public boolean isEmpty() { private Map tablePrintableValues() { Map printable = new HashMap<>(); + printable.put( + "consumption", + SummaryHelper.formatAmount(this.consumption) + ); printable.put("description", SummaryHelper.formatForDisplay(this.description, 36)); printable.put("endDate", SummaryHelper.formatForDisplay(this.endDate, 10)); printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null)); @@ -72,6 +88,7 @@ private Map tablePrintableValues() { "total", SummaryHelper.formatAmount(this.total) ); + printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null)); printable.put( "unitPrice", SummaryHelper.formatAmount(this.unitPrice) @@ -84,28 +101,36 @@ private Map tablePrintableValues() { */ public String toTableLine() { Map printable = this.tablePrintableValues(); - return String.format("| %-36s ", printable.get("description")) + return String.format("| %-11s ", printable.get("consumption")) + + String.format("| %-36s ", printable.get("description")) + String.format("| %-10s ", printable.get("endDate")) + String.format("| %-10s ", printable.get("startDate")) + String.format("| %-8s ", printable.get("taxRate")) + String.format("| %-9s ", printable.get("total")) + + String.format("| %-15s ", printable.get("unit")) + String.format("| %-10s |", printable.get("unitPrice")); } @Override public String toString() { Map printable = this.printableValues(); - return String.format("Description: %s", printable.get("description")) + return String.format("Consumption: %s", printable.get("consumption")) + + String.format(", Description: %s", printable.get("description")) + String.format(", End Date: %s", printable.get("endDate")) + String.format(", Start Date: %s", printable.get("startDate")) + String.format(", Tax Rate: %s", printable.get("taxRate")) + String.format(", Total: %s", printable.get("total")) + + String.format(", Unit of Measure: %s", printable.get("unit")) + String.format(", Unit Price: %s", printable.get("unitPrice")); } private Map printableValues() { Map printable = new HashMap<>(); + printable.put( + "consumption", + SummaryHelper.formatAmount(this.consumption) + ); printable.put("description", SummaryHelper.formatForDisplay(this.description, null)); printable.put("endDate", SummaryHelper.formatForDisplay(this.endDate, null)); printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null)); @@ -117,6 +142,7 @@ private Map printableValues() { "total", SummaryHelper.formatAmount(this.total) ); + printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null)); printable.put( "unitPrice", SummaryHelper.formatAmount(this.unitPrice) diff --git a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1MeterDetail.java b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1MeterDetail.java index b07d30963..7e60cd5e9 100644 --- a/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1MeterDetail.java +++ b/src/main/java/com/mindee/product/fr/energybill/EnergyBillV1MeterDetail.java @@ -26,7 +26,7 @@ public class EnergyBillV1MeterDetail extends BaseField { @JsonProperty("meter_type") String meterType; /** - * The unit of measurement for energy consumption, which can be kW, m³, or L. + * The unit of power for energy consumption. */ @JsonProperty("unit") String unit; @@ -46,7 +46,7 @@ public String toFieldList() { Map printable = this.printableValues(); return String.format(" :Meter Number: %s%n", printable.get("meterNumber")) + String.format(" :Meter Type: %s%n", printable.get("meterType")) - + String.format(" :Unit of Measure: %s%n", printable.get("unit")); + + String.format(" :Unit of Power: %s%n", printable.get("unit")); } @Override @@ -54,7 +54,7 @@ public String toString() { Map printable = this.printableValues(); return String.format("Meter Number: %s", printable.get("meterNumber")) + String.format(", Meter Type: %s", printable.get("meterType")) - + String.format(", Unit of Measure: %s", printable.get("unit")); + + String.format(", Unit of Power: %s", printable.get("unit")); } private Map printableValues() { diff --git a/src/main/java/com/mindee/product/us/healthcarecard/HealthcareCardV1Document.java b/src/main/java/com/mindee/product/us/healthcarecard/HealthcareCardV1Document.java index 533cf0492..91636ad72 100644 --- a/src/main/java/com/mindee/product/us/healthcarecard/HealthcareCardV1Document.java +++ b/src/main/java/com/mindee/product/us/healthcarecard/HealthcareCardV1Document.java @@ -12,7 +12,7 @@ import lombok.Getter; /** - * Healthcare Card API version 1.0 document data. + * Healthcare Card API version 1.1 document data. */ @Getter @EqualsAndHashCode(callSuper = false) diff --git a/src/test/resources b/src/test/resources index 415f6bf4a..01336a096 160000 --- a/src/test/resources +++ b/src/test/resources @@ -1 +1 @@ -Subproject commit 415f6bf4a13f38af2776cbe2222fdfab92f41ee5 +Subproject commit 01336a096b6e31d30668afdb86b3f677d8ed93d0