Add recent additions to ReceiptItem and ReceiptPayment
All checks were successful
Build and Deploy MkDocs / build-next (push) Successful in 47s
All checks were successful
Build and Deploy MkDocs / build-next (push) Successful in 47s
This commit is contained in:
parent
a36ece7fa6
commit
329ffa126d
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user