mindee 3.10.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +103 -41
- package/package.json +6 -6
- package/src/cli.js +96 -70
- package/src/client.d.ts +34 -65
- package/src/client.js +108 -172
- package/src/geometry/boundingBox.d.ts +5 -0
- package/src/geometry/boundingBox.js +2 -0
- package/src/geometry/boundingBoxUtils.d.ts +22 -0
- package/src/geometry/boundingBoxUtils.js +66 -0
- package/src/geometry/index.d.ts +6 -0
- package/src/geometry/index.js +21 -0
- package/src/geometry/minMax.d.ts +4 -0
- package/src/geometry/minMax.js +2 -0
- package/src/geometry/point.d.ts +2 -0
- package/src/geometry/point.js +2 -0
- package/src/geometry/polygon.d.ts +4 -0
- package/src/geometry/polygon.js +7 -0
- package/src/{geometry.d.ts → geometry/polygonUtils.d.ts} +7 -32
- package/src/{geometry.js → geometry/polygonUtils.js} +41 -64
- package/src/http/endpoint.d.ts +44 -0
- package/src/http/endpoint.js +188 -0
- package/src/http/error.d.ts +2 -0
- package/src/http/error.js +9 -0
- package/src/http/index.d.ts +3 -0
- package/src/http/index.js +11 -0
- package/src/http/mindeeApi.d.ts +20 -0
- package/src/http/mindeeApi.js +73 -0
- package/src/index.d.ts +4 -4
- package/src/index.js +33 -26
- package/src/{inputs → input}/base.d.ts +4 -3
- package/src/{inputs → input}/base.js +9 -7
- package/src/{inputs → input}/index.d.ts +1 -1
- package/src/{inputs → input}/index.js +1 -2
- package/src/{inputs → input}/sources.d.ts +10 -11
- package/src/{inputs → input}/sources.js +9 -9
- package/src/parsing/common/apiRequest.d.ts +10 -0
- package/src/parsing/common/apiRequest.js +13 -0
- package/src/parsing/common/apiResponse.d.ts +6 -0
- package/src/parsing/common/apiResponse.js +10 -0
- package/src/parsing/common/asyncPredictResponse.d.ts +21 -0
- package/src/parsing/common/asyncPredictResponse.js +39 -0
- package/src/parsing/common/document.d.ts +13 -0
- package/src/parsing/common/document.js +34 -0
- package/src/parsing/common/extras/cropperExtra.d.ts +8 -0
- package/src/parsing/common/extras/cropperExtra.js +26 -0
- package/src/parsing/common/extras/extras.d.ts +11 -0
- package/src/parsing/common/extras/extras.js +18 -0
- package/src/parsing/common/index.d.ts +9 -0
- package/src/parsing/common/index.js +20 -0
- package/src/parsing/common/inference.d.ts +26 -0
- package/src/parsing/common/inference.js +56 -0
- package/src/parsing/common/mvisionV1.d.ts +8 -0
- package/src/parsing/common/mvisionV1.js +17 -0
- package/src/parsing/common/ocr.d.ts +8 -0
- package/src/parsing/common/ocr.js +13 -0
- package/src/parsing/common/ocrPage.d.ts +16 -0
- package/src/parsing/common/ocrPage.js +66 -0
- package/src/{fields → parsing/common}/orientation.d.ts +2 -2
- package/src/{fields → parsing/common}/orientation.js +4 -4
- package/src/parsing/common/page.d.ts +12 -0
- package/src/parsing/common/page.js +40 -0
- package/src/parsing/common/predictResponse.d.ts +6 -0
- package/src/parsing/common/predictResponse.js +12 -0
- package/src/parsing/common/prediction.d.ts +2 -0
- package/src/parsing/common/prediction.js +6 -0
- package/src/parsing/common/product.d.ts +4 -0
- package/src/parsing/common/product.js +2 -0
- package/src/parsing/common/stringDict.d.ts +3 -0
- package/src/parsing/common/stringDict.js +2 -0
- package/src/parsing/common/summaryHelper.d.ts +8 -0
- package/src/parsing/common/summaryHelper.js +22 -0
- package/src/parsing/custom/classificationField.d.ts +16 -0
- package/src/parsing/custom/classificationField.js +14 -0
- package/src/parsing/custom/index.d.ts +3 -0
- package/src/parsing/custom/index.js +12 -0
- package/src/{documents/custom/lineitems.d.ts → parsing/custom/lineItems.d.ts} +4 -4
- package/src/{documents/custom/lineitems.js → parsing/custom/lineItems.js} +11 -9
- package/src/{documents/custom/fields.d.ts → parsing/custom/listField.d.ts} +3 -16
- package/src/{documents/custom/fields.js → parsing/custom/listField.js} +4 -14
- package/src/parsing/index.d.ts +3 -0
- package/src/parsing/index.js +29 -0
- package/src/{fields → parsing/standard}/amount.d.ts +2 -2
- package/src/{fields → parsing/standard}/amount.js +5 -5
- package/src/{fields → parsing/standard}/base.d.ts +5 -5
- package/src/{fields → parsing/standard}/base.js +3 -2
- package/src/{fields → parsing/standard}/classification.d.ts +1 -1
- package/src/{fields → parsing/standard}/classification.js +3 -3
- package/src/{fields → parsing/standard}/companyRegistration.d.ts +1 -1
- package/src/parsing/standard/companyRegistration.js +14 -0
- package/src/{fields → parsing/standard}/date.d.ts +1 -1
- package/src/{fields → parsing/standard}/date.js +2 -2
- package/src/{fields → parsing/standard}/field.d.ts +3 -4
- package/src/{fields → parsing/standard}/field.js +6 -7
- package/src/parsing/standard/index.d.ts +12 -0
- package/src/parsing/standard/index.js +27 -0
- package/src/{fields → parsing/standard}/locale.d.ts +4 -4
- package/src/parsing/standard/locale.js +42 -0
- package/src/{fields → parsing/standard}/paymentDetails.d.ts +3 -3
- package/src/{fields → parsing/standard}/paymentDetails.js +11 -11
- package/src/{fields → parsing/standard}/position.d.ts +2 -2
- package/src/{fields → parsing/standard}/position.js +5 -5
- package/src/{fields → parsing/standard}/tax.d.ts +3 -3
- package/src/{fields → parsing/standard}/tax.js +3 -3
- package/src/{fields → parsing/standard}/text.d.ts +2 -2
- package/src/{fields → parsing/standard}/text.js +4 -4
- package/src/parsing/standard/word.d.ts +10 -0
- package/src/parsing/standard/word.js +2 -0
- package/src/pdf/pdfOperation.d.ts +1 -1
- package/src/pdf/pdfOperation.js +3 -3
- package/src/product/cropper/cropperV1.d.ts +9 -0
- package/src/product/cropper/cropperV1.js +16 -0
- package/src/product/cropper/cropperV1Document.d.ts +8 -0
- package/src/product/cropper/cropperV1Document.js +26 -0
- package/src/product/custom/customV1.d.ts +10 -0
- package/src/product/custom/customV1.js +17 -0
- package/src/product/custom/customV1Document.d.ts +9 -0
- package/src/product/custom/customV1Document.js +43 -0
- package/src/product/custom/customV1Page.d.ts +7 -0
- package/src/product/custom/customV1Page.js +24 -0
- package/src/product/eu/licensePlate/licensePlateV1.d.ts +9 -0
- package/src/product/eu/licensePlate/licensePlateV1.js +16 -0
- package/src/product/eu/licensePlate/licensePlateV1Document.d.ts +11 -0
- package/src/product/eu/licensePlate/licensePlateV1Document.js +25 -0
- package/src/product/financialDocument/financialDocumentV1.d.ts +9 -0
- package/src/product/financialDocument/financialDocumentV1.js +16 -0
- package/src/{documents/financialDocument/financialDocumentV1.d.ts → product/financialDocument/financialDocumentV1Document.d.ts} +43 -44
- package/src/product/financialDocument/financialDocumentV1Document.js +158 -0
- package/src/{documents → product}/financialDocument/financialDocumentV1LineItem.d.ts +8 -8
- package/src/{documents → product}/financialDocument/financialDocumentV1LineItem.js +35 -34
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +9 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1.js +16 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +15 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +31 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +9 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2.js +16 -0
- package/src/{documents → product}/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +5 -5
- package/src/{documents → product}/fr/bankAccountDetails/bankAccountDetailsV2Bban.js +1 -1
- package/src/{documents/fr/bankAccountDetails/bankAccountDetailsV2.d.ts → product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts} +7 -7
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +37 -0
- package/src/product/fr/carteVitale/carteVitaleV1.d.ts +9 -0
- package/src/product/fr/carteVitale/carteVitaleV1.js +16 -0
- package/src/product/fr/carteVitale/carteVitaleV1Document.d.ts +17 -0
- package/src/product/fr/carteVitale/carteVitaleV1Document.js +40 -0
- package/src/product/fr/idCard/idCardV1.d.ts +10 -0
- package/src/product/fr/idCard/idCardV1.js +17 -0
- package/src/product/fr/idCard/idCardV1Document.d.ts +29 -0
- package/src/product/fr/idCard/idCardV1Document.js +70 -0
- package/src/product/fr/idCard/idCardV1Page.d.ts +12 -0
- package/src/product/fr/idCard/idCardV1Page.js +23 -0
- package/src/{documents → product}/index.d.ts +2 -7
- package/src/{documents → product}/index.js +3 -14
- package/src/product/invoice/invoiceV4.d.ts +9 -0
- package/src/product/invoice/invoiceV4.js +16 -0
- package/src/product/invoice/invoiceV4Document.d.ts +44 -0
- package/src/product/invoice/invoiceV4Document.js +146 -0
- package/src/{documents/invoice/invoiceLineItem.d.ts → product/invoice/invoiceV4LineItem.d.ts} +10 -8
- package/src/product/invoice/invoiceV4LineItem.js +101 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1.d.ts +9 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1.js +16 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +8 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +23 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.d.ts +7 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.js +14 -0
- package/src/product/passport/passportV1.d.ts +9 -0
- package/src/product/passport/passportV1.js +16 -0
- package/src/product/passport/passportV1Document.d.ts +31 -0
- package/src/product/passport/passportV1Document.js +75 -0
- package/src/product/proofOfAddress/proofOfAddressV1.d.ts +9 -0
- package/src/product/proofOfAddress/proofOfAddressV1.js +16 -0
- package/src/product/proofOfAddress/proofOfAddressV1Document.d.ts +27 -0
- package/src/product/proofOfAddress/proofOfAddressV1Document.js +72 -0
- package/src/product/receipt/receiptV4.d.ts +9 -0
- package/src/product/receipt/receiptV4.js +15 -0
- package/src/{documents/receipt/receiptV4.d.ts → product/receipt/receiptV4Document.d.ts} +12 -12
- package/src/product/receipt/receiptV4Document.js +67 -0
- package/src/product/receipt/receiptV5.d.ts +9 -0
- package/src/product/receipt/receiptV5.js +16 -0
- package/src/{documents/receipt/receiptV5.d.ts → product/receipt/receiptV5Document.d.ts} +16 -17
- package/src/product/receipt/receiptV5Document.js +108 -0
- package/src/{documents → product}/receipt/receiptV5LineItem.d.ts +5 -5
- package/src/{documents → product}/receipt/receiptV5LineItem.js +20 -19
- package/src/product/us/bankCheck/bankCheckV1.d.ts +10 -0
- package/src/product/us/bankCheck/bankCheckV1.js +17 -0
- package/src/product/us/bankCheck/bankCheckV1Document.d.ts +21 -0
- package/src/product/us/bankCheck/bankCheckV1Document.js +50 -0
- package/src/product/us/bankCheck/bankCheckV1Page.d.ts +14 -0
- package/src/product/us/bankCheck/bankCheckV1Page.js +32 -0
- package/src/product/us/driverLicense/driverLicenseV1.d.ts +10 -0
- package/src/product/us/driverLicense/driverLicenseV1.js +17 -0
- package/src/product/us/driverLicense/driverLicenseV1Document.d.ts +43 -0
- package/src/product/us/driverLicense/driverLicenseV1Document.js +101 -0
- package/src/product/us/driverLicense/driverLicenseV1Page.d.ts +14 -0
- package/src/product/us/driverLicense/driverLicenseV1Page.js +29 -0
- package/src/product/us/index.d.ts +2 -0
- package/src/product/us/index.js +7 -0
- package/src/api/documentResponse.d.ts +0 -25
- package/src/api/documentResponse.js +0 -50
- package/src/api/endpoint.d.ts +0 -63
- package/src/api/endpoint.js +0 -216
- package/src/api/index.d.ts +0 -3
- package/src/api/index.js +0 -13
- package/src/api/predictResponse.d.ts +0 -33
- package/src/api/predictResponse.js +0 -52
- package/src/documents/cropper/cropperV1.d.ts +0 -7
- package/src/documents/cropper/cropperV1.js +0 -35
- package/src/documents/custom/customV1.d.ts +0 -10
- package/src/documents/custom/customV1.js +0 -53
- package/src/documents/document.d.ts +0 -47
- package/src/documents/document.js +0 -76
- package/src/documents/documentConfig.d.ts +0 -42
- package/src/documents/documentConfig.js +0 -118
- package/src/documents/eu/licensePlate/licensePlateV1.d.ts +0 -8
- package/src/documents/eu/licensePlate/licensePlateV1.js +0 -32
- package/src/documents/financialDocument/financialDocumentV0.d.ts +0 -28
- package/src/documents/financialDocument/financialDocumentV0.js +0 -140
- package/src/documents/financialDocument/financialDocumentV1.js +0 -197
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +0 -13
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +0 -39
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV2.js +0 -48
- package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +0 -14
- package/src/documents/fr/carteVitale/carteVitaleV1.js +0 -45
- package/src/documents/fr/idCard/idCardV1.d.ts +0 -28
- package/src/documents/fr/idCard/idCardV1.js +0 -79
- package/src/documents/invoice/checks.d.ts +0 -5
- package/src/documents/invoice/checks.js +0 -87
- package/src/documents/invoice/invoiceLineItem.js +0 -66
- package/src/documents/invoice/invoiceV3.d.ts +0 -49
- package/src/documents/invoice/invoiceV3.js +0 -156
- package/src/documents/invoice/invoiceV4.d.ts +0 -45
- package/src/documents/invoice/invoiceV4.js +0 -166
- package/src/documents/invoice/reconstruction.d.ts +0 -6
- package/src/documents/invoice/reconstruction.js +0 -78
- package/src/documents/invoiceSplitter/invoiceSplitterV1.d.ts +0 -14
- package/src/documents/invoiceSplitter/invoiceSplitterV1.js +0 -47
- package/src/documents/mindeeVision/mindeeVisionV1.d.ts +0 -8
- package/src/documents/mindeeVision/mindeeVisionV1.js +0 -29
- package/src/documents/passport/passportV1.d.ts +0 -43
- package/src/documents/passport/passportV1.js +0 -220
- package/src/documents/proofOfAddress/proofOfAddressV1.d.ts +0 -24
- package/src/documents/proofOfAddress/proofOfAddressV1.js +0 -77
- package/src/documents/receipt/receiptV3.d.ts +0 -25
- package/src/documents/receipt/receiptV3.js +0 -136
- package/src/documents/receipt/receiptV4.js +0 -78
- package/src/documents/receipt/receiptV5.js +0 -137
- package/src/documents/us/bankCheck/bankCheckV1.d.ts +0 -22
- package/src/documents/us/bankCheck/bankCheckV1.js +0 -63
- package/src/documents/us/index.d.ts +0 -1
- package/src/documents/us/index.js +0 -5
- package/src/fields/companyRegistration.js +0 -14
- package/src/fields/fullText.d.ts +0 -27
- package/src/fields/fullText.js +0 -92
- package/src/fields/index.d.ts +0 -12
- package/src/fields/index.js +0 -28
- package/src/fields/locale.js +0 -45
- package/src/math/index.d.ts +0 -1
- package/src/math/index.js +0 -5
- package/src/math/precision.d.ts +0 -1
- package/src/math/precision.js +0 -13
- /package/src/{inputs → input}/pageOptions.d.ts +0 -0
- /package/src/{inputs → input}/pageOptions.js +0 -0
- /package/src/{documents → product}/eu/index.d.ts +0 -0
- /package/src/{documents → product}/eu/index.js +0 -0
- /package/src/{documents → product}/fr/index.d.ts +0 -0
- /package/src/{documents → product}/fr/index.js +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BankAccountDetailsV1 = void 0;
|
|
4
|
-
const document_1 = require("../../document");
|
|
5
|
-
const fields_1 = require("../../../fields");
|
|
6
|
-
/** French bank account information (RIB) */
|
|
7
|
-
class BankAccountDetailsV1 extends document_1.Document {
|
|
8
|
-
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
9
|
-
super({
|
|
10
|
-
inputSource: inputSource,
|
|
11
|
-
pageId: pageId,
|
|
12
|
-
orientation: orientation,
|
|
13
|
-
extras: extras,
|
|
14
|
-
});
|
|
15
|
-
this.iban = new fields_1.TextField({
|
|
16
|
-
prediction: prediction.iban,
|
|
17
|
-
pageId: pageId,
|
|
18
|
-
});
|
|
19
|
-
this.accountHolderName = new fields_1.TextField({
|
|
20
|
-
prediction: prediction.account_holder_name,
|
|
21
|
-
pageId: pageId,
|
|
22
|
-
});
|
|
23
|
-
this.swift = new fields_1.TextField({
|
|
24
|
-
prediction: prediction.swift,
|
|
25
|
-
pageId: pageId,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
toString() {
|
|
29
|
-
const outStr = `----- FR Bank Account Details V1 -----
|
|
30
|
-
Filename: ${this.filename}
|
|
31
|
-
IBAN: ${this.iban}
|
|
32
|
-
Account Holder's Name: ${this.accountHolderName}
|
|
33
|
-
SWIFT Code: ${this.swift}
|
|
34
|
-
----------------------
|
|
35
|
-
`;
|
|
36
|
-
return BankAccountDetailsV1.cleanOutString(outStr);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.BankAccountDetailsV1 = BankAccountDetailsV1;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BankAccountDetailsV2 = void 0;
|
|
4
|
-
const document_1 = require("../../document");
|
|
5
|
-
const fields_1 = require("../../../fields");
|
|
6
|
-
const bankAccountDetailsV2Bban_1 = require("./bankAccountDetailsV2Bban");
|
|
7
|
-
/**
|
|
8
|
-
* Document data for Bank Account Details, API version 2.
|
|
9
|
-
*/
|
|
10
|
-
class BankAccountDetailsV2 extends document_1.Document {
|
|
11
|
-
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, fullText = undefined, pageId = undefined, }) {
|
|
12
|
-
super({
|
|
13
|
-
inputSource: inputSource,
|
|
14
|
-
pageId: pageId,
|
|
15
|
-
orientation: orientation,
|
|
16
|
-
extras: extras,
|
|
17
|
-
fullText: fullText,
|
|
18
|
-
});
|
|
19
|
-
this.accountHoldersNames = new fields_1.TextField({
|
|
20
|
-
prediction: prediction["account_holders_names"],
|
|
21
|
-
pageId: pageId,
|
|
22
|
-
});
|
|
23
|
-
this.bban = new bankAccountDetailsV2Bban_1.BankAccountDetailsV2Bban({
|
|
24
|
-
prediction: prediction["bban"],
|
|
25
|
-
pageId: pageId,
|
|
26
|
-
});
|
|
27
|
-
this.iban = new fields_1.TextField({
|
|
28
|
-
prediction: prediction["iban"],
|
|
29
|
-
pageId: pageId,
|
|
30
|
-
});
|
|
31
|
-
this.swiftCode = new fields_1.TextField({
|
|
32
|
-
prediction: prediction["swift_code"],
|
|
33
|
-
pageId: pageId,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
toString() {
|
|
37
|
-
const outStr = `FR Bank Account Details V2 Prediction
|
|
38
|
-
=====================================
|
|
39
|
-
:Filename: ${this.filename}
|
|
40
|
-
:Account Holder's Names: ${this.accountHoldersNames}
|
|
41
|
-
:Basic Bank Account Number: ${this.bban.toFieldList()}
|
|
42
|
-
:IBAN: ${this.iban}
|
|
43
|
-
:SWIFT Code: ${this.swiftCode}
|
|
44
|
-
`;
|
|
45
|
-
return BankAccountDetailsV2.cleanOutString(outStr);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.BankAccountDetailsV2 = BankAccountDetailsV2;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import { TextField, DateField } from "../../../fields";
|
|
3
|
-
export declare class CarteVitaleV1 extends Document {
|
|
4
|
-
/** List of given (first) names of the cardholder. */
|
|
5
|
-
givenNames: TextField[];
|
|
6
|
-
/** The surname of the person. */
|
|
7
|
-
surname: TextField;
|
|
8
|
-
/** The social security number of the cardholder. */
|
|
9
|
-
socialSecurity: TextField;
|
|
10
|
-
/** The issuance date of the card. */
|
|
11
|
-
issuanceDate: DateField;
|
|
12
|
-
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
13
|
-
toString(): string;
|
|
14
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CarteVitaleV1 = void 0;
|
|
4
|
-
const document_1 = require("../../document");
|
|
5
|
-
const fields_1 = require("../../../fields");
|
|
6
|
-
class CarteVitaleV1 extends document_1.Document {
|
|
7
|
-
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
-
super({
|
|
9
|
-
inputSource: inputSource,
|
|
10
|
-
pageId: pageId,
|
|
11
|
-
orientation: orientation,
|
|
12
|
-
extras: extras,
|
|
13
|
-
});
|
|
14
|
-
/** List of given (first) names of the cardholder. */
|
|
15
|
-
this.givenNames = [];
|
|
16
|
-
this.socialSecurity = new fields_1.TextField({
|
|
17
|
-
prediction: prediction.social_security,
|
|
18
|
-
pageId: pageId,
|
|
19
|
-
});
|
|
20
|
-
this.issuanceDate = new fields_1.DateField({
|
|
21
|
-
prediction: prediction.issuance_date,
|
|
22
|
-
pageId: pageId,
|
|
23
|
-
});
|
|
24
|
-
this.surname = new fields_1.TextField({
|
|
25
|
-
prediction: prediction.surname,
|
|
26
|
-
pageId: pageId,
|
|
27
|
-
});
|
|
28
|
-
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.TextField({
|
|
29
|
-
prediction: prediction,
|
|
30
|
-
pageId: pageId,
|
|
31
|
-
})));
|
|
32
|
-
}
|
|
33
|
-
toString() {
|
|
34
|
-
const outStr = `----- FR Carte Vitale V1 -----
|
|
35
|
-
Filename: ${this.filename}
|
|
36
|
-
Given Name(s): ${this.givenNames.map((name) => name.value).join(" ")}
|
|
37
|
-
Surname: ${this.surname}
|
|
38
|
-
Social Security Number: ${this.socialSecurity}
|
|
39
|
-
Issuance Date: ${this.issuanceDate}
|
|
40
|
-
----------------------
|
|
41
|
-
`;
|
|
42
|
-
return CarteVitaleV1.cleanOutString(outStr);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.CarteVitaleV1 = CarteVitaleV1;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Document, DocumentConstructorProps } from "../../document";
|
|
2
|
-
import { TextField, DateField, BaseField } from "../../../fields";
|
|
3
|
-
export declare class IdCardV1 extends Document {
|
|
4
|
-
/** The authority which has issued the card. */
|
|
5
|
-
authority: TextField;
|
|
6
|
-
/** Indicates if it is the recto side, the verso side or both. */
|
|
7
|
-
documentSide: BaseField;
|
|
8
|
-
/** The id number of the card. */
|
|
9
|
-
idNumber: TextField;
|
|
10
|
-
/** The birth date of the person. */
|
|
11
|
-
birthDate: DateField;
|
|
12
|
-
/** The expiry date of the card. */
|
|
13
|
-
expiryDate: DateField;
|
|
14
|
-
/** The birth place of the person. */
|
|
15
|
-
birthPlace: TextField;
|
|
16
|
-
/** The gender of the person. */
|
|
17
|
-
gender: TextField;
|
|
18
|
-
/** The first mrz value. */
|
|
19
|
-
mrz1: TextField;
|
|
20
|
-
/** The second mrz value. */
|
|
21
|
-
mrz2: TextField;
|
|
22
|
-
/** The surname of the person. */
|
|
23
|
-
surname: TextField;
|
|
24
|
-
/** The list of the names of the person. */
|
|
25
|
-
givenNames: TextField[];
|
|
26
|
-
constructor({ prediction, orientation, extras, inputSource, pageId, }: DocumentConstructorProps);
|
|
27
|
-
toString(): string;
|
|
28
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IdCardV1 = void 0;
|
|
4
|
-
const document_1 = require("../../document");
|
|
5
|
-
const fields_1 = require("../../../fields");
|
|
6
|
-
class IdCardV1 extends document_1.Document {
|
|
7
|
-
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, pageId = undefined, }) {
|
|
8
|
-
super({
|
|
9
|
-
inputSource: inputSource,
|
|
10
|
-
pageId: pageId,
|
|
11
|
-
orientation: orientation,
|
|
12
|
-
extras: extras,
|
|
13
|
-
});
|
|
14
|
-
/** The list of the names of the person. */
|
|
15
|
-
this.givenNames = [];
|
|
16
|
-
this.authority = new fields_1.TextField({
|
|
17
|
-
prediction: prediction.authority,
|
|
18
|
-
pageId: pageId,
|
|
19
|
-
});
|
|
20
|
-
this.documentSide = new fields_1.BaseField({
|
|
21
|
-
prediction: prediction.document_side,
|
|
22
|
-
});
|
|
23
|
-
this.idNumber = new fields_1.TextField({
|
|
24
|
-
prediction: prediction.id_number,
|
|
25
|
-
pageId: pageId,
|
|
26
|
-
});
|
|
27
|
-
this.birthDate = new fields_1.DateField({
|
|
28
|
-
prediction: prediction.birth_date,
|
|
29
|
-
pageId: pageId,
|
|
30
|
-
});
|
|
31
|
-
this.expiryDate = new fields_1.DateField({
|
|
32
|
-
prediction: prediction.expiry_date,
|
|
33
|
-
pageId: pageId,
|
|
34
|
-
});
|
|
35
|
-
this.birthPlace = new fields_1.TextField({
|
|
36
|
-
prediction: prediction.birth_place,
|
|
37
|
-
pageId: pageId,
|
|
38
|
-
});
|
|
39
|
-
this.gender = new fields_1.TextField({
|
|
40
|
-
prediction: prediction.gender,
|
|
41
|
-
pageId: pageId,
|
|
42
|
-
});
|
|
43
|
-
this.surname = new fields_1.TextField({
|
|
44
|
-
prediction: prediction.surname,
|
|
45
|
-
pageId: pageId,
|
|
46
|
-
});
|
|
47
|
-
this.mrz1 = new fields_1.TextField({
|
|
48
|
-
prediction: prediction.mrz1,
|
|
49
|
-
pageId: pageId,
|
|
50
|
-
});
|
|
51
|
-
this.mrz2 = new fields_1.TextField({
|
|
52
|
-
prediction: prediction.mrz2,
|
|
53
|
-
pageId: pageId,
|
|
54
|
-
});
|
|
55
|
-
prediction.given_names.map((prediction) => this.givenNames.push(new fields_1.TextField({
|
|
56
|
-
prediction: prediction,
|
|
57
|
-
pageId: pageId,
|
|
58
|
-
})));
|
|
59
|
-
}
|
|
60
|
-
toString() {
|
|
61
|
-
const outStr = `----- FR Carte Nationale d'Identité V1 -----
|
|
62
|
-
Filename: ${this.filename}
|
|
63
|
-
Document Side: ${this.documentSide}
|
|
64
|
-
Identity Number: ${this.idNumber}
|
|
65
|
-
Given Name(s): ${this.givenNames.map((name) => name.value).join(" ")}
|
|
66
|
-
Surname: ${this.surname}
|
|
67
|
-
Date of Birth: ${this.birthDate}
|
|
68
|
-
Place of Birth: ${this.birthPlace}
|
|
69
|
-
Expiry Date: ${this.expiryDate}
|
|
70
|
-
Issuing Authority: ${this.authority}
|
|
71
|
-
Gender: ${this.gender}
|
|
72
|
-
MRZ Line 1: ${this.mrz1}
|
|
73
|
-
MRZ Line 2: ${this.mrz2}
|
|
74
|
-
----------------------
|
|
75
|
-
`;
|
|
76
|
-
return IdCardV1.cleanOutString(outStr);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.IdCardV1 = IdCardV1;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InvoiceV3 } from "./invoiceV3";
|
|
2
|
-
import { InvoiceV4 } from "./invoiceV4";
|
|
3
|
-
export declare function taxesMatchTotalIncl(document: InvoiceV4 | InvoiceV3): boolean;
|
|
4
|
-
export declare function taxesMatchTotalExcl(document: InvoiceV4 | InvoiceV3): boolean;
|
|
5
|
-
export declare function taxesAndTotalExclMatchTotalIncl(document: InvoiceV4 | InvoiceV3): boolean;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.taxesAndTotalExclMatchTotalIncl = exports.taxesMatchTotalExcl = exports.taxesMatchTotalIncl = void 0;
|
|
4
|
-
function taxesMatchTotalIncl(document) {
|
|
5
|
-
// Check taxes and total include exist
|
|
6
|
-
if (document.taxes.length === 0 || document.totalAmount.value === undefined)
|
|
7
|
-
return false;
|
|
8
|
-
// Reconstruct totalIncl from taxes
|
|
9
|
-
let totalVat = 0;
|
|
10
|
-
let reconstructedTotal = 0;
|
|
11
|
-
document.taxes.forEach((tax) => {
|
|
12
|
-
if (tax.value === undefined || !tax.rate)
|
|
13
|
-
return false;
|
|
14
|
-
totalVat += tax.value;
|
|
15
|
-
reconstructedTotal += tax.value + (100 * tax.value) / tax.rate;
|
|
16
|
-
});
|
|
17
|
-
// Sanity check
|
|
18
|
-
if (totalVat <= 0)
|
|
19
|
-
return false;
|
|
20
|
-
// Crate epsilon
|
|
21
|
-
const eps = 1 / (100 * totalVat);
|
|
22
|
-
if (document.totalAmount.value * (1 - eps) - 0.02 <= reconstructedTotal &&
|
|
23
|
-
reconstructedTotal <= document.totalAmount.value * (1 + eps) + 0.02) {
|
|
24
|
-
document.taxes.forEach((tax) => {
|
|
25
|
-
tax.confidence = 1.0;
|
|
26
|
-
});
|
|
27
|
-
document.totalTax.confidence = 1.0;
|
|
28
|
-
document.totalAmount.confidence = 1.0;
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
exports.taxesMatchTotalIncl = taxesMatchTotalIncl;
|
|
34
|
-
function taxesMatchTotalExcl(document) {
|
|
35
|
-
// Check taxes and total amount exist
|
|
36
|
-
if (document.taxes.length === 0 || document.totalNet.value === undefined) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
// Reconstruct total_incl from taxes
|
|
40
|
-
let totalVat = 0;
|
|
41
|
-
let reconstructedTotal = 0;
|
|
42
|
-
document.taxes.forEach((tax) => {
|
|
43
|
-
if (tax.value === undefined || !tax.rate) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
totalVat += tax.value;
|
|
47
|
-
reconstructedTotal += (100 * tax.value) / tax.rate;
|
|
48
|
-
});
|
|
49
|
-
// Sanity check
|
|
50
|
-
if (totalVat <= 0)
|
|
51
|
-
return false;
|
|
52
|
-
// Crate epsilon
|
|
53
|
-
const eps = 1 / (100 * totalVat);
|
|
54
|
-
if (document.totalNet.value * (1 - eps) - 0.02 <= reconstructedTotal &&
|
|
55
|
-
reconstructedTotal <= document.totalNet.value * (1 + eps) + 0.02) {
|
|
56
|
-
document.taxes.forEach((tax) => {
|
|
57
|
-
tax.confidence = 1.0;
|
|
58
|
-
});
|
|
59
|
-
document.totalTax.confidence = 1.0;
|
|
60
|
-
document.totalNet.confidence = 1.0;
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
exports.taxesMatchTotalExcl = taxesMatchTotalExcl;
|
|
66
|
-
function taxesAndTotalExclMatchTotalIncl(document) {
|
|
67
|
-
if (document.totalNet.value === undefined ||
|
|
68
|
-
document.taxes.length === 0 ||
|
|
69
|
-
document.totalAmount.value === undefined)
|
|
70
|
-
return false;
|
|
71
|
-
let totalVat = 0;
|
|
72
|
-
document.taxes.forEach((tax) => (totalVat += tax.value || 0));
|
|
73
|
-
const reconstructedTotal = totalVat + document.totalNet.value;
|
|
74
|
-
if (totalVat <= 0)
|
|
75
|
-
return false;
|
|
76
|
-
if (document.totalAmount.value - 0.01 <= reconstructedTotal &&
|
|
77
|
-
reconstructedTotal <= document.totalAmount.value + 0.01) {
|
|
78
|
-
document.taxes.forEach((tax) => {
|
|
79
|
-
tax.confidence = 1.0;
|
|
80
|
-
});
|
|
81
|
-
document.totalTax.confidence = 1.0;
|
|
82
|
-
document.totalAmount.confidence = 1.0;
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
exports.taxesAndTotalExclMatchTotalIncl = taxesAndTotalExclMatchTotalIncl;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvoiceLineItem = void 0;
|
|
4
|
-
const amount_1 = require("../../fields/amount");
|
|
5
|
-
class InvoiceLineItem {
|
|
6
|
-
constructor({ prediction }) {
|
|
7
|
-
/** Confidence score */
|
|
8
|
-
this.confidence = 0.0;
|
|
9
|
-
/**
|
|
10
|
-
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
11
|
-
* the field in the document.
|
|
12
|
-
*/
|
|
13
|
-
this.polygon = [];
|
|
14
|
-
this.productCode = prediction.product_code;
|
|
15
|
-
this.description = prediction.description;
|
|
16
|
-
this.quantity = +parseFloat(prediction.quantity).toFixed(3);
|
|
17
|
-
if (isNaN(this.quantity)) {
|
|
18
|
-
this.quantity = null;
|
|
19
|
-
}
|
|
20
|
-
this.unitPrice = +parseFloat(prediction.unit_price).toFixed(3);
|
|
21
|
-
if (isNaN(this.unitPrice)) {
|
|
22
|
-
this.unitPrice = null;
|
|
23
|
-
}
|
|
24
|
-
this.totalAmount = +parseFloat(prediction.total_amount).toFixed(3);
|
|
25
|
-
if (isNaN(this.totalAmount)) {
|
|
26
|
-
this.totalAmount = null;
|
|
27
|
-
}
|
|
28
|
-
this.taxRate = +parseFloat(prediction.tax_rate).toFixed(3);
|
|
29
|
-
if (isNaN(this.taxRate)) {
|
|
30
|
-
this.taxRate = null;
|
|
31
|
-
}
|
|
32
|
-
this.taxAmount = +parseFloat(prediction.tax_amount).toFixed(3);
|
|
33
|
-
if (isNaN(this.taxAmount)) {
|
|
34
|
-
this.taxAmount = null;
|
|
35
|
-
}
|
|
36
|
-
this.pageId = prediction.page_id;
|
|
37
|
-
this.confidence = prediction.confidence ? prediction.confidence : 0.0;
|
|
38
|
-
if (prediction.polygon) {
|
|
39
|
-
this.polygon = prediction.polygon;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
toString() {
|
|
43
|
-
const productCode = this.productCode ?? "";
|
|
44
|
-
const quantity = this.quantity !== null ? (0, amount_1.floatToString)(this.quantity) : "";
|
|
45
|
-
const unitPrice = this.unitPrice !== null ? (0, amount_1.floatToString)(this.unitPrice) : "";
|
|
46
|
-
const totalAmount = this.totalAmount !== null ? (0, amount_1.floatToString)(this.totalAmount) : "";
|
|
47
|
-
let tax = this.taxAmount !== null ? (0, amount_1.floatToString)(this.taxAmount) : "";
|
|
48
|
-
tax += this.taxRate !== null ? ` (${(0, amount_1.floatToString)(this.taxRate)}%)` : "";
|
|
49
|
-
let description = this.description ?? "";
|
|
50
|
-
if (description.length > 32) {
|
|
51
|
-
description = this.description.substring(0, 32) + "...";
|
|
52
|
-
}
|
|
53
|
-
return (productCode.padEnd(14) +
|
|
54
|
-
" | " +
|
|
55
|
-
quantity.padEnd(6) +
|
|
56
|
-
" | " +
|
|
57
|
-
unitPrice.padEnd(7) +
|
|
58
|
-
" | " +
|
|
59
|
-
totalAmount.padEnd(8) +
|
|
60
|
-
" | " +
|
|
61
|
-
tax.padEnd(16) +
|
|
62
|
-
" | " +
|
|
63
|
-
description);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.InvoiceLineItem = InvoiceLineItem;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
-
import { BaseField, Taxes, PaymentDetails, Locale, Amount, TextField, DateField, CompanyRegistration } from "../../fields";
|
|
3
|
-
export declare class InvoiceV3 extends Document {
|
|
4
|
-
#private;
|
|
5
|
-
/** Total amount with the tax amount of the purchase. */
|
|
6
|
-
locale: Locale;
|
|
7
|
-
/** The nature of the invoice. */
|
|
8
|
-
documentType: BaseField;
|
|
9
|
-
/** The total amount with tax included. Same as totalIncl. */
|
|
10
|
-
totalAmount: Amount;
|
|
11
|
-
/** The creation date of the invoice. */
|
|
12
|
-
date: DateField;
|
|
13
|
-
/** The due date of the invoice. */
|
|
14
|
-
dueDate: DateField;
|
|
15
|
-
/** The created time of the invoice */
|
|
16
|
-
time: TextField;
|
|
17
|
-
/** The total tax. */
|
|
18
|
-
totalTax: Amount;
|
|
19
|
-
/** The total amount without the tax value. Same as totalExcl. */
|
|
20
|
-
totalNet: Amount;
|
|
21
|
-
/** The supplier name. */
|
|
22
|
-
supplier: TextField;
|
|
23
|
-
/** The supplier address. */
|
|
24
|
-
supplierAddress: TextField;
|
|
25
|
-
/** The invoice number. */
|
|
26
|
-
invoiceNumber: TextField;
|
|
27
|
-
/** The company regitration information. */
|
|
28
|
-
companyRegistration: CompanyRegistration[];
|
|
29
|
-
/** The name of the customer. */
|
|
30
|
-
customerName: TextField;
|
|
31
|
-
/** The address of the customer. */
|
|
32
|
-
customerAddress: TextField;
|
|
33
|
-
/** The list of the taxes. */
|
|
34
|
-
taxes: Taxes;
|
|
35
|
-
/** The payment information. */
|
|
36
|
-
paymentDetails: PaymentDetails[];
|
|
37
|
-
/** The company registration information for the customer. */
|
|
38
|
-
customerCompanyRegistration: CompanyRegistration[];
|
|
39
|
-
/** The total amount without the tax value. */
|
|
40
|
-
get totalExcl(): Amount;
|
|
41
|
-
/** The total amount without the tax value. */
|
|
42
|
-
set totalExcl(value: Amount);
|
|
43
|
-
/** The total amount with tax included. */
|
|
44
|
-
get totalIncl(): Amount;
|
|
45
|
-
/** The total amount with tax included. */
|
|
46
|
-
set totalIncl(value: Amount);
|
|
47
|
-
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
48
|
-
toString(): string;
|
|
49
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _InvoiceV3_instances, _InvoiceV3_checklist, _InvoiceV3_reconstruct;
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.InvoiceV3 = void 0;
|
|
10
|
-
const document_1 = require("../document");
|
|
11
|
-
const fields_1 = require("../../fields");
|
|
12
|
-
const checks_1 = require("./checks");
|
|
13
|
-
const reconstruction_1 = require("./reconstruction");
|
|
14
|
-
class InvoiceV3 extends document_1.Document {
|
|
15
|
-
/** The total amount without the tax value. */
|
|
16
|
-
get totalExcl() {
|
|
17
|
-
return this.totalNet;
|
|
18
|
-
}
|
|
19
|
-
/** The total amount without the tax value. */
|
|
20
|
-
set totalExcl(value) {
|
|
21
|
-
this.totalNet = value;
|
|
22
|
-
}
|
|
23
|
-
/** The total amount with tax included. */
|
|
24
|
-
get totalIncl() {
|
|
25
|
-
return this.totalAmount;
|
|
26
|
-
}
|
|
27
|
-
/** The total amount with tax included. */
|
|
28
|
-
set totalIncl(value) {
|
|
29
|
-
this.totalAmount = value;
|
|
30
|
-
}
|
|
31
|
-
constructor({ prediction, orientation = undefined, extras = undefined, inputSource = undefined, fullText = undefined, pageId = undefined, }) {
|
|
32
|
-
super({
|
|
33
|
-
inputSource: inputSource,
|
|
34
|
-
pageId: pageId,
|
|
35
|
-
orientation: orientation,
|
|
36
|
-
fullText: fullText,
|
|
37
|
-
extras: extras,
|
|
38
|
-
});
|
|
39
|
-
_InvoiceV3_instances.add(this);
|
|
40
|
-
/** The company regitration information. */
|
|
41
|
-
this.companyRegistration = [];
|
|
42
|
-
/** The payment information. */
|
|
43
|
-
this.paymentDetails = [];
|
|
44
|
-
/** The company registration information for the customer. */
|
|
45
|
-
this.customerCompanyRegistration = [];
|
|
46
|
-
this.locale = new fields_1.Locale({
|
|
47
|
-
prediction: prediction.locale,
|
|
48
|
-
valueKey: "language",
|
|
49
|
-
});
|
|
50
|
-
this.documentType = new fields_1.BaseField({
|
|
51
|
-
prediction: prediction.document_type,
|
|
52
|
-
});
|
|
53
|
-
this.totalIncl = new fields_1.Amount({
|
|
54
|
-
prediction: prediction.total_incl,
|
|
55
|
-
pageId: pageId,
|
|
56
|
-
});
|
|
57
|
-
this.totalAmount = this.totalIncl;
|
|
58
|
-
this.totalTax = new fields_1.Amount({
|
|
59
|
-
prediction: { value: undefined, confidence: 0.0 },
|
|
60
|
-
pageId: pageId,
|
|
61
|
-
});
|
|
62
|
-
this.totalNet = new fields_1.Amount({
|
|
63
|
-
prediction: prediction.total_excl,
|
|
64
|
-
pageId: pageId,
|
|
65
|
-
});
|
|
66
|
-
this.date = new fields_1.DateField({
|
|
67
|
-
prediction: prediction.date,
|
|
68
|
-
pageId,
|
|
69
|
-
});
|
|
70
|
-
this.taxes = new fields_1.Taxes().init(prediction["taxes"], pageId);
|
|
71
|
-
this.companyRegistration = prediction.company_registration.map(function (prediction) {
|
|
72
|
-
return new fields_1.CompanyRegistration({
|
|
73
|
-
prediction: prediction,
|
|
74
|
-
pageId: pageId,
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
this.dueDate = new fields_1.DateField({
|
|
78
|
-
prediction: prediction.due_date,
|
|
79
|
-
pageId: pageId,
|
|
80
|
-
});
|
|
81
|
-
this.invoiceNumber = new fields_1.TextField({
|
|
82
|
-
prediction: prediction.invoice_number,
|
|
83
|
-
pageId: pageId,
|
|
84
|
-
});
|
|
85
|
-
this.supplier = new fields_1.TextField({
|
|
86
|
-
prediction: prediction.supplier,
|
|
87
|
-
pageId: pageId,
|
|
88
|
-
});
|
|
89
|
-
this.supplierAddress = new fields_1.TextField({
|
|
90
|
-
prediction: prediction.supplier_address,
|
|
91
|
-
pageId: pageId,
|
|
92
|
-
});
|
|
93
|
-
this.customerName = new fields_1.TextField({
|
|
94
|
-
prediction: prediction.customer,
|
|
95
|
-
pageId: pageId,
|
|
96
|
-
});
|
|
97
|
-
this.customerAddress = new fields_1.TextField({
|
|
98
|
-
prediction: prediction.customer_address,
|
|
99
|
-
pageId: pageId,
|
|
100
|
-
});
|
|
101
|
-
prediction.customer_company_registration.map((prediction) => this.customerCompanyRegistration.push(new fields_1.CompanyRegistration({
|
|
102
|
-
prediction: prediction,
|
|
103
|
-
pageId: pageId,
|
|
104
|
-
})));
|
|
105
|
-
prediction.payment_details.map((prediction) => this.paymentDetails.push(new fields_1.PaymentDetails({
|
|
106
|
-
prediction: prediction,
|
|
107
|
-
pageId: pageId,
|
|
108
|
-
})));
|
|
109
|
-
__classPrivateFieldGet(this, _InvoiceV3_instances, "m", _InvoiceV3_checklist).call(this);
|
|
110
|
-
__classPrivateFieldGet(this, _InvoiceV3_instances, "m", _InvoiceV3_reconstruct).call(this);
|
|
111
|
-
}
|
|
112
|
-
toString() {
|
|
113
|
-
const paymentDetails = this.paymentDetails
|
|
114
|
-
.map((item) => item.toString())
|
|
115
|
-
.join("\n ");
|
|
116
|
-
const customerCompanyRegistration = this.customerCompanyRegistration
|
|
117
|
-
.map((item) => item.toString())
|
|
118
|
-
.join("; ");
|
|
119
|
-
const companyRegistration = this.companyRegistration
|
|
120
|
-
.map((item) => item.toString())
|
|
121
|
-
.join("; ");
|
|
122
|
-
const outStr = `Invoice V3 Prediction
|
|
123
|
-
=====================
|
|
124
|
-
:Filename: ${this.filename}
|
|
125
|
-
:Invoice number: ${this.invoiceNumber}
|
|
126
|
-
:Total amount: ${this.totalIncl}
|
|
127
|
-
:Total net: ${this.totalExcl}
|
|
128
|
-
:Invoice date: ${this.date}
|
|
129
|
-
:Invoice due date: ${this.dueDate}
|
|
130
|
-
:Supplier name: ${this.supplier}
|
|
131
|
-
:Supplier address: ${this.supplierAddress}
|
|
132
|
-
:Customer name: ${this.customerName}
|
|
133
|
-
:Customer company registration: ${customerCompanyRegistration}
|
|
134
|
-
:Customer address: ${this.customerAddress}
|
|
135
|
-
:Payment details: ${paymentDetails}
|
|
136
|
-
:Company numbers: ${companyRegistration}
|
|
137
|
-
:Taxes: ${this.taxes}
|
|
138
|
-
:Total tax: ${this.totalTax}
|
|
139
|
-
:Locale: ${this.locale}
|
|
140
|
-
`;
|
|
141
|
-
return InvoiceV3.cleanOutString(outStr);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.InvoiceV3 = InvoiceV3;
|
|
145
|
-
_InvoiceV3_instances = new WeakSet(), _InvoiceV3_checklist = function _InvoiceV3_checklist() {
|
|
146
|
-
this.checklist = {
|
|
147
|
-
taxesMatchTotalIncl: (0, checks_1.taxesMatchTotalIncl)(this),
|
|
148
|
-
taxesMatchTotalExcl: (0, checks_1.taxesMatchTotalExcl)(this),
|
|
149
|
-
taxesAndTotalExclMatchTotalIncl: (0, checks_1.taxesAndTotalExclMatchTotalIncl)(this),
|
|
150
|
-
};
|
|
151
|
-
}, _InvoiceV3_reconstruct = function _InvoiceV3_reconstruct() {
|
|
152
|
-
(0, reconstruction_1.reconstructTotalTax)(this);
|
|
153
|
-
(0, reconstruction_1.reconstructTotalExcl)(this);
|
|
154
|
-
(0, reconstruction_1.reconstructTotalIncl)(this);
|
|
155
|
-
(0, reconstruction_1.reconstructTotalTaxFromTotals)(this);
|
|
156
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Document, DocumentConstructorProps } from "../document";
|
|
2
|
-
import { ClassificationField, Taxes, PaymentDetails, Locale, Amount, TextField, DateField, CompanyRegistration } from "../../fields";
|
|
3
|
-
import { InvoiceLineItem } from "./invoiceLineItem";
|
|
4
|
-
/** Invoice V4 */
|
|
5
|
-
export declare class InvoiceV4 extends Document {
|
|
6
|
-
#private;
|
|
7
|
-
/** Locale information. */
|
|
8
|
-
locale: Locale;
|
|
9
|
-
/** The nature of the invoice. */
|
|
10
|
-
documentType: ClassificationField;
|
|
11
|
-
/** List of Reference numbers including PO number. */
|
|
12
|
-
referenceNumbers: TextField[];
|
|
13
|
-
/** The total amount with tax included. */
|
|
14
|
-
totalAmount: Amount;
|
|
15
|
-
/** The creation date of the invoice. */
|
|
16
|
-
date: DateField;
|
|
17
|
-
/** The due date of the invoice. */
|
|
18
|
-
dueDate: DateField;
|
|
19
|
-
/** The total tax. */
|
|
20
|
-
totalTax: Amount;
|
|
21
|
-
/** The total amount without the tax value. */
|
|
22
|
-
totalNet: Amount;
|
|
23
|
-
/** The supplier name. */
|
|
24
|
-
supplierName: TextField;
|
|
25
|
-
/** The supplier address. */
|
|
26
|
-
supplierAddress: TextField;
|
|
27
|
-
/** The payment information. */
|
|
28
|
-
supplierPaymentDetails: PaymentDetails[];
|
|
29
|
-
/** The supplier company regitration information. */
|
|
30
|
-
supplierCompanyRegistrations: CompanyRegistration[];
|
|
31
|
-
/** The invoice number. */
|
|
32
|
-
invoiceNumber: TextField;
|
|
33
|
-
/** The name of the customer. */
|
|
34
|
-
customerName: TextField;
|
|
35
|
-
/** The address of the customer. */
|
|
36
|
-
customerAddress: TextField;
|
|
37
|
-
/** The company registration information for the customer. */
|
|
38
|
-
customerCompanyRegistrations: CompanyRegistration[];
|
|
39
|
-
/** The list of the taxes. */
|
|
40
|
-
taxes: Taxes;
|
|
41
|
-
/** Line items details. */
|
|
42
|
-
lineItems: InvoiceLineItem[];
|
|
43
|
-
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps);
|
|
44
|
-
toString(): string;
|
|
45
|
-
}
|