UNPKG

mindee

Version:

Mindee Client Library for Node.js

54 lines (53 loc) 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BankCheckV1Document = void 0; const common_1 = require("../../../parsing/common"); const standard_1 = require("../../../parsing/standard"); /** * Bank Check API version 1.1 document data. */ class BankCheckV1Document { constructor(rawPrediction, pageId) { /** List of the check's payees (recipients). */ this.payees = []; this.accountNumber = new standard_1.StringField({ prediction: rawPrediction["account_number"], pageId: pageId, }); this.amount = new standard_1.AmountField({ prediction: rawPrediction["amount"], pageId: pageId, }); this.checkNumber = new standard_1.StringField({ prediction: rawPrediction["check_number"], pageId: pageId, }); this.date = new standard_1.DateField({ prediction: rawPrediction["date"], pageId: pageId, }); rawPrediction["payees"] && rawPrediction["payees"].map((itemPrediction) => this.payees.push(new standard_1.StringField({ prediction: itemPrediction, pageId: pageId, }))); this.routingNumber = new standard_1.StringField({ prediction: rawPrediction["routing_number"], pageId: pageId, }); } /** * Default string representation. */ toString() { const payees = this.payees.join("\n "); const outStr = `:Check Issue Date: ${this.date} :Amount: ${this.amount} :Payees: ${payees} :Routing Number: ${this.routingNumber} :Account Number: ${this.accountNumber} :Check Number: ${this.checkNumber}`.trimEnd(); return (0, common_1.cleanOutString)(outStr); } } exports.BankCheckV1Document = BankCheckV1Document;