From a4083bf8b1e552825231aac55b1d9b50019f0ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Thu, 5 Mar 2026 12:40:39 +0100 Subject: [PATCH] :coffin: remove unused PayslipV2 product --- docs/code_samples/payslip_fra_v2_async.txt | 41 ------ .../mindee/product/fr/payslip/PayslipV2.java | 15 -- .../payslip/PayslipV2BankAccountDetail.java | 66 --------- .../product/fr/payslip/PayslipV2Document.java | 104 -------------- .../product/fr/payslip/PayslipV2Employee.java | 104 -------------- .../product/fr/payslip/PayslipV2Employer.java | 102 -------------- .../fr/payslip/PayslipV2Employment.java | 94 ------------- .../fr/payslip/PayslipV2PayDetail.java | 131 ------------------ .../fr/payslip/PayslipV2PayPeriod.java | 84 ----------- .../product/fr/payslip/PayslipV2Pto.java | 64 --------- .../fr/payslip/PayslipV2SalaryDetail.java | 86 ------------ .../product/fr/payslip/PayslipV2Test.java | 92 ------------ 12 files changed, 983 deletions(-) delete mode 100644 docs/code_samples/payslip_fra_v2_async.txt delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2BankAccountDetail.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2Document.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2Employee.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2Employer.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2Employment.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2PayDetail.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2PayPeriod.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2Pto.java delete mode 100644 src/main/java/com/mindee/product/fr/payslip/PayslipV2SalaryDetail.java delete mode 100644 src/test/java/com/mindee/product/fr/payslip/PayslipV2Test.java diff --git a/docs/code_samples/payslip_fra_v2_async.txt b/docs/code_samples/payslip_fra_v2_async.txt deleted file mode 100644 index 28788aa25..000000000 --- a/docs/code_samples/payslip_fra_v2_async.txt +++ /dev/null @@ -1,41 +0,0 @@ -import com.mindee.MindeeClient; -import com.mindee.input.LocalInputSource; -import com.mindee.parsing.common.AsyncPredictResponse; -import com.mindee.product.fr.payslip.PayslipV2; -import java.io.File; -import java.io.IOException; - -public class SimpleMindeeClientV1 { - - public static void main(String[] args) throws IOException, InterruptedException { - String apiKey = "my-api-key"; - String filePath = "/path/to/the/file.ext"; - - // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); - - // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); - - // Parse the file asynchronously - AsyncPredictResponse response = mindeeClient.enqueueAndParse( - PayslipV2.class, - inputSource - ); - - // Print a summary of the response - System.out.println(response.toString()); - - // Print a summary of the predictions -// System.out.println(response.getDocumentObj().toString()); - - // Print the document-level predictions -// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); - - // Print the page-level predictions -// response.getDocumentObj().getInference().getPages().forEach( -// page -> System.out.println(page.toString()) -// ); - } - -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2.java deleted file mode 100644 index 19a9145aa..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.mindee.http.EndpointInfo; -import com.mindee.parsing.common.Inference; -import lombok.Getter; - -/** - * Payslip API version 2 inference prediction. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -@EndpointInfo(endpointName = "payslip_fra", version = "2") -public class PayslipV2 extends Inference { -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2BankAccountDetail.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2BankAccountDetail.java deleted file mode 100644 index 7469c16df..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2BankAccountDetail.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about the employee's bank account. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2BankAccountDetail extends BaseField { - - /** - * The name of the bank. - */ - @JsonProperty("bank_name") - String bankName; - /** - * The IBAN of the bank account. - */ - @JsonProperty("iban") - String iban; - /** - * The SWIFT code of the bank. - */ - @JsonProperty("swift") - String swift; - - public boolean isEmpty() { - return ((bankName == null || bankName.isEmpty()) - && (iban == null || iban.isEmpty()) - && (swift == null || swift.isEmpty())); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Bank Name: %s%n", printable.get("bankName")) - + String.format(" :IBAN: %s%n", printable.get("iban")) - + String.format(" :SWIFT: %s%n", printable.get("swift")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Bank Name: %s", printable.get("bankName")) - + String.format(", IBAN: %s", printable.get("iban")) - + String.format(", SWIFT: %s", printable.get("swift")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("bankName", SummaryHelper.formatForDisplay(this.bankName, null)); - printable.put("iban", SummaryHelper.formatForDisplay(this.iban, null)); - printable.put("swift", SummaryHelper.formatForDisplay(this.swift, null)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Document.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2Document.java deleted file mode 100644 index debfd219a..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Document.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.common.Prediction; -import java.util.ArrayList; -import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -/** - * Payslip API version 2.0 document data. - */ -@Getter -@EqualsAndHashCode(callSuper = false) -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2Document extends Prediction { - - /** - * Information about the employee's bank account. - */ - @JsonProperty("bank_account_details") - protected PayslipV2BankAccountDetail bankAccountDetails; - /** - * Information about the employee. - */ - @JsonProperty("employee") - protected PayslipV2Employee employee; - /** - * Information about the employer. - */ - @JsonProperty("employer") - protected PayslipV2Employer employer; - /** - * Information about the employment. - */ - @JsonProperty("employment") - protected PayslipV2Employment employment; - /** - * Detailed information about the pay. - */ - @JsonProperty("pay_detail") - protected PayslipV2PayDetail payDetail; - /** - * Information about the pay period. - */ - @JsonProperty("pay_period") - protected PayslipV2PayPeriod payPeriod; - /** - * Information about paid time off. - */ - @JsonProperty("pto") - protected PayslipV2Pto pto; - /** - * Detailed information about the earnings. - */ - @JsonProperty("salary_details") - protected List salaryDetails = new ArrayList<>(); - - @Override - public boolean isEmpty() { - return (this.employee == null - && this.employer == null - && this.bankAccountDetails == null - && this.employment == null - && (this.salaryDetails == null || this.salaryDetails.isEmpty()) - && this.payDetail == null - && this.pto == null - && this.payPeriod == null); - } - - @Override - public String toString() { - StringBuilder outStr = new StringBuilder(); - outStr.append(String.format(":Employee:%n%s", this.getEmployee().toFieldList())); - outStr.append(String.format(":Employer:%n%s", this.getEmployer().toFieldList())); - outStr - .append( - String.format(":Bank Account Details:%n%s", this.getBankAccountDetails().toFieldList()) - ); - outStr.append(String.format(":Employment:%n%s", this.getEmployment().toFieldList())); - String salaryDetailsSummary = ""; - if (!this.getSalaryDetails().isEmpty()) { - int[] salaryDetailsColSizes = new int[] { 14, 11, 38, 11 }; - salaryDetailsSummary = String - .format("%n%s%n ", SummaryHelper.lineSeparator(salaryDetailsColSizes, "-")) - + "| Amount " - + "| Base " - + "| Description " - + "| Rate " - + String.format("|%n%s%n ", SummaryHelper.lineSeparator(salaryDetailsColSizes, "=")); - salaryDetailsSummary += SummaryHelper - .arrayToString(this.getSalaryDetails(), salaryDetailsColSizes); - salaryDetailsSummary += String - .format("%n%s", SummaryHelper.lineSeparator(salaryDetailsColSizes, "-")); - } - outStr.append(String.format(":Salary Details: %s%n", salaryDetailsSummary)); - outStr.append(String.format(":Pay Detail:%n%s", this.getPayDetail().toFieldList())); - outStr.append(String.format(":PTO:%n%s", this.getPto().toFieldList())); - outStr.append(String.format(":Pay Period:%n%s", this.getPayPeriod().toFieldList())); - return SummaryHelper.cleanSummary(outStr.toString()); - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employee.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employee.java deleted file mode 100644 index 4743ef638..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employee.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about the employee. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2Employee extends BaseField { - - /** - * The address of the employee. - */ - @JsonProperty("address") - String address; - /** - * The date of birth of the employee. - */ - @JsonProperty("date_of_birth") - String dateOfBirth; - /** - * The first name of the employee. - */ - @JsonProperty("first_name") - String firstName; - /** - * The last name of the employee. - */ - @JsonProperty("last_name") - String lastName; - /** - * The phone number of the employee. - */ - @JsonProperty("phone_number") - String phoneNumber; - /** - * The registration number of the employee. - */ - @JsonProperty("registration_number") - String registrationNumber; - /** - * The social security number of the employee. - */ - @JsonProperty("social_security_number") - String socialSecurityNumber; - - public boolean isEmpty() { - return ((address == null || address.isEmpty()) - && (dateOfBirth == null || dateOfBirth.isEmpty()) - && (firstName == null || firstName.isEmpty()) - && (lastName == null || lastName.isEmpty()) - && (phoneNumber == null || phoneNumber.isEmpty()) - && (registrationNumber == null || registrationNumber.isEmpty()) - && (socialSecurityNumber == null || socialSecurityNumber.isEmpty())); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Address: %s%n", printable.get("address")) - + String.format(" :Date of Birth: %s%n", printable.get("dateOfBirth")) - + String.format(" :First Name: %s%n", printable.get("firstName")) - + String.format(" :Last Name: %s%n", printable.get("lastName")) - + String.format(" :Phone Number: %s%n", printable.get("phoneNumber")) - + String.format(" :Registration Number: %s%n", printable.get("registrationNumber")) - + String.format(" :Social Security Number: %s%n", printable.get("socialSecurityNumber")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Address: %s", printable.get("address")) - + String.format(", Date of Birth: %s", printable.get("dateOfBirth")) - + String.format(", First Name: %s", printable.get("firstName")) - + String.format(", Last Name: %s", printable.get("lastName")) - + String.format(", Phone Number: %s", printable.get("phoneNumber")) - + String.format(", Registration Number: %s", printable.get("registrationNumber")) - + String.format(", Social Security Number: %s", printable.get("socialSecurityNumber")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("address", SummaryHelper.formatForDisplay(this.address, null)); - printable.put("dateOfBirth", SummaryHelper.formatForDisplay(this.dateOfBirth, null)); - printable.put("firstName", SummaryHelper.formatForDisplay(this.firstName, null)); - printable.put("lastName", SummaryHelper.formatForDisplay(this.lastName, null)); - printable.put("phoneNumber", SummaryHelper.formatForDisplay(this.phoneNumber, null)); - printable - .put("registrationNumber", SummaryHelper.formatForDisplay(this.registrationNumber, null)); - printable - .put("socialSecurityNumber", SummaryHelper.formatForDisplay(this.socialSecurityNumber, null)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employer.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employer.java deleted file mode 100644 index 2ddbbb317..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employer.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about the employer. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2Employer extends BaseField { - - /** - * The address of the employer. - */ - @JsonProperty("address") - String address; - /** - * The company ID of the employer. - */ - @JsonProperty("company_id") - String companyId; - /** - * The site of the company. - */ - @JsonProperty("company_site") - String companySite; - /** - * The NAF code of the employer. - */ - @JsonProperty("naf_code") - String nafCode; - /** - * The name of the employer. - */ - @JsonProperty("name") - String name; - /** - * The phone number of the employer. - */ - @JsonProperty("phone_number") - String phoneNumber; - /** - * The URSSAF number of the employer. - */ - @JsonProperty("urssaf_number") - String urssafNumber; - - public boolean isEmpty() { - return ((address == null || address.isEmpty()) - && (companyId == null || companyId.isEmpty()) - && (companySite == null || companySite.isEmpty()) - && (nafCode == null || nafCode.isEmpty()) - && (name == null || name.isEmpty()) - && (phoneNumber == null || phoneNumber.isEmpty()) - && (urssafNumber == null || urssafNumber.isEmpty())); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Address: %s%n", printable.get("address")) - + String.format(" :Company ID: %s%n", printable.get("companyId")) - + String.format(" :Company Site: %s%n", printable.get("companySite")) - + String.format(" :NAF Code: %s%n", printable.get("nafCode")) - + String.format(" :Name: %s%n", printable.get("name")) - + String.format(" :Phone Number: %s%n", printable.get("phoneNumber")) - + String.format(" :URSSAF Number: %s%n", printable.get("urssafNumber")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Address: %s", printable.get("address")) - + String.format(", Company ID: %s", printable.get("companyId")) - + String.format(", Company Site: %s", printable.get("companySite")) - + String.format(", NAF Code: %s", printable.get("nafCode")) - + String.format(", Name: %s", printable.get("name")) - + String.format(", Phone Number: %s", printable.get("phoneNumber")) - + String.format(", URSSAF Number: %s", printable.get("urssafNumber")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("address", SummaryHelper.formatForDisplay(this.address, null)); - printable.put("companyId", SummaryHelper.formatForDisplay(this.companyId, null)); - printable.put("companySite", SummaryHelper.formatForDisplay(this.companySite, null)); - printable.put("nafCode", SummaryHelper.formatForDisplay(this.nafCode, null)); - printable.put("name", SummaryHelper.formatForDisplay(this.name, null)); - printable.put("phoneNumber", SummaryHelper.formatForDisplay(this.phoneNumber, null)); - printable.put("urssafNumber", SummaryHelper.formatForDisplay(this.urssafNumber, null)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employment.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employment.java deleted file mode 100644 index ec49bfcc1..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Employment.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about the employment. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2Employment extends BaseField { - - /** - * The category of the employment. - */ - @JsonProperty("category") - String category; - /** - * The coefficient of the employment. - */ - @JsonProperty("coefficient") - Double coefficient; - /** - * The collective agreement of the employment. - */ - @JsonProperty("collective_agreement") - String collectiveAgreement; - /** - * The job title of the employee. - */ - @JsonProperty("job_title") - String jobTitle; - /** - * The position level of the employment. - */ - @JsonProperty("position_level") - String positionLevel; - /** - * The start date of the employment. - */ - @JsonProperty("start_date") - String startDate; - - public boolean isEmpty() { - return ((category == null || category.isEmpty()) - && coefficient == null - && (collectiveAgreement == null || collectiveAgreement.isEmpty()) - && (jobTitle == null || jobTitle.isEmpty()) - && (positionLevel == null || positionLevel.isEmpty()) - && (startDate == null || startDate.isEmpty())); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Category: %s%n", printable.get("category")) - + String.format(" :Coefficient: %s%n", printable.get("coefficient")) - + String.format(" :Collective Agreement: %s%n", printable.get("collectiveAgreement")) - + String.format(" :Job Title: %s%n", printable.get("jobTitle")) - + String.format(" :Position Level: %s%n", printable.get("positionLevel")) - + String.format(" :Start Date: %s%n", printable.get("startDate")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Category: %s", printable.get("category")) - + String.format(", Coefficient: %s", printable.get("coefficient")) - + String.format(", Collective Agreement: %s", printable.get("collectiveAgreement")) - + String.format(", Job Title: %s", printable.get("jobTitle")) - + String.format(", Position Level: %s", printable.get("positionLevel")) - + String.format(", Start Date: %s", printable.get("startDate")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("category", SummaryHelper.formatForDisplay(this.category, null)); - printable.put("coefficient", SummaryHelper.formatAmount(this.coefficient)); - printable - .put("collectiveAgreement", SummaryHelper.formatForDisplay(this.collectiveAgreement, null)); - printable.put("jobTitle", SummaryHelper.formatForDisplay(this.jobTitle, null)); - printable.put("positionLevel", SummaryHelper.formatForDisplay(this.positionLevel, null)); - printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayDetail.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayDetail.java deleted file mode 100644 index d309622e5..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayDetail.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Detailed information about the pay. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2PayDetail extends BaseField { - - /** - * The gross salary of the employee. - */ - @JsonProperty("gross_salary") - Double grossSalary; - /** - * The year-to-date gross salary of the employee. - */ - @JsonProperty("gross_salary_ytd") - Double grossSalaryYtd; - /** - * The income tax rate of the employee. - */ - @JsonProperty("income_tax_rate") - Double incomeTaxRate; - /** - * The income tax withheld from the employee's pay. - */ - @JsonProperty("income_tax_withheld") - Double incomeTaxWithheld; - /** - * The net paid amount of the employee. - */ - @JsonProperty("net_paid") - Double netPaid; - /** - * The net paid amount before tax of the employee. - */ - @JsonProperty("net_paid_before_tax") - Double netPaidBeforeTax; - /** - * The net taxable amount of the employee. - */ - @JsonProperty("net_taxable") - Double netTaxable; - /** - * The year-to-date net taxable amount of the employee. - */ - @JsonProperty("net_taxable_ytd") - Double netTaxableYtd; - /** - * The total cost to the employer. - */ - @JsonProperty("total_cost_employer") - Double totalCostEmployer; - /** - * The total taxes and deductions of the employee. - */ - @JsonProperty("total_taxes_and_deductions") - Double totalTaxesAndDeductions; - - public boolean isEmpty() { - return (grossSalary == null - && grossSalaryYtd == null - && incomeTaxRate == null - && incomeTaxWithheld == null - && netPaid == null - && netPaidBeforeTax == null - && netTaxable == null - && netTaxableYtd == null - && totalCostEmployer == null - && totalTaxesAndDeductions == null); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Gross Salary: %s%n", printable.get("grossSalary")) - + String.format(" :Gross Salary YTD: %s%n", printable.get("grossSalaryYtd")) - + String.format(" :Income Tax Rate: %s%n", printable.get("incomeTaxRate")) - + String.format(" :Income Tax Withheld: %s%n", printable.get("incomeTaxWithheld")) - + String.format(" :Net Paid: %s%n", printable.get("netPaid")) - + String.format(" :Net Paid Before Tax: %s%n", printable.get("netPaidBeforeTax")) - + String.format(" :Net Taxable: %s%n", printable.get("netTaxable")) - + String.format(" :Net Taxable YTD: %s%n", printable.get("netTaxableYtd")) - + String.format(" :Total Cost Employer: %s%n", printable.get("totalCostEmployer")) - + String - .format(" :Total Taxes and Deductions: %s%n", printable.get("totalTaxesAndDeductions")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Gross Salary: %s", printable.get("grossSalary")) - + String.format(", Gross Salary YTD: %s", printable.get("grossSalaryYtd")) - + String.format(", Income Tax Rate: %s", printable.get("incomeTaxRate")) - + String.format(", Income Tax Withheld: %s", printable.get("incomeTaxWithheld")) - + String.format(", Net Paid: %s", printable.get("netPaid")) - + String.format(", Net Paid Before Tax: %s", printable.get("netPaidBeforeTax")) - + String.format(", Net Taxable: %s", printable.get("netTaxable")) - + String.format(", Net Taxable YTD: %s", printable.get("netTaxableYtd")) - + String.format(", Total Cost Employer: %s", printable.get("totalCostEmployer")) - + String.format(", Total Taxes and Deductions: %s", printable.get("totalTaxesAndDeductions")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("grossSalary", SummaryHelper.formatAmount(this.grossSalary)); - printable.put("grossSalaryYtd", SummaryHelper.formatAmount(this.grossSalaryYtd)); - printable.put("incomeTaxRate", SummaryHelper.formatAmount(this.incomeTaxRate)); - printable.put("incomeTaxWithheld", SummaryHelper.formatAmount(this.incomeTaxWithheld)); - printable.put("netPaid", SummaryHelper.formatAmount(this.netPaid)); - printable.put("netPaidBeforeTax", SummaryHelper.formatAmount(this.netPaidBeforeTax)); - printable.put("netTaxable", SummaryHelper.formatAmount(this.netTaxable)); - printable.put("netTaxableYtd", SummaryHelper.formatAmount(this.netTaxableYtd)); - printable.put("totalCostEmployer", SummaryHelper.formatAmount(this.totalCostEmployer)); - printable - .put("totalTaxesAndDeductions", SummaryHelper.formatAmount(this.totalTaxesAndDeductions)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayPeriod.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayPeriod.java deleted file mode 100644 index 89a3c28d7..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2PayPeriod.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about the pay period. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2PayPeriod extends BaseField { - - /** - * The end date of the pay period. - */ - @JsonProperty("end_date") - String endDate; - /** - * The month of the pay period. - */ - @JsonProperty("month") - String month; - /** - * The date of payment for the pay period. - */ - @JsonProperty("payment_date") - String paymentDate; - /** - * The start date of the pay period. - */ - @JsonProperty("start_date") - String startDate; - /** - * The year of the pay period. - */ - @JsonProperty("year") - String year; - - public boolean isEmpty() { - return ((endDate == null || endDate.isEmpty()) - && (month == null || month.isEmpty()) - && (paymentDate == null || paymentDate.isEmpty()) - && (startDate == null || startDate.isEmpty()) - && (year == null || year.isEmpty())); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :End Date: %s%n", printable.get("endDate")) - + String.format(" :Month: %s%n", printable.get("month")) - + String.format(" :Payment Date: %s%n", printable.get("paymentDate")) - + String.format(" :Start Date: %s%n", printable.get("startDate")) - + String.format(" :Year: %s%n", printable.get("year")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("End Date: %s", printable.get("endDate")) - + String.format(", Month: %s", printable.get("month")) - + String.format(", Payment Date: %s", printable.get("paymentDate")) - + String.format(", Start Date: %s", printable.get("startDate")) - + String.format(", Year: %s", printable.get("year")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("endDate", SummaryHelper.formatForDisplay(this.endDate, null)); - printable.put("month", SummaryHelper.formatForDisplay(this.month, null)); - printable.put("paymentDate", SummaryHelper.formatForDisplay(this.paymentDate, null)); - printable.put("startDate", SummaryHelper.formatForDisplay(this.startDate, null)); - printable.put("year", SummaryHelper.formatForDisplay(this.year, null)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Pto.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2Pto.java deleted file mode 100644 index 7189ea27f..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2Pto.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Information about paid time off. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2Pto extends BaseField { - - /** - * The amount of paid time off accrued in this period. - */ - @JsonProperty("accrued_this_period") - Double accruedThisPeriod; - /** - * The balance of paid time off at the end of the period. - */ - @JsonProperty("balance_end_of_period") - Double balanceEndOfPeriod; - /** - * The amount of paid time off used in this period. - */ - @JsonProperty("used_this_period") - Double usedThisPeriod; - - public boolean isEmpty() { - return (accruedThisPeriod == null && balanceEndOfPeriod == null && usedThisPeriod == null); - } - - /** - * Output the object in a format suitable for inclusion in an rST field list. - */ - public String toFieldList() { - Map printable = this.printableValues(); - return String.format(" :Accrued This Period: %s%n", printable.get("accruedThisPeriod")) - + String.format(" :Balance End of Period: %s%n", printable.get("balanceEndOfPeriod")) - + String.format(" :Used This Period: %s%n", printable.get("usedThisPeriod")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Accrued This Period: %s", printable.get("accruedThisPeriod")) - + String.format(", Balance End of Period: %s", printable.get("balanceEndOfPeriod")) - + String.format(", Used This Period: %s", printable.get("usedThisPeriod")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("accruedThisPeriod", SummaryHelper.formatAmount(this.accruedThisPeriod)); - printable.put("balanceEndOfPeriod", SummaryHelper.formatAmount(this.balanceEndOfPeriod)); - printable.put("usedThisPeriod", SummaryHelper.formatAmount(this.usedThisPeriod)); - return printable; - } -} diff --git a/src/main/java/com/mindee/product/fr/payslip/PayslipV2SalaryDetail.java b/src/main/java/com/mindee/product/fr/payslip/PayslipV2SalaryDetail.java deleted file mode 100644 index b6729b837..000000000 --- a/src/main/java/com/mindee/product/fr/payslip/PayslipV2SalaryDetail.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.mindee.product.fr.payslip; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.parsing.SummaryHelper; -import com.mindee.parsing.standard.BaseField; -import com.mindee.parsing.standard.LineItemField; -import java.util.HashMap; -import java.util.Map; -import lombok.Getter; - -/** - * Detailed information about the earnings. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -public class PayslipV2SalaryDetail extends BaseField implements LineItemField { - - /** - * The amount of the earnings. - */ - @JsonProperty("amount") - Double amount; - /** - * The base value of the earnings. - */ - @JsonProperty("base") - Double base; - /** - * The description of the earnings. - */ - @JsonProperty("description") - String description; - /** - * The rate of the earnings. - */ - @JsonProperty("rate") - Double rate; - - public boolean isEmpty() { - return (amount == null - && base == null - && (description == null || description.isEmpty()) - && rate == null); - } - - private Map tablePrintableValues() { - Map printable = new HashMap<>(); - - printable.put("amount", SummaryHelper.formatAmount(this.amount)); - printable.put("base", SummaryHelper.formatAmount(this.base)); - printable.put("description", SummaryHelper.formatForDisplay(this.description, 36)); - printable.put("rate", SummaryHelper.formatAmount(this.rate)); - return printable; - } - - /** - * Output the line in a format suitable for inclusion in an rST table. - */ - public String toTableLine() { - Map printable = this.tablePrintableValues(); - return String.format("| %-12s ", printable.get("amount")) - + String.format("| %-9s ", printable.get("base")) - + String.format("| %-36s ", printable.get("description")) - + String.format("| %-9s |", printable.get("rate")); - } - - @Override - public String toString() { - Map printable = this.printableValues(); - return String.format("Amount: %s", printable.get("amount")) - + String.format(", Base: %s", printable.get("base")) - + String.format(", Description: %s", printable.get("description")) - + String.format(", Rate: %s", printable.get("rate")); - } - - private Map printableValues() { - Map printable = new HashMap<>(); - - printable.put("amount", SummaryHelper.formatAmount(this.amount)); - printable.put("base", SummaryHelper.formatAmount(this.base)); - printable.put("description", SummaryHelper.formatForDisplay(this.description, null)); - printable.put("rate", SummaryHelper.formatAmount(this.rate)); - return printable; - } -} diff --git a/src/test/java/com/mindee/product/fr/payslip/PayslipV2Test.java b/src/test/java/com/mindee/product/fr/payslip/PayslipV2Test.java deleted file mode 100644 index 691047509..000000000 --- a/src/test/java/com/mindee/product/fr/payslip/PayslipV2Test.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.mindee.product.fr.payslip; - -import static com.mindee.TestingUtilities.assertStringEqualsFile; -import static com.mindee.TestingUtilities.getV1ResourcePathString; - -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.mindee.parsing.common.Document; -import com.mindee.parsing.common.PredictResponse; -import java.io.File; -import java.io.IOException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -/** - * Unit tests for PayslipV2. - */ -public class PayslipV2Test { - - protected PredictResponse getPrediction(String name) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.findAndRegisterModules(); - - JavaType type = objectMapper - .getTypeFactory() - .constructParametricType(PredictResponse.class, PayslipV2.class); - return objectMapper - .readValue( - new File(getV1ResourcePathString("products/payslip_fra/response_v2/" + name + ".json")), - type - ); - } - - @Test - void whenEmptyDeserialized_mustHaveValidProperties() throws IOException { - PredictResponse response = getPrediction("empty"); - PayslipV2Document docPrediction = response.getDocument().getInference().getPrediction(); - Assertions.assertNull(docPrediction.getEmployee().getAddress()); - Assertions.assertNull(docPrediction.getEmployee().getDateOfBirth()); - Assertions.assertNull(docPrediction.getEmployee().getFirstName()); - Assertions.assertNull(docPrediction.getEmployee().getLastName()); - Assertions.assertNull(docPrediction.getEmployee().getPhoneNumber()); - Assertions.assertNull(docPrediction.getEmployee().getRegistrationNumber()); - Assertions.assertNull(docPrediction.getEmployee().getSocialSecurityNumber()); - Assertions.assertNull(docPrediction.getEmployer().getAddress()); - Assertions.assertNull(docPrediction.getEmployer().getCompanyId()); - Assertions.assertNull(docPrediction.getEmployer().getCompanySite()); - Assertions.assertNull(docPrediction.getEmployer().getNafCode()); - Assertions.assertNull(docPrediction.getEmployer().getName()); - Assertions.assertNull(docPrediction.getEmployer().getPhoneNumber()); - Assertions.assertNull(docPrediction.getEmployer().getUrssafNumber()); - Assertions.assertNull(docPrediction.getBankAccountDetails().getBankName()); - Assertions.assertNull(docPrediction.getBankAccountDetails().getIban()); - Assertions.assertNull(docPrediction.getBankAccountDetails().getSwift()); - Assertions.assertNull(docPrediction.getEmployment().getCategory()); - Assertions.assertNull(docPrediction.getEmployment().getCoefficient()); - Assertions.assertNull(docPrediction.getEmployment().getCollectiveAgreement()); - Assertions.assertNull(docPrediction.getEmployment().getJobTitle()); - Assertions.assertNull(docPrediction.getEmployment().getPositionLevel()); - Assertions.assertNull(docPrediction.getEmployment().getStartDate()); - Assertions.assertTrue(docPrediction.getSalaryDetails().isEmpty()); - Assertions.assertNull(docPrediction.getPayDetail().getGrossSalary()); - Assertions.assertNull(docPrediction.getPayDetail().getGrossSalaryYtd()); - Assertions.assertNull(docPrediction.getPayDetail().getIncomeTaxRate()); - Assertions.assertNull(docPrediction.getPayDetail().getIncomeTaxWithheld()); - Assertions.assertNull(docPrediction.getPayDetail().getNetPaid()); - Assertions.assertNull(docPrediction.getPayDetail().getNetPaidBeforeTax()); - Assertions.assertNull(docPrediction.getPayDetail().getNetTaxable()); - Assertions.assertNull(docPrediction.getPayDetail().getNetTaxableYtd()); - Assertions.assertNull(docPrediction.getPayDetail().getTotalCostEmployer()); - Assertions.assertNull(docPrediction.getPayDetail().getTotalTaxesAndDeductions()); - Assertions.assertNull(docPrediction.getPto().getAccruedThisPeriod()); - Assertions.assertNull(docPrediction.getPto().getBalanceEndOfPeriod()); - Assertions.assertNull(docPrediction.getPto().getUsedThisPeriod()); - Assertions.assertNull(docPrediction.getPayPeriod().getEndDate()); - Assertions.assertNull(docPrediction.getPayPeriod().getMonth()); - Assertions.assertNull(docPrediction.getPayPeriod().getPaymentDate()); - Assertions.assertNull(docPrediction.getPayPeriod().getStartDate()); - Assertions.assertNull(docPrediction.getPayPeriod().getYear()); - } - - @Test - void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException { - PredictResponse response = getPrediction("complete"); - Document doc = response.getDocument(); - assertStringEqualsFile( - doc.toString(), - getV1ResourcePathString("products/payslip_fra/response_v2/summary_full.rst") - ); - } - -}