Skip to content
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
10 changes: 9 additions & 1 deletion docs/energy_bill_fra_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -49,18 +59,24 @@ 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
);
}

private Map<String, String> tablePrintableValues() {
Map<String, String> 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));
Expand All @@ -72,6 +88,7 @@ private Map<String, String> tablePrintableValues() {
"total",
SummaryHelper.formatAmount(this.total)
);
printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null));
printable.put(
"unitPrice",
SummaryHelper.formatAmount(this.unitPrice)
Expand All @@ -84,28 +101,36 @@ private Map<String, String> tablePrintableValues() {
*/
public String toTableLine() {
Map<String, String> 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<String, String> 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<String, String> printableValues() {
Map<String, String> 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));
Expand All @@ -117,6 +142,7 @@ private Map<String, String> printableValues() {
"total",
SummaryHelper.formatAmount(this.total)
);
printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null));
printable.put(
"unitPrice",
SummaryHelper.formatAmount(this.unitPrice)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,15 +46,15 @@ public String toFieldList() {
Map<String, String> 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
public String toString() {
Map<String, String> 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<String, String> printableValues() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading