Skip to content

✨ update invoice to 4.6, financial document to 1.6 #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# builds
target/
src-delomboked
src-lomboked

# test jshell file
_test.jsh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import lombok.Getter;

/**
* The definition for Financial Document, API version 1.
* Financial Document API version 1 inference prediction.
*/
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
import lombok.Getter;

/**
* Document data for Financial Document, API version 1.
* Financial Document API version 1.6 document data.
*/
@Getter
@EqualsAndHashCode(callSuper = false)
@JsonIgnoreProperties(ignoreUnknown = true)
public class FinancialDocumentV1Document extends Prediction {

/**
* The customer's address used for billing.
*/
@JsonProperty("billing_address")
private StringField billingAddress;
/**
* The purchase category among predefined classes.
*/
Expand All @@ -42,6 +47,11 @@ public class FinancialDocumentV1Document extends Prediction {
*/
@JsonProperty("customer_company_registrations")
private List<CompanyRegistrationField> customerCompanyRegistrations = new ArrayList<>();
/**
* The customer account number or identifier from the supplier.
*/
@JsonProperty("customer_id")
private StringField customerId;
/**
* The name of the customer.
*/
Expand Down Expand Up @@ -82,6 +92,11 @@ public class FinancialDocumentV1Document extends Prediction {
*/
@JsonProperty("reference_numbers")
private List<StringField> referenceNumbers = new ArrayList<>();
/**
* The customer's address used for shipping.
*/
@JsonProperty("shipping_address")
private StringField shippingAddress;
/**
* The purchase subcategory among predefined classes for transport and food.
*/
Expand All @@ -97,6 +112,11 @@ public class FinancialDocumentV1Document extends Prediction {
*/
@JsonProperty("supplier_company_registrations")
private List<CompanyRegistrationField> supplierCompanyRegistrations = new ArrayList<>();
/**
* The email of the supplier or merchant.
*/
@JsonProperty("supplier_email")
private StringField supplierEmail;
/**
* The name of the supplier or merchant.
*/
Expand All @@ -112,6 +132,11 @@ public class FinancialDocumentV1Document extends Prediction {
*/
@JsonProperty("supplier_phone_number")
private StringField supplierPhoneNumber;
/**
* The website URL of the supplier or merchant.
*/
@JsonProperty("supplier_website")
private StringField supplierWebsite;
/**
* List of tax lines information.
*/
Expand Down Expand Up @@ -161,8 +186,13 @@ public boolean isEmpty() {
&& this.supplierAddress == null
&& this.supplierPhoneNumber == null
&& this.customerName == null
&& this.supplierWebsite == null
&& this.supplierEmail == null
&& (this.customerCompanyRegistrations == null || this.customerCompanyRegistrations.isEmpty())
&& this.customerAddress == null
&& this.customerId == null
&& this.shippingAddress == null
&& this.billingAddress == null
&& this.documentType == null
&& this.subcategory == null
&& this.category == null
Expand Down Expand Up @@ -230,6 +260,12 @@ public String toString() {
outStr.append(
String.format(":Customer Name: %s%n", this.getCustomerName())
);
outStr.append(
String.format(":Supplier Website: %s%n", this.getSupplierWebsite())
);
outStr.append(
String.format(":Supplier Email: %s%n", this.getSupplierEmail())
);
String customerCompanyRegistrations = SummaryHelper.arrayToString(
this.getCustomerCompanyRegistrations(),
"%n "
Expand All @@ -240,6 +276,15 @@ public String toString() {
outStr.append(
String.format(":Customer Address: %s%n", this.getCustomerAddress())
);
outStr.append(
String.format(":Customer ID: %s%n", this.getCustomerId())
);
outStr.append(
String.format(":Shipping Address: %s%n", this.getShippingAddress())
);
outStr.append(
String.format(":Billing Address: %s%n", this.getBillingAddress())
);
outStr.append(
String.format(":Document Type: %s%n", this.getDocumentType())
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/product/invoice/InvoiceV4.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import lombok.Getter;

/**
* The definition for Invoice, API version 4.
* Invoice API version 4 inference prediction.
*/
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down
38 changes: 37 additions & 1 deletion src/main/java/com/mindee/product/invoice/InvoiceV4Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import lombok.Getter;

/**
* Document data for Invoice, API version 4.
* Invoice API version 4.6 document data.
*/
@Getter
@EqualsAndHashCode(callSuper = false)
Expand All @@ -42,6 +42,11 @@ public class InvoiceV4Document extends Prediction {
*/
@JsonProperty("customer_company_registrations")
private List<CompanyRegistrationField> customerCompanyRegistrations = new ArrayList<>();
/**
* The customer account number or identifier from the supplier.
*/
@JsonProperty("customer_id")
private StringField customerId;
/**
* The name of the customer or client.
*/
Expand Down Expand Up @@ -97,6 +102,11 @@ public class InvoiceV4Document extends Prediction {
*/
@JsonProperty("supplier_company_registrations")
private List<CompanyRegistrationField> supplierCompanyRegistrations = new ArrayList<>();
/**
* The email of the supplier or merchant.
*/
@JsonProperty("supplier_email")
private StringField supplierEmail;
/**
* The name of the supplier or merchant.
*/
Expand All @@ -107,6 +117,16 @@ public class InvoiceV4Document extends Prediction {
*/
@JsonProperty("supplier_payment_details")
private List<PaymentDetailsField> supplierPaymentDetails = new ArrayList<>();
/**
* The phone number of the supplier or merchant.
*/
@JsonProperty("supplier_phone_number")
private StringField supplierPhoneNumber;
/**
* The website URL of the supplier or merchant.
*/
@JsonProperty("supplier_website")
private StringField supplierWebsite;
/**
* List of tax line details.
*/
Expand Down Expand Up @@ -145,9 +165,13 @@ public boolean isEmpty() {
&& this.supplierName == null
&& (this.supplierCompanyRegistrations == null || this.supplierCompanyRegistrations.isEmpty())
&& this.supplierAddress == null
&& this.supplierPhoneNumber == null
&& this.supplierWebsite == null
&& this.supplierEmail == null
&& this.customerName == null
&& (this.customerCompanyRegistrations == null || this.customerCompanyRegistrations.isEmpty())
&& this.customerAddress == null
&& this.customerId == null
&& this.shippingAddress == null
&& this.billingAddress == null
&& this.documentType == null
Expand Down Expand Up @@ -209,6 +233,15 @@ public String toString() {
outStr.append(
String.format(":Supplier Address: %s%n", this.getSupplierAddress())
);
outStr.append(
String.format(":Supplier Phone Number: %s%n", this.getSupplierPhoneNumber())
);
outStr.append(
String.format(":Supplier Website: %s%n", this.getSupplierWebsite())
);
outStr.append(
String.format(":Supplier Email: %s%n", this.getSupplierEmail())
);
outStr.append(
String.format(":Customer Name: %s%n", this.getCustomerName())
);
Expand All @@ -222,6 +255,9 @@ public String toString() {
outStr.append(
String.format(":Customer Address: %s%n", this.getCustomerAddress())
);
outStr.append(
String.format(":Customer ID: %s%n", this.getCustomerId())
);
outStr.append(
String.format(":Shipping Address: %s%n", this.getShippingAddress())
);
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/mindee/product/invoice/InvoiceV4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ void whenEmptyDeserialized_mustHaveValidProperties() throws IOException {
Assertions.assertNull(docPrediction.getSupplierName().getValue());
Assertions.assertTrue(docPrediction.getSupplierCompanyRegistrations().isEmpty());
Assertions.assertNull(docPrediction.getSupplierAddress().getValue());
Assertions.assertNull(docPrediction.getSupplierPhoneNumber().getValue());
Assertions.assertNull(docPrediction.getSupplierWebsite().getValue());
Assertions.assertNull(docPrediction.getSupplierEmail().getValue());
Assertions.assertNull(docPrediction.getCustomerName().getValue());
Assertions.assertTrue(docPrediction.getCustomerCompanyRegistrations().isEmpty());
Assertions.assertNull(docPrediction.getCustomerAddress().getValue());
Assertions.assertNull(docPrediction.getCustomerId().getValue());
Assertions.assertNull(docPrediction.getShippingAddress().getValue());
Assertions.assertNull(docPrediction.getBillingAddress().getValue());
Assertions.assertInstanceOf(ClassificationField.class, docPrediction.getDocumentType());
Expand Down
Loading