Skip to content

Commit 363d64b

Browse files
✨ update financial document to 1.7 & receipt to 5.2 (#167)
1 parent 6e39122 commit 363d64b

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

src/main/java/com/mindee/product/financialdocument/FinancialDocumentV1Document.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import lombok.Getter;
2121

2222
/**
23-
* Financial Document API version 1.6 document data.
23+
* Financial Document API version 1.7 document data.
2424
*/
2525
@Getter
2626
@EqualsAndHashCode(callSuper = false)
@@ -62,6 +62,11 @@ public class FinancialDocumentV1Document extends Prediction {
6262
*/
6363
@JsonProperty("date")
6464
private DateField date;
65+
/**
66+
* The document number or identifier.
67+
*/
68+
@JsonProperty("document_number")
69+
private StringField documentNumber;
6570
/**
6671
* One of: 'INVOICE', 'CREDIT NOTE', 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'.
6772
*/
@@ -73,7 +78,7 @@ public class FinancialDocumentV1Document extends Prediction {
7378
@JsonProperty("due_date")
7479
private DateField dueDate;
7580
/**
76-
* The invoice number or identifier.
81+
* The invoice number or identifier only if document is an invoice.
7782
*/
7883
@JsonProperty("invoice_number")
7984
private StringField invoiceNumber;
@@ -87,6 +92,11 @@ public class FinancialDocumentV1Document extends Prediction {
8792
*/
8893
@JsonProperty("locale")
8994
private LocaleField locale;
95+
/**
96+
* The receipt number or identifier only if document is a receipt.
97+
*/
98+
@JsonProperty("receipt_number")
99+
private StringField receiptNumber;
90100
/**
91101
* List of Reference numbers, including PO number.
92102
*/
@@ -174,6 +184,8 @@ public boolean isEmpty() {
174184
return (
175185
this.locale == null
176186
&& this.invoiceNumber == null
187+
&& this.receiptNumber == null
188+
&& this.documentNumber == null
177189
&& (this.referenceNumbers == null || this.referenceNumbers.isEmpty())
178190
&& this.date == null
179191
&& this.dueDate == null
@@ -212,6 +224,12 @@ public String toString() {
212224
outStr.append(
213225
String.format(":Invoice Number: %s%n", this.getInvoiceNumber())
214226
);
227+
outStr.append(
228+
String.format(":Receipt Number: %s%n", this.getReceiptNumber())
229+
);
230+
outStr.append(
231+
String.format(":Document Number: %s%n", this.getDocumentNumber())
232+
);
215233
String referenceNumbers = SummaryHelper.arrayToString(
216234
this.getReferenceNumbers(),
217235
"%n "

src/main/java/com/mindee/product/receipt/ReceiptV5.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import lombok.Getter;
77

88
/**
9-
* The definition for Receipt, API version 5.
9+
* Receipt API version 5 inference prediction.
1010
*/
1111
@Getter
1212
@JsonIgnoreProperties(ignoreUnknown = true)

src/main/java/com/mindee/product/receipt/ReceiptV5Document.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import lombok.Getter;
2020

2121
/**
22-
* Document data for Receipt, API version 5.
22+
* Receipt API version 5.2 document data.
2323
*/
2424
@Getter
2525
@EqualsAndHashCode(callSuper = false)
@@ -51,6 +51,11 @@ public class ReceiptV5Document extends Prediction {
5151
*/
5252
@JsonProperty("locale")
5353
private LocaleField locale;
54+
/**
55+
* The receipt number or identifier.
56+
*/
57+
@JsonProperty("receipt_number")
58+
private StringField receiptNumber;
5459
/**
5560
* The purchase subcategory among predefined classes for transport and food.
5661
*/
@@ -126,6 +131,7 @@ public boolean isEmpty() {
126131
&& (this.supplierCompanyRegistrations == null || this.supplierCompanyRegistrations.isEmpty())
127132
&& this.supplierAddress == null
128133
&& this.supplierPhoneNumber == null
134+
&& this.receiptNumber == null
129135
&& (this.lineItems == null || this.lineItems.isEmpty())
130136
);
131137
}
@@ -182,6 +188,9 @@ public String toString() {
182188
outStr.append(
183189
String.format(":Supplier Phone Number: %s%n", this.getSupplierPhoneNumber())
184190
);
191+
outStr.append(
192+
String.format(":Receipt Number: %s%n", this.getReceiptNumber())
193+
);
185194
String lineItemsSummary = "";
186195
if (!this.getLineItems().isEmpty()) {
187196
int[] lineItemsColSizes = new int[]{38, 10, 14, 12};

src/test/java/com/mindee/product/receipt/ReceiptV5Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void whenEmptyDeserialized_mustHaveValidProperties() throws IOException {
4949
Assertions.assertTrue(docPrediction.getSupplierCompanyRegistrations().isEmpty());
5050
Assertions.assertNull(docPrediction.getSupplierAddress().getValue());
5151
Assertions.assertNull(docPrediction.getSupplierPhoneNumber().getValue());
52+
Assertions.assertNull(docPrediction.getReceiptNumber().getValue());
5253
Assertions.assertTrue(docPrediction.getLineItems().isEmpty());
5354
}
5455

0 commit comments

Comments
 (0)