Comparing version 3.8.0 to 3.9.0
# CHANGELOG | ||
## v3.9.0 - 2023-06-06 | ||
### Changes | ||
* :sparkles: support for financial document v1.1 | ||
* :recycle: change http status code handling for async requests | ||
### Fixes | ||
* :bug: fix typing in PaymentDetails | ||
* :bug: locale value should always be set | ||
* :bug: add missing class properties on new line items | ||
## v3.8.0 - 2023-05-25 | ||
@@ -4,0 +15,0 @@ ### Changes |
{ | ||
"name": "mindee", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "Mindee Client Library for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -30,3 +30,3 @@ "use strict"; | ||
const statusCode = response.messageObj.statusCode; | ||
if (statusCode === undefined || statusCode >= 202) { | ||
if (statusCode === undefined || statusCode >= 300) { | ||
this.handleError(response, statusCode); | ||
@@ -42,3 +42,3 @@ } | ||
queueStatusCode < 200 || | ||
queueStatusCode > 302) { | ||
queueStatusCode >= 400) { | ||
this.handleError(queueResponse, queueStatusCode); | ||
@@ -45,0 +45,0 @@ } |
import { Document, DocumentConstructorProps } from "../document"; | ||
import { TaxField, PaymentDetails, Locale, Amount, TextField, DateField, CompanyRegistration, BaseField } from "../../fields"; | ||
import { InvoiceLineItem } from "../invoice/invoiceLineItem"; | ||
import { Amount, ClassificationField, CompanyRegistration, DateField, Locale, PaymentDetails, TaxField, TextField } from "../../fields"; | ||
import { FinancialDocumentV1LineItem } from "./financialDocumentV1LineItem"; | ||
/** | ||
* Financial Document. | ||
* Document data for Financial Document, API version 1. | ||
*/ | ||
export declare class FinancialDocumentV1 extends Document { | ||
/** Locale information. */ | ||
#private; | ||
/** The locale detected on the document. */ | ||
locale: Locale; | ||
/** The nature of the document. */ | ||
documentType: BaseField; | ||
/** List of Reference numbers including PO number. */ | ||
/** The invoice number or identifier. */ | ||
invoiceNumber: TextField; | ||
/** List of Reference numbers, including PO number. */ | ||
referenceNumbers: TextField[]; | ||
/** The creation date of the invoice or the purchase date. */ | ||
/** The date the purchase was made. */ | ||
date: DateField; | ||
/** The due date of the invoice. */ | ||
/** The date on which the payment is due. */ | ||
dueDate: DateField; | ||
/** The supplier name. */ | ||
/** The net amount paid: does not include taxes, fees, and discounts. */ | ||
totalNet: Amount; | ||
/** The total amount paid: includes taxes, tips, fees, and other charges. */ | ||
totalAmount: Amount; | ||
/** List of tax lines information. */ | ||
taxes: TaxField[]; | ||
/** List of payment details associated to the supplier. */ | ||
supplierPaymentDetails: PaymentDetails[]; | ||
/** The name of the supplier or merchant. */ | ||
supplierName: TextField; | ||
/** The supplier address. */ | ||
/** List of company registrations associated to the supplier. */ | ||
supplierCompanyRegistrations: CompanyRegistration[]; | ||
/** The address of the supplier or merchant. */ | ||
supplierAddress: TextField; | ||
/** The payment information. */ | ||
supplierPaymentDetails: PaymentDetails[]; | ||
/** The supplier company registration information. */ | ||
supplierCompanyRegistrations: CompanyRegistration[]; | ||
/** The invoice number. */ | ||
invoiceNumber: TextField; | ||
/** The phone number of the supplier or merchant. */ | ||
supplierPhoneNumber: TextField; | ||
/** The name of the customer. */ | ||
customerName: TextField; | ||
/** List of company registrations associated to the customer. */ | ||
customerCompanyRegistrations: CompanyRegistration[]; | ||
/** The address of the customer. */ | ||
customerAddress: TextField; | ||
/** The company registration information for the customer. */ | ||
customerCompanyRegistrations: CompanyRegistration[]; | ||
/** The list of the taxes. */ | ||
taxes: TaxField[]; | ||
/** Line items details. */ | ||
lineItems: InvoiceLineItem[]; | ||
/** The receipt category among predefined classes. */ | ||
category: TextField; | ||
/** The receipt sub-category among predefined classes. */ | ||
subCategory: TextField; | ||
/** Time as seen on the receipt in HH:MM format. */ | ||
/** One of: 'INVOICE', 'CREDIT NOTE', 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'. */ | ||
documentType: ClassificationField; | ||
/** The purchase subcategory among predefined classes for transport and food. */ | ||
subcategory: ClassificationField; | ||
/** The purchase category among predefined classes. */ | ||
category: ClassificationField; | ||
/** The total amount of taxes. */ | ||
totalTax: Amount; | ||
/** The total amount of tip and gratuity */ | ||
tip: Amount; | ||
/** The time the purchase was made. */ | ||
time: TextField; | ||
/** Total amount of tip and gratuity. */ | ||
tip: Amount; | ||
/** total spent including taxes, discounts, fees, tips, and gratuity. */ | ||
totalAmount: Amount; | ||
/** Total amount of the purchase excluding taxes. */ | ||
totalNet: Amount; | ||
/** Total tax amount of the purchase. */ | ||
totalTax: Amount; | ||
/** List of line item details. */ | ||
lineItems: FinancialDocumentV1LineItem[]; | ||
constructor({ prediction, orientation, extras, inputSource, fullText, pageId, }: DocumentConstructorProps); | ||
toString(): string; | ||
} |
"use strict"; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
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"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _FinancialDocumentV1_instances, _FinancialDocumentV1_lineItemsSeparator, _FinancialDocumentV1_lineItemsToString; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,5 +12,5 @@ exports.FinancialDocumentV1 = void 0; | ||
const fields_1 = require("../../fields"); | ||
const invoiceLineItem_1 = require("../invoice/invoiceLineItem"); | ||
const financialDocumentV1LineItem_1 = require("./financialDocumentV1LineItem"); | ||
/** | ||
* Financial Document. | ||
* Document data for Financial Document, API version 1. | ||
*/ | ||
@@ -17,103 +23,102 @@ class FinancialDocumentV1 extends document_1.Document { | ||
orientation: orientation, | ||
extras: extras, | ||
fullText: fullText, | ||
extras: extras, | ||
}); | ||
/** List of Reference numbers including PO number. */ | ||
_FinancialDocumentV1_instances.add(this); | ||
/** List of Reference numbers, including PO number. */ | ||
this.referenceNumbers = []; | ||
/** The payment information. */ | ||
/** List of payment details associated to the supplier. */ | ||
this.supplierPaymentDetails = []; | ||
/** The supplier company registration information. */ | ||
/** List of company registrations associated to the supplier. */ | ||
this.supplierCompanyRegistrations = []; | ||
/** The company registration information for the customer. */ | ||
/** List of company registrations associated to the customer. */ | ||
this.customerCompanyRegistrations = []; | ||
/** Line items details. */ | ||
/** List of line item details. */ | ||
this.lineItems = []; | ||
this.locale = new fields_1.Locale({ | ||
prediction: prediction.locale, | ||
prediction: prediction["locale"], | ||
valueKey: "language", | ||
}); | ||
this.documentType = new fields_1.ClassificationField({ | ||
prediction: prediction.document_type, | ||
this.invoiceNumber = new fields_1.TextField({ | ||
prediction: prediction["invoice_number"], | ||
pageId: pageId, | ||
}); | ||
this.referenceNumbers = prediction.reference_numbers.map(function (prediction) { | ||
return new fields_1.TextField({ | ||
prediction: prediction, | ||
pageId: pageId, | ||
}); | ||
}); | ||
this.totalAmount = new fields_1.Amount({ | ||
prediction: prediction.total_amount, | ||
prediction["reference_numbers"].map((itemPrediction) => this.referenceNumbers.push(new fields_1.TextField({ | ||
prediction: itemPrediction, | ||
pageId: pageId, | ||
}))); | ||
this.date = new fields_1.DateField({ | ||
prediction: prediction["date"], | ||
pageId: pageId, | ||
}); | ||
this.totalTax = new fields_1.Amount({ | ||
prediction: prediction.total_tax, | ||
this.dueDate = new fields_1.DateField({ | ||
prediction: prediction["due_date"], | ||
pageId: pageId, | ||
}); | ||
this.totalNet = new fields_1.Amount({ | ||
prediction: prediction.total_net, | ||
prediction: prediction["total_net"], | ||
pageId: pageId, | ||
}); | ||
this.date = new fields_1.DateField({ | ||
prediction: prediction.date, | ||
pageId, | ||
}); | ||
this.dueDate = new fields_1.DateField({ | ||
prediction: prediction.due_date, | ||
this.totalAmount = new fields_1.Amount({ | ||
prediction: prediction["total_amount"], | ||
pageId: pageId, | ||
}); | ||
this.invoiceNumber = new fields_1.TextField({ | ||
prediction: prediction.invoice_number, | ||
this.taxes = new fields_1.Taxes().init(prediction["taxes"], pageId); | ||
prediction["supplier_payment_details"].map((itemPrediction) => this.supplierPaymentDetails.push(new fields_1.PaymentDetails({ | ||
prediction: itemPrediction, | ||
pageId: pageId, | ||
}); | ||
}))); | ||
this.supplierName = new fields_1.TextField({ | ||
prediction: prediction.supplier_name, | ||
prediction: prediction["supplier_name"], | ||
pageId: pageId, | ||
}); | ||
prediction["supplier_company_registrations"].map((itemPrediction) => this.supplierCompanyRegistrations.push(new fields_1.CompanyRegistration({ | ||
prediction: itemPrediction, | ||
pageId: pageId, | ||
}))); | ||
this.supplierAddress = new fields_1.TextField({ | ||
prediction: prediction.supplier_address, | ||
prediction: prediction["supplier_address"], | ||
pageId: pageId, | ||
}); | ||
this.supplierCompanyRegistrations = | ||
prediction.supplier_company_registrations.map(function (prediction) { | ||
return new fields_1.CompanyRegistration({ | ||
prediction: prediction, | ||
pageId: pageId, | ||
}); | ||
}); | ||
this.customerName = new fields_1.TextField({ | ||
prediction: prediction.customer_name, | ||
this.supplierPhoneNumber = new fields_1.TextField({ | ||
prediction: prediction["supplier_phone_number"], | ||
pageId: pageId, | ||
}); | ||
this.customerAddress = new fields_1.TextField({ | ||
prediction: prediction.customer_address, | ||
this.customerName = new fields_1.TextField({ | ||
prediction: prediction["customer_name"], | ||
pageId: pageId, | ||
}); | ||
prediction.customer_company_registrations.map((prediction) => this.customerCompanyRegistrations.push(new fields_1.CompanyRegistration({ | ||
prediction: prediction, | ||
prediction["customer_company_registrations"].map((itemPrediction) => this.customerCompanyRegistrations.push(new fields_1.CompanyRegistration({ | ||
prediction: itemPrediction, | ||
pageId: pageId, | ||
}))); | ||
prediction.supplier_payment_details.map((prediction) => this.supplierPaymentDetails.push(new fields_1.PaymentDetails({ | ||
prediction: prediction, | ||
this.customerAddress = new fields_1.TextField({ | ||
prediction: prediction["customer_address"], | ||
pageId: pageId, | ||
}))); | ||
prediction.line_items.map((prediction) => this.lineItems.push(new invoiceLineItem_1.InvoiceLineItem({ | ||
prediction: prediction, | ||
}))); | ||
this.tip = new fields_1.Amount({ | ||
prediction: prediction.tip, | ||
pageId: pageId, | ||
}); | ||
this.category = new fields_1.TextField({ | ||
prediction: prediction.category, | ||
this.documentType = new fields_1.ClassificationField({ | ||
prediction: prediction["document_type"], | ||
}); | ||
this.subcategory = new fields_1.ClassificationField({ | ||
prediction: prediction["subcategory"], | ||
}); | ||
this.category = new fields_1.ClassificationField({ | ||
prediction: prediction["category"], | ||
}); | ||
this.totalTax = new fields_1.Amount({ | ||
prediction: prediction["total_tax"], | ||
pageId: pageId, | ||
}); | ||
this.subCategory = new fields_1.TextField({ | ||
prediction: prediction.subcategory, | ||
this.tip = new fields_1.Amount({ | ||
prediction: prediction["tip"], | ||
pageId: pageId, | ||
}); | ||
this.time = new fields_1.TextField({ | ||
prediction: prediction.time, | ||
prediction: prediction["time"], | ||
pageId: pageId, | ||
}); | ||
this.taxes = new fields_1.Taxes().init(prediction["taxes"], pageId); | ||
prediction["line_items"].map((itemPrediction) => this.lineItems.push(new financialDocumentV1LineItem_1.FinancialDocumentV1LineItem({ | ||
prediction: itemPrediction, | ||
pageId: pageId, | ||
}))); | ||
} | ||
@@ -124,42 +129,37 @@ toString() { | ||
.join(", "); | ||
const paymentDetails = this.supplierPaymentDetails | ||
const supplierPaymentDetails = this.supplierPaymentDetails | ||
.map((item) => item.toString()) | ||
.join("\n "); | ||
const customerCompanyRegistration = this.customerCompanyRegistrations | ||
const customerCompanyRegistrations = this.customerCompanyRegistrations | ||
.map((item) => item.toString()) | ||
.join("; "); | ||
const supplierCompanyRegistration = this.supplierCompanyRegistrations | ||
const supplierCompanyRegistrations = this.supplierCompanyRegistrations | ||
.map((item) => item.toString()) | ||
.join("; "); | ||
let lineItems = ""; | ||
if (this.lineItems.length > 0) { | ||
lineItems = | ||
"\n Code | QTY | Price | Amount | Tax (Rate) | Description\n "; | ||
lineItems += this.lineItems.map((item) => item.toString()).join("\n "); | ||
} | ||
const outStr = `Financial Document V1 Prediction | ||
================================ | ||
:Filename: ${this.filename} | ||
:Document type: ${this.documentType} | ||
:Category: ${this.category} | ||
:Subcategory: ${this.subCategory} | ||
:Locale: ${this.locale} | ||
:Invoice number: ${this.invoiceNumber} | ||
:Reference numbers: ${referenceNumbers} | ||
:Date: ${this.date} | ||
:Due date: ${this.dueDate} | ||
:Time: ${this.time} | ||
:Invoice Number: ${this.invoiceNumber} | ||
:Reference Numbers: ${referenceNumbers} | ||
:Purchase Date: ${this.date} | ||
:Due Date: ${this.dueDate} | ||
:Total Net: ${this.totalNet} | ||
:Total Amount: ${this.totalAmount} | ||
:Taxes: ${this.taxes} | ||
:Supplier Payment Details: ${supplierPaymentDetails} | ||
:Supplier name: ${this.supplierName} | ||
:Supplier address: ${this.supplierAddress} | ||
:Supplier company registrations: ${supplierCompanyRegistration} | ||
:Supplier payment details: ${paymentDetails} | ||
:Supplier Company Registrations: ${customerCompanyRegistrations} | ||
:Supplier Address: ${this.supplierAddress} | ||
:Supplier Phone Number: ${this.supplierPhoneNumber} | ||
:Customer name: ${this.customerName} | ||
:Customer address: ${this.customerAddress} | ||
:Customer company registrations: ${customerCompanyRegistration} | ||
:Tip: ${this.tip} | ||
:Taxes: ${this.taxes} | ||
:Total tax: ${this.totalTax} | ||
:Total net: ${this.totalNet} | ||
:Total amount: ${this.totalAmount} | ||
:Line Items: ${lineItems} | ||
:Customer Company Registrations: ${supplierCompanyRegistrations} | ||
:Customer Address: ${this.customerAddress} | ||
:Document Type: ${this.documentType} | ||
:Purchase Subcategory: ${this.subcategory} | ||
:Purchase Category: ${this.category} | ||
:Total Tax: ${this.totalTax} | ||
:Tip and Gratuity: ${this.tip} | ||
:Purchase Time: ${this.time} | ||
:Line Items: ${__classPrivateFieldGet(this, _FinancialDocumentV1_instances, "m", _FinancialDocumentV1_lineItemsToString).call(this)} | ||
`; | ||
@@ -170,1 +170,32 @@ return FinancialDocumentV1.cleanOutString(outStr); | ||
exports.FinancialDocumentV1 = FinancialDocumentV1; | ||
_FinancialDocumentV1_instances = new WeakSet(), _FinancialDocumentV1_lineItemsSeparator = function _FinancialDocumentV1_lineItemsSeparator(char) { | ||
let outStr = " "; | ||
outStr += `+${char.repeat(38)}`; | ||
outStr += `+${char.repeat(14)}`; | ||
outStr += `+${char.repeat(10)}`; | ||
outStr += `+${char.repeat(12)}`; | ||
outStr += `+${char.repeat(14)}`; | ||
outStr += `+${char.repeat(14)}`; | ||
outStr += `+${char.repeat(12)}`; | ||
return outStr + "+"; | ||
}, _FinancialDocumentV1_lineItemsToString = function _FinancialDocumentV1_lineItemsToString() { | ||
if (this.lineItems.length === 0) { | ||
return ""; | ||
} | ||
const lines = this.lineItems | ||
.map((item) => item.toTableLine()) | ||
.join(`\n${__classPrivateFieldGet(this, _FinancialDocumentV1_instances, "m", _FinancialDocumentV1_lineItemsSeparator).call(this, "-")}\n `); | ||
let outStr = ""; | ||
outStr += `\n${__classPrivateFieldGet(this, _FinancialDocumentV1_instances, "m", _FinancialDocumentV1_lineItemsSeparator).call(this, "-")}\n `; | ||
outStr += " | Description "; | ||
outStr += " | Product code"; | ||
outStr += " | Quantity"; | ||
outStr += " | Tax Amount"; | ||
outStr += " | Tax Rate (%)"; | ||
outStr += " | Total Amount"; | ||
outStr += " | Unit Price"; | ||
outStr += ` |\n${__classPrivateFieldGet(this, _FinancialDocumentV1_instances, "m", _FinancialDocumentV1_lineItemsSeparator).call(this, "=")}`; | ||
outStr += `\n ${lines}`; | ||
outStr += `\n${__classPrivateFieldGet(this, _FinancialDocumentV1_instances, "m", _FinancialDocumentV1_lineItemsSeparator).call(this, "-")}`; | ||
return outStr; | ||
}; |
@@ -89,2 +89,5 @@ "use strict"; | ||
toString() { | ||
const supplierCompanyRegistrations = this.supplierCompanyRegistrations | ||
.map((item) => item.toString()) | ||
.join("; "); | ||
const outStr = `Receipt V5 Prediction | ||
@@ -105,3 +108,3 @@ ===================== | ||
:Supplier Name: ${this.supplierName} | ||
:Supplier Company Registrations: ${this.supplierCompanyRegistrations.join(`\n ${" ".repeat(32)}`)} | ||
:Supplier Company Registrations: ${supplierCompanyRegistrations} | ||
:Supplier Address: ${this.supplierAddress} | ||
@@ -123,13 +126,15 @@ :Supplier Phone Number: ${this.supplierPhoneNumber} | ||
}, _ReceiptV5_lineItemsToString = function _ReceiptV5_lineItemsToString() { | ||
if (!this.lineItems) { | ||
if (this.lineItems.length === 0) { | ||
return ""; | ||
} | ||
const lines = this.lineItems | ||
.map((item) => `${item}`) | ||
.map((item) => item.toTableLine()) | ||
.join(`\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "-")}\n `); | ||
let outStr = ""; | ||
outStr += `\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "-")}`; | ||
outStr += | ||
"\n | Description | Quantity | Total Amount | Unit Price |"; | ||
outStr += `\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "=")}`; | ||
outStr += `\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "-")}\n `; | ||
outStr += " | Description "; | ||
outStr += " | Quantity"; | ||
outStr += " | Total Amount"; | ||
outStr += " | Unit Price"; | ||
outStr += ` |\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "=")}`; | ||
outStr += `\n ${lines}`; | ||
@@ -136,0 +141,0 @@ outStr += `\n${__classPrivateFieldGet(this, _ReceiptV5_instances, "m", _ReceiptV5_lineItemsSeparator).call(this, "-")}`; |
import { StringDict } from "../../fields"; | ||
import { Polygon } from "../../geometry"; | ||
/** | ||
@@ -6,2 +7,3 @@ * Full extraction of lines, including: description, quantity, unit price and total. | ||
export declare class ReceiptV5LineItem { | ||
#private; | ||
/** The item description. */ | ||
@@ -15,4 +17,20 @@ description: string | null; | ||
unitPrice: number | null; | ||
/** Confidence score */ | ||
confidence: number; | ||
/** The document page on which the information was found. */ | ||
pageId: number; | ||
/** | ||
* Contains the relative vertices coordinates (points) of a polygon containing | ||
* the field in the document. | ||
*/ | ||
polygon: Polygon; | ||
constructor({ prediction }: StringDict); | ||
/** | ||
* Default string representation. | ||
*/ | ||
toString(): string; | ||
/** | ||
* Output in a format suitable for inclusion in an rST table. | ||
*/ | ||
toTableLine(): string; | ||
} |
"use strict"; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
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"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _ReceiptV5LineItem_instances, _ReceiptV5LineItem_printableValues; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -10,2 +16,10 @@ exports.ReceiptV5LineItem = void 0; | ||
constructor({ prediction }) { | ||
_ReceiptV5LineItem_instances.add(this); | ||
/** Confidence score */ | ||
this.confidence = 0.0; | ||
/** | ||
* Contains the relative vertices coordinates (points) of a polygon containing | ||
* the field in the document. | ||
*/ | ||
this.polygon = []; | ||
this.description = prediction["description"]; | ||
@@ -24,16 +38,35 @@ this.quantity = +parseFloat(prediction["quantity"]).toFixed(3); | ||
} | ||
this.pageId = prediction["page_id"]; | ||
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0; | ||
if (prediction["polygon"]) { | ||
this.polygon = prediction.polygon; | ||
} | ||
} | ||
/** | ||
* Default string representation. | ||
*/ | ||
toString() { | ||
const description = this.description ?? ""; | ||
const quantity = this.quantity !== null ? (0, amount_1.floatToString)(this.quantity) : ""; | ||
const totalAmount = this.totalAmount !== null ? (0, amount_1.floatToString)(this.totalAmount) : ""; | ||
const unitPrice = this.unitPrice !== null ? (0, amount_1.floatToString)(this.unitPrice) : ""; | ||
const printable = __classPrivateFieldGet(this, _ReceiptV5LineItem_instances, "m", _ReceiptV5LineItem_printableValues).call(this); | ||
return ("Description: " + | ||
printable.description + | ||
"Quantity: " + | ||
printable.quantity + | ||
"Total Amount: " + | ||
printable.totalAmount + | ||
"Unit Price: " + | ||
printable.unitPrice).trim(); | ||
} | ||
/** | ||
* Output in a format suitable for inclusion in an rST table. | ||
*/ | ||
toTableLine() { | ||
const printable = __classPrivateFieldGet(this, _ReceiptV5LineItem_instances, "m", _ReceiptV5LineItem_printableValues).call(this); | ||
return ("| " + | ||
description.padEnd(36) + | ||
printable.description.padEnd(36) + | ||
" | " + | ||
quantity.padEnd(8) + | ||
printable.quantity.padEnd(8) + | ||
" | " + | ||
totalAmount.padEnd(12) + | ||
printable.totalAmount.padEnd(12) + | ||
" | " + | ||
unitPrice.padEnd(10) + | ||
printable.unitPrice.padEnd(10) + | ||
" |"); | ||
@@ -43,1 +76,9 @@ } | ||
exports.ReceiptV5LineItem = ReceiptV5LineItem; | ||
_ReceiptV5LineItem_instances = new WeakSet(), _ReceiptV5LineItem_printableValues = function _ReceiptV5LineItem_printableValues() { | ||
return { | ||
description: this.description ?? "", | ||
quantity: this.quantity !== null ? (0, amount_1.floatToString)(this.quantity) : "", | ||
totalAmount: this.totalAmount !== null ? (0, amount_1.floatToString)(this.totalAmount) : "", | ||
unitPrice: this.unitPrice !== null ? (0, amount_1.floatToString)(this.unitPrice) : "", | ||
}; | ||
}; |
@@ -18,4 +18,4 @@ import { BaseField, BaseFieldConstructor } from "./base"; | ||
*/ | ||
constructor({ prediction, reconstructed, valueKey, }: BaseFieldConstructor); | ||
constructor({ prediction, reconstructed }: BaseFieldConstructor); | ||
toString(): string; | ||
} |
@@ -11,3 +11,4 @@ "use strict"; | ||
*/ | ||
constructor({ prediction, reconstructed = false, valueKey = "value", }) { | ||
constructor({ prediction, reconstructed = false }) { | ||
const valueKey = prediction.value !== undefined ? "value" : "language"; | ||
super({ prediction, valueKey, reconstructed }); | ||
@@ -14,0 +15,0 @@ this.confidence = prediction.confidence ? prediction.confidence : 0.0; |
@@ -18,9 +18,9 @@ import { StringDict } from "./base"; | ||
/** The account number. */ | ||
accountNumber: number | undefined; | ||
/** The account IBAN. */ | ||
accountNumber: string | undefined; | ||
/** The International Bank Account Number (IBAN). */ | ||
iban: string | undefined; | ||
/** The routing number. */ | ||
routingNumber: number | undefined; | ||
/** The SWIFT value. */ | ||
swift: number | undefined; | ||
routingNumber: string | undefined; | ||
/** The bank's SWIFT Business Identifier Code (BIC). */ | ||
swift: string | undefined; | ||
/** | ||
@@ -27,0 +27,0 @@ * @param {Object} prediction - Prediction object from HTTP response |
@@ -12,2 +12,5 @@ import { StringDict } from "./base"; | ||
} | ||
/** | ||
* Represent a single tax line. | ||
*/ | ||
export declare class TaxField extends Field { | ||
@@ -35,5 +38,14 @@ #private; | ||
constructor({ prediction, valueKey, rateKey, codeKey, baseKey, reconstructed, pageId, }: TaxConstructor); | ||
/** | ||
* Output in a format suitable for inclusion in an rST table. | ||
*/ | ||
toTableLine(): string; | ||
/** | ||
* Default string representation. | ||
*/ | ||
toString(): string; | ||
} | ||
/** | ||
* Represent all items. | ||
*/ | ||
export declare class Taxes extends Array<TaxField> { | ||
@@ -40,0 +52,0 @@ #private; |
@@ -12,2 +12,5 @@ "use strict"; | ||
const amount_1 = require("./amount"); | ||
/** | ||
* Represent a single tax line. | ||
*/ | ||
class TaxField extends field_1.Field { | ||
@@ -50,2 +53,5 @@ /** | ||
} | ||
/** | ||
* Output in a format suitable for inclusion in an rST table. | ||
*/ | ||
toTableLine() { | ||
@@ -63,2 +69,5 @@ const printable = __classPrivateFieldGet(this, _TaxField_instances, "m", _TaxField_printableValues).call(this); | ||
} | ||
/** | ||
* Default string representation. | ||
*/ | ||
toString() { | ||
@@ -85,2 +94,5 @@ const printable = __classPrivateFieldGet(this, _TaxField_instances, "m", _TaxField_printableValues).call(this); | ||
}; | ||
/** | ||
* Represent all items. | ||
*/ | ||
class Taxes extends Array { | ||
@@ -87,0 +99,0 @@ constructor() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
271986
138
6458