diff --git a/docs/Docs/Receipt.md b/docs/Docs/Receipt.md index 7a58f46..46620ca 100644 --- a/docs/Docs/Receipt.md +++ b/docs/Docs/Receipt.md @@ -148,6 +148,8 @@ export class ReceiptItem { this.mailboxMonths = 0; this.category = ""; // merch category this.electronicReturnReceipt = false; + this.isStamp = false; + this.extraData = {}; } static fromJSON(obj) { @@ -168,6 +170,8 @@ export class ReceiptItem { item.service = obj.service ?? null; item.category = obj.category ?? ""; item.electronicReturnReceipt = obj.electronicReturnReceipt ?? false; + item.isStamp = obj.isStamp ?? false; + item.extraData = obj.extraData ?? {}; return item; } @@ -197,9 +201,22 @@ export class ReceiptItem { carrier: this.carrier, service: this.service, category: this.category, - electronicReturnReceipt: this.electronicReturnReceipt + electronicReturnReceipt: this.electronicReturnReceipt, + isStamp: this.isStamp, + extraData: this.extraData }; } + + setExtra(key, val) { + this.extraData[key] = val; + } + + getExtra(key) { + if (typeof this.extraData[key] != "undefined") { + return this.extraData[key]; + } + return null; + } get text() { if (typeof this.txt == "string") { @@ -332,11 +349,13 @@ export class ReceiptPayment { this.text = (typeof text != "string" ? "" : text); this.type = type; this.amount = amount; + this.extraData = {}; } static fromJSON(obj) { var item = new ReceiptPayment(obj.amount, obj.type, obj.text); item.id = obj.id; + item.extraData = obj.extraData ?? {}; return item; } @@ -345,9 +364,21 @@ export class ReceiptPayment { amount: round(this.amount, 2), type: this.type, text: this.text, - id: this.id + id: this.id, + extraData: this.extraData ?? {} }; } + + setExtra(key, val) { + this.extraData[key] = val; + } + + getExtra(key) { + if (typeof this.extraData[key] != "undefined") { + return this.extraData[key]; + } + return null; + } get texthtml() { if (typeof this.text != "string") { @@ -390,4 +421,4 @@ export class ReceiptPayment { } } } -``` \ No newline at end of file +```