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.mailboxMonths = 0;
|
||||||
this.category = ""; // merch category
|
this.category = ""; // merch category
|
||||||
this.electronicReturnReceipt = false;
|
this.electronicReturnReceipt = false;
|
||||||
|
this.isStamp = false;
|
||||||
|
this.extraData = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJSON(obj) {
|
static fromJSON(obj) {
|
||||||
@ -168,6 +170,8 @@ export class ReceiptItem {
|
|||||||
item.service = obj.service ?? null;
|
item.service = obj.service ?? null;
|
||||||
item.category = obj.category ?? "";
|
item.category = obj.category ?? "";
|
||||||
item.electronicReturnReceipt = obj.electronicReturnReceipt ?? false;
|
item.electronicReturnReceipt = obj.electronicReturnReceipt ?? false;
|
||||||
|
item.isStamp = obj.isStamp ?? false;
|
||||||
|
item.extraData = obj.extraData ?? {};
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,10 +201,23 @@ export class ReceiptItem {
|
|||||||
carrier: this.carrier,
|
carrier: this.carrier,
|
||||||
service: this.service,
|
service: this.service,
|
||||||
category: this.category,
|
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() {
|
get text() {
|
||||||
if (typeof this.txt == "string") {
|
if (typeof this.txt == "string") {
|
||||||
return this.txt;
|
return this.txt;
|
||||||
@ -332,11 +349,13 @@ export class ReceiptPayment {
|
|||||||
this.text = (typeof text != "string" ? "" : text);
|
this.text = (typeof text != "string" ? "" : text);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
this.extraData = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJSON(obj) {
|
static fromJSON(obj) {
|
||||||
var item = new ReceiptPayment(obj.amount, obj.type, obj.text);
|
var item = new ReceiptPayment(obj.amount, obj.type, obj.text);
|
||||||
item.id = obj.id;
|
item.id = obj.id;
|
||||||
|
item.extraData = obj.extraData ?? {};
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,10 +364,22 @@ export class ReceiptPayment {
|
|||||||
amount: round(this.amount, 2),
|
amount: round(this.amount, 2),
|
||||||
type: this.type,
|
type: this.type,
|
||||||
text: this.text,
|
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() {
|
get texthtml() {
|
||||||
if (typeof this.text != "string") {
|
if (typeof this.text != "string") {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user