Skip to content

Commit 4c5e62e

Browse files
✨ bump FR EnergyBillV1 to V1.2 & US HealthcareCardV1 to V1.1 (#225)
1 parent 0fbb7b2 commit 4c5e62e

File tree

6 files changed

+47
-11
lines changed

6 files changed

+47
-11
lines changed

docs/energy_bill_fra_v1.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,19 @@ Details of energy consumption.
172172

173173
A `EnergyBillV1EnergyUsage` implements the following attributes:
174174

175+
* **consumption** (`Double`): The price per unit of energy consumed.
175176
* **description** (`String`): Description or details of the energy usage.
176177
* **endDate** (`String`): The end date of the energy usage.
177178
* **startDate** (`String`): The start date of the energy usage.
178179
* **taxRate** (`Double`): The rate of tax applied to the total cost.
179180
* **total** (`Double`): The total cost of energy consumed.
181+
* **unit** (`String`): The unit of measurement for energy consumption.
182+
183+
#### Possible values include:
184+
- kWh
185+
- m3
186+
- L
187+
180188
* **unitPrice** (`Double`): The price per unit of energy consumed.
181189
Fields which are specific to this product; they are not used in any other product.
182190

@@ -194,7 +202,7 @@ A `EnergyBillV1MeterDetail` implements the following attributes:
194202
- water
195203
- None
196204

197-
* **unit** (`String`): The unit of measurement for energy consumption, which can be kW, m³, or L.
205+
* **unit** (`String`): The unit of power for energy consumption.
198206
Fields which are specific to this product; they are not used in any other product.
199207

200208
### Subscription Field

src/main/java/com/mindee/product/fr/energybill/EnergyBillV1Document.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import lombok.Getter;
1414

1515
/**
16-
* Energy Bill API version 1.0 document data.
16+
* Energy Bill API version 1.2 document data.
1717
*/
1818
@Getter
1919
@EqualsAndHashCode(callSuper = false)
@@ -164,14 +164,16 @@ public String toString() {
164164
);
165165
String energyUsageSummary = "";
166166
if (!this.getEnergyUsage().isEmpty()) {
167-
int[] energyUsageColSizes = new int[]{38, 12, 12, 10, 11, 12};
167+
int[] energyUsageColSizes = new int[]{13, 38, 12, 12, 10, 11, 17, 12};
168168
energyUsageSummary =
169169
String.format("%n%s%n ", SummaryHelper.lineSeparator(energyUsageColSizes, "-"))
170+
+ "| Consumption "
170171
+ "| Description "
171172
+ "| End Date "
172173
+ "| Start Date "
173174
+ "| Tax Rate "
174175
+ "| Total "
176+
+ "| Unit of Measure "
175177
+ "| Unit Price "
176178
+ String.format("|%n%s%n ", SummaryHelper.lineSeparator(energyUsageColSizes, "="));
177179
energyUsageSummary += SummaryHelper.arrayToString(this.getEnergyUsage(), energyUsageColSizes);

src/main/java/com/mindee/product/fr/energybill/EnergyBillV1EnergyUsage.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
@JsonIgnoreProperties(ignoreUnknown = true)
1717
public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField {
1818

19+
/**
20+
* The price per unit of energy consumed.
21+
*/
22+
@JsonProperty("consumption")
23+
Double consumption;
1924
/**
2025
* Description or details of the energy usage.
2126
*/
@@ -41,6 +46,11 @@ public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField
4146
*/
4247
@JsonProperty("total")
4348
Double total;
49+
/**
50+
* The unit of measurement for energy consumption.
51+
*/
52+
@JsonProperty("unit")
53+
String unit;
4454
/**
4555
* The price per unit of energy consumed.
4656
*/
@@ -49,18 +59,24 @@ public class EnergyBillV1EnergyUsage extends BaseField implements LineItemField
4959

5060
public boolean isEmpty() {
5161
return (
52-
(description == null || description.isEmpty())
62+
consumption == null
63+
&& (description == null || description.isEmpty())
5364
&& (endDate == null || endDate.isEmpty())
5465
&& (startDate == null || startDate.isEmpty())
5566
&& taxRate == null
5667
&& total == null
68+
&& (unit == null || unit.isEmpty())
5769
&& unitPrice == null
5870
);
5971
}
6072

6173
private Map<String, String> tablePrintableValues() {
6274
Map<String, String> printable = new HashMap<>();
6375

76+
printable.put(
77+
"consumption",
78+
SummaryHelper.formatAmount(this.consumption)
79+
);
6480
printable.put("description", SummaryHelper.formatForDisplay(this.description, 36));
6581
printable.put("endDate", SummaryHelper.formatForDisplay(this.endDate, 10));
6682
printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null));
@@ -72,6 +88,7 @@ private Map<String, String> tablePrintableValues() {
7288
"total",
7389
SummaryHelper.formatAmount(this.total)
7490
);
91+
printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null));
7592
printable.put(
7693
"unitPrice",
7794
SummaryHelper.formatAmount(this.unitPrice)
@@ -84,28 +101,36 @@ private Map<String, String> tablePrintableValues() {
84101
*/
85102
public String toTableLine() {
86103
Map<String, String> printable = this.tablePrintableValues();
87-
return String.format("| %-36s ", printable.get("description"))
104+
return String.format("| %-11s ", printable.get("consumption"))
105+
+ String.format("| %-36s ", printable.get("description"))
88106
+ String.format("| %-10s ", printable.get("endDate"))
89107
+ String.format("| %-10s ", printable.get("startDate"))
90108
+ String.format("| %-8s ", printable.get("taxRate"))
91109
+ String.format("| %-9s ", printable.get("total"))
110+
+ String.format("| %-15s ", printable.get("unit"))
92111
+ String.format("| %-10s |", printable.get("unitPrice"));
93112
}
94113

95114
@Override
96115
public String toString() {
97116
Map<String, String> printable = this.printableValues();
98-
return String.format("Description: %s", printable.get("description"))
117+
return String.format("Consumption: %s", printable.get("consumption"))
118+
+ String.format(", Description: %s", printable.get("description"))
99119
+ String.format(", End Date: %s", printable.get("endDate"))
100120
+ String.format(", Start Date: %s", printable.get("startDate"))
101121
+ String.format(", Tax Rate: %s", printable.get("taxRate"))
102122
+ String.format(", Total: %s", printable.get("total"))
123+
+ String.format(", Unit of Measure: %s", printable.get("unit"))
103124
+ String.format(", Unit Price: %s", printable.get("unitPrice"));
104125
}
105126

106127
private Map<String, String> printableValues() {
107128
Map<String, String> printable = new HashMap<>();
108129

130+
printable.put(
131+
"consumption",
132+
SummaryHelper.formatAmount(this.consumption)
133+
);
109134
printable.put("description", SummaryHelper.formatForDisplay(this.description, null));
110135
printable.put("endDate", SummaryHelper.formatForDisplay(this.endDate, null));
111136
printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null));
@@ -117,6 +142,7 @@ private Map<String, String> printableValues() {
117142
"total",
118143
SummaryHelper.formatAmount(this.total)
119144
);
145+
printable.put("unit", SummaryHelper.formatForDisplay(this.unit, null));
120146
printable.put(
121147
"unitPrice",
122148
SummaryHelper.formatAmount(this.unitPrice)

src/main/java/com/mindee/product/fr/energybill/EnergyBillV1MeterDetail.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class EnergyBillV1MeterDetail extends BaseField {
2626
@JsonProperty("meter_type")
2727
String meterType;
2828
/**
29-
* The unit of measurement for energy consumption, which can be kW, m³, or L.
29+
* The unit of power for energy consumption.
3030
*/
3131
@JsonProperty("unit")
3232
String unit;
@@ -46,15 +46,15 @@ public String toFieldList() {
4646
Map<String, String> printable = this.printableValues();
4747
return String.format(" :Meter Number: %s%n", printable.get("meterNumber"))
4848
+ String.format(" :Meter Type: %s%n", printable.get("meterType"))
49-
+ String.format(" :Unit of Measure: %s%n", printable.get("unit"));
49+
+ String.format(" :Unit of Power: %s%n", printable.get("unit"));
5050
}
5151

5252
@Override
5353
public String toString() {
5454
Map<String, String> printable = this.printableValues();
5555
return String.format("Meter Number: %s", printable.get("meterNumber"))
5656
+ String.format(", Meter Type: %s", printable.get("meterType"))
57-
+ String.format(", Unit of Measure: %s", printable.get("unit"));
57+
+ String.format(", Unit of Power: %s", printable.get("unit"));
5858
}
5959

6060
private Map<String, String> printableValues() {

src/main/java/com/mindee/product/us/healthcarecard/HealthcareCardV1Document.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import lombok.Getter;
1313

1414
/**
15-
* Healthcare Card API version 1.0 document data.
15+
* Healthcare Card API version 1.1 document data.
1616
*/
1717
@Getter
1818
@EqualsAndHashCode(callSuper = false)

0 commit comments

Comments
 (0)