diff --git a/docs/delivery_notes_v1.md b/docs/delivery_notes_v1.md index 388449498..27a5f6291 100644 --- a/docs/delivery_notes_v1.md +++ b/docs/delivery_notes_v1.md @@ -97,58 +97,67 @@ A typical `BaseField` object will have the following attributes: Aside from the previous attributes, all basic fields have access to a custom `toString` method that can be used to print their value as a string. +### AmountField +An amount field `AmountField` extends `BaseField`, but also implements: +* **value** (`Double`): corresponds to the field value. Can be `null` if no value was extracted. + ### StringField The text field `StringField` extends `BaseField`, but also implements: * **value** (`String`): corresponds to the field value. * **rawValue** (`String`): corresponds to the raw value as it appears on the document. +### DateField +The date field `DateField` extends `BaseField`, but also implements: + +* **value** (`LocalDate`): an accessible representation of the value as a Java object. Can be `null`. + # Attributes The following fields are extracted for Delivery note V1: ## Customer Address -**customerAddress**: The Customer Address field is used to store the address of the customer receiving the goods. +**customerAddress**: The address of the customer receiving the goods. ```java System.out.println(result.getDocument().getInference().getPrediction().getCustomerAddress().value); ``` ## Customer Name -**customerName**: The Customer Name field is used to store the name of the customer who is receiving the goods. +**customerName**: The name of the customer receiving the goods. ```java System.out.println(result.getDocument().getInference().getPrediction().getCustomerName().value); ``` ## Delivery Date -**deliveryDate**: Delivery Date is the date when the goods are expected to be delivered to the customer. +**deliveryDate**: The date on which the delivery is scheduled to arrive. ```java System.out.println(result.getDocument().getInference().getPrediction().getDeliveryDate().value); ``` ## Delivery Number -**deliveryNumber**: Delivery Number is a unique identifier for a Global Delivery Note document. +**deliveryNumber**: A unique identifier for the delivery note. ```java System.out.println(result.getDocument().getInference().getPrediction().getDeliveryNumber().value); ``` ## Supplier Address -**supplierAddress**: The Supplier Address field is used to store the address of the supplier from whom the goods were purchased. +**supplierAddress**: The address of the supplier providing the goods. ```java System.out.println(result.getDocument().getInference().getPrediction().getSupplierAddress().value); ``` ## Supplier Name -**supplierName**: Supplier Name field is used to capture the name of the supplier from whom the goods are being received. +**supplierName**: The name of the supplier providing the goods. ```java System.out.println(result.getDocument().getInference().getPrediction().getSupplierName().value); ``` ## Total Amount -**totalAmount**: Total Amount field is the sum of all line items on the Global Delivery Note. +**totalAmount**: The total monetary value of the goods being delivered. ```java System.out.println(result.getDocument().getInference().getPrediction().getTotalAmount().value); diff --git a/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java index 13bc549ec..742c39370 100644 --- a/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java +++ b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java @@ -4,12 +4,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.mindee.parsing.SummaryHelper; import com.mindee.parsing.common.Prediction; +import com.mindee.parsing.standard.AmountField; +import com.mindee.parsing.standard.DateField; import com.mindee.parsing.standard.StringField; import lombok.EqualsAndHashCode; import lombok.Getter; /** - * Delivery note API version 1.0 document data. + * Delivery note API version 1.1 document data. */ @Getter @EqualsAndHashCode(callSuper = false) @@ -17,40 +19,40 @@ public class DeliveryNoteV1Document extends Prediction { /** - * The Customer Address field is used to store the address of the customer receiving the goods. + * The address of the customer receiving the goods. */ @JsonProperty("customer_address") protected StringField customerAddress; /** - * The Customer Name field is used to store the name of the customer who is receiving the goods. + * The name of the customer receiving the goods. */ @JsonProperty("customer_name") protected StringField customerName; /** - * Delivery Date is the date when the goods are expected to be delivered to the customer. + * The date on which the delivery is scheduled to arrive. */ @JsonProperty("delivery_date") - protected StringField deliveryDate; + protected DateField deliveryDate; /** - * Delivery Number is a unique identifier for a Global Delivery Note document. + * A unique identifier for the delivery note. */ @JsonProperty("delivery_number") protected StringField deliveryNumber; /** - * The Supplier Address field is used to store the address of the supplier from whom the goods were purchased. + * The address of the supplier providing the goods. */ @JsonProperty("supplier_address") protected StringField supplierAddress; /** - * Supplier Name field is used to capture the name of the supplier from whom the goods are being received. + * The name of the supplier providing the goods. */ @JsonProperty("supplier_name") protected StringField supplierName; /** - * Total Amount field is the sum of all line items on the Global Delivery Note. + * The total monetary value of the goods being delivered. */ @JsonProperty("total_amount") - protected StringField totalAmount; + protected AmountField totalAmount; @Override public boolean isEmpty() { diff --git a/src/test/resources b/src/test/resources index 025c3df9d..96f731263 160000 --- a/src/test/resources +++ b/src/test/resources @@ -1 +1 @@ -Subproject commit 025c3df9db4f1ba23e3b7fc86e9539f37ec9ba5e +Subproject commit 96f73126330ffffe6911d03b8c7fc13b8d301dfe