@aptos-scp/scp-component-store-selling-features-domain-model 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { DeviceIdentity, ITransaction, ITransactionLine, ITransactionLineFactory
2
2
  import { ITransactionReferenceFormatter } from "../service";
3
3
  import { RetailTransaction } from "./RetailTransaction";
4
4
  import { IFiscalSignature } from "@aptos-scp/scp-types-commerce-transaction";
5
+ import { IFiscalError } from "./MerchandiseTransaction";
5
6
  export declare const TENDER_CONTROL_TRANSACTION_TYPE = "TenderControlTransaction";
6
7
  export declare class TenderControlTransaction extends RetailTransaction {
7
8
  private _accountingCurrency;
@@ -9,11 +10,13 @@ export declare class TenderControlTransaction extends RetailTransaction {
9
10
  private _transactionReferenceFormatter;
10
11
  private _fiscalTransactionNumber;
11
12
  private _fiscalSignature;
13
+ private _fiscalError?;
12
14
  static createFromJsonObj(transactionJsonObj: any, transactionLineFactory: ITransactionLineFactory, transactionReferenceFormatter: ITransactionReferenceFormatter): TenderControlTransaction;
13
15
  constructor(deviceIdentity: DeviceIdentity, businessDayDate: string, transactionNumber: number, user?: IUser, transactionId?: string, accountingCurrency?: string, transactionReferenceFormatter?: ITransactionReferenceFormatter, fiscalTransactionNumber?: string, fiscalSignature?: IFiscalSignature);
14
16
  clone(): ITransaction;
15
17
  assignFiscalSignature(signatureData: IFiscalSignature): ITransaction;
16
18
  assignFiscalTransactionNumber(fiscalTransactionNumber: string): ITransaction;
19
+ setFiscalError(fiscalError: IFiscalError): ITransaction;
17
20
  get accountingCurrency(): string;
18
21
  get referenceNumber(): string;
19
22
  get isTenderExchangeTransaction(): boolean;
@@ -21,6 +24,7 @@ export declare class TenderControlTransaction extends RetailTransaction {
21
24
  get transactionStateValues(): Readonly<Map<string, any>>;
22
25
  get fiscalTransactionNumber(): string;
23
26
  get fiscalSignature(): IFiscalSignature;
27
+ get fiscalError(): IFiscalError;
24
28
  findLineByLineNumber(lineNumber: number): ITransactionLine;
25
29
  toJSON(): object;
26
30
  protected newTransaction(): RetailTransaction;
@@ -12,6 +12,7 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
12
12
  this._transactionReferenceFormatter = transactionReferenceFormatter;
13
13
  this._fiscalTransactionNumber = fiscalTransactionNumber;
14
14
  this._fiscalSignature = fiscalSignature;
15
+ this._fiscalError = undefined;
15
16
  }
16
17
  static createFromJsonObj(transactionJsonObj, transactionLineFactory, transactionReferenceFormatter) {
17
18
  const transactionId = RetailTransaction_1.RetailTransaction.getTransactionIdFromJsonObject(transactionJsonObj);
@@ -33,6 +34,7 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
33
34
  transaction._referenceNumber = this._referenceNumber;
34
35
  transaction._fiscalTransactionNumber = this._fiscalTransactionNumber;
35
36
  transaction._fiscalSignature = this._fiscalSignature;
37
+ transaction._fiscalError = this._fiscalError;
36
38
  }
37
39
  else {
38
40
  throw new scp_component_store_selling_core_1.PosError("Cannot clone TenderControlTransaction, because new " + "instance is not a TenderControlTransaction.", config_1.SSF_TRANSACTION_ERROR_CODE);
@@ -49,6 +51,11 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
49
51
  newTransaction._fiscalTransactionNumber = fiscalTransactionNumber;
50
52
  return newTransaction;
51
53
  }
54
+ setFiscalError(fiscalError) {
55
+ const newTransaction = this.clone();
56
+ newTransaction._fiscalError = fiscalError;
57
+ return newTransaction;
58
+ }
52
59
  get accountingCurrency() {
53
60
  return this._accountingCurrency;
54
61
  }
@@ -72,6 +79,7 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
72
79
  ["transaction.referenceNumber", this._referenceNumber],
73
80
  ["transaction.accountingCurrency", this._accountingCurrency],
74
81
  ["transaction.isTenderExchangeTransaction", this.isTenderExchangeTransaction],
82
+ ["transaction.fiscalError", this._fiscalError],
75
83
  ]);
76
84
  }
77
85
  get fiscalTransactionNumber() {
@@ -80,6 +88,9 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
80
88
  get fiscalSignature() {
81
89
  return this._fiscalSignature;
82
90
  }
91
+ get fiscalError() {
92
+ return this._fiscalError;
93
+ }
83
94
  findLineByLineNumber(lineNumber) {
84
95
  if (lineNumber && super.lines.length > 0) {
85
96
  return super.findLineByLineNumber(lineNumber);
@@ -109,13 +120,14 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
109
120
  _referenceNumber: this.referenceNumber,
110
121
  _fiscalTransactionNumber: this.fiscalTransactionNumber,
111
122
  _fiscalSignature: this.fiscalSignature,
123
+ _fiscalError: this._fiscalError,
112
124
  };
113
125
  }
114
126
  newTransaction() {
115
127
  return new TenderControlTransaction(this.deviceIdentity, this.businessDayDate, this.transactionNumber, this.performingUser, this.transactionId, this.accountingCurrency, this._transactionReferenceFormatter, this.fiscalTransactionNumber, this.fiscalSignature);
116
128
  }
117
129
  loadFromJsonObject(transactionJsonObj, transactionLineFactory) {
118
- var _a, _b;
130
+ var _a, _b, _c;
119
131
  super.loadFromJsonObject(transactionJsonObj, transactionLineFactory);
120
132
  this._referenceNumber = transactionJsonObj._referenceNumber;
121
133
  if ((_a = transactionJsonObj) === null || _a === void 0 ? void 0 : _a._fiscalTransactionNumber) {
@@ -124,6 +136,9 @@ class TenderControlTransaction extends RetailTransaction_1.RetailTransaction {
124
136
  if ((_b = transactionJsonObj) === null || _b === void 0 ? void 0 : _b._fiscalSignature) {
125
137
  this._fiscalSignature = transactionJsonObj._fiscalSignature;
126
138
  }
139
+ if ((_c = transactionJsonObj) === null || _c === void 0 ? void 0 : _c._fiscalError) {
140
+ this._fiscalError = transactionJsonObj._fiscalError;
141
+ }
127
142
  }
128
143
  generateTransactionReferenceNumber(transaction) {
129
144
  this._referenceNumber = this._transactionReferenceFormatter.generateTransactionReference(transaction);
@@ -1,10 +1,12 @@
1
1
  import { DeviceIdentity, ITransaction, ITransactionLine, ITransactionLineFactory, IUser } from "@aptos-scp/scp-component-store-selling-core";
2
2
  import { RetailTransaction } from "./RetailTransaction";
3
3
  import { IFiscalSignature } from "@aptos-scp/scp-types-commerce-transaction";
4
+ import { IFiscalError } from "./MerchandiseTransaction";
4
5
  export declare const TILL_CONTROL_TRANSACTION_TYPE = "TillControlTransaction";
5
6
  export declare class TillControlTransaction extends RetailTransaction {
6
7
  private _fiscalSignature;
7
8
  private _fiscalTransactionNumber;
9
+ private _fiscalError?;
8
10
  static createFromJsonObj(transactionJsonObj: any, transactionLineFactory: ITransactionLineFactory): TillControlTransaction;
9
11
  constructor(deviceIdentity: DeviceIdentity, businessDayDate: string, transactionNumber: number, user?: IUser, transactionId?: string, fiscalSignature?: IFiscalSignature, fiscalTransactionNumber?: string);
10
12
  clone(): ITransaction;
@@ -13,6 +15,8 @@ export declare class TillControlTransaction extends RetailTransaction {
13
15
  get transactionStateValues(): Readonly<Map<string, any>>;
14
16
  assignFiscalSignature(signatureData: IFiscalSignature): ITransaction;
15
17
  assignFiscalTransactionNumber(fiscalTransactionNumber: string): ITransaction;
18
+ setFiscalError(fiscalError: IFiscalError): ITransaction;
19
+ get fiscalError(): IFiscalError;
16
20
  findLineByLineNumber(lineNumber: number): ITransactionLine;
17
21
  protected newTransaction(): RetailTransaction;
18
22
  protected loadFromJsonObject(transactionJsonObj: any, transactionLineFactory: ITransactionLineFactory): void;
@@ -9,6 +9,7 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
9
9
  super(deviceIdentity, businessDayDate, transactionNumber, exports.TILL_CONTROL_TRANSACTION_TYPE, user, transactionId);
10
10
  this._fiscalSignature = fiscalSignature;
11
11
  this._fiscalTransactionNumber = fiscalTransactionNumber;
12
+ this._fiscalError = undefined;
12
13
  }
13
14
  static createFromJsonObj(transactionJsonObj, transactionLineFactory) {
14
15
  const transactionId = RetailTransaction_1.RetailTransaction.getTransactionIdFromJsonObject(transactionJsonObj);
@@ -26,6 +27,7 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
26
27
  if (exports.isTillControlTransaction(transaction)) {
27
28
  transaction._fiscalSignature = this._fiscalSignature;
28
29
  transaction._fiscalTransactionNumber = this._fiscalTransactionNumber;
30
+ transaction._fiscalError = this._fiscalError;
29
31
  }
30
32
  else {
31
33
  throw new scp_component_store_selling_core_1.PosError("Cannot clone TillControlTransaction, because new " + "instance is not a TillControlTransaction.", config_1.SSF_TRANSACTION_ERROR_CODE);
@@ -39,7 +41,10 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
39
41
  return this._fiscalTransactionNumber;
40
42
  }
41
43
  get transactionStateValues() {
42
- return new Map([...super.transactionStateValues.entries()]);
44
+ return new Map([
45
+ ...super.transactionStateValues.entries(),
46
+ ["transaction.fiscalError", this._fiscalError],
47
+ ]);
43
48
  }
44
49
  assignFiscalSignature(signatureData) {
45
50
  const newTransaction = this.clone();
@@ -51,6 +56,14 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
51
56
  newTransaction._fiscalTransactionNumber = fiscalTransactionNumber;
52
57
  return newTransaction;
53
58
  }
59
+ setFiscalError(fiscalError) {
60
+ const newTransaction = this.clone();
61
+ newTransaction._fiscalError = fiscalError;
62
+ return newTransaction;
63
+ }
64
+ get fiscalError() {
65
+ return this._fiscalError;
66
+ }
54
67
  findLineByLineNumber(lineNumber) {
55
68
  if (lineNumber && super.lines.length > 0) {
56
69
  return super.findLineByLineNumber(lineNumber);
@@ -61,7 +74,7 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
61
74
  return new TillControlTransaction(this.deviceIdentity, this.businessDayDate, this.transactionNumber, this.performingUser, this.transactionId, this._fiscalSignature, this._fiscalTransactionNumber);
62
75
  }
63
76
  loadFromJsonObject(transactionJsonObj, transactionLineFactory) {
64
- var _a, _b;
77
+ var _a, _b, _c;
65
78
  super.loadFromJsonObject(transactionJsonObj, transactionLineFactory);
66
79
  if ((_a = transactionJsonObj) === null || _a === void 0 ? void 0 : _a._fiscalSignature) {
67
80
  this._fiscalSignature = transactionJsonObj._fiscalSignature;
@@ -69,6 +82,9 @@ class TillControlTransaction extends RetailTransaction_1.RetailTransaction {
69
82
  if ((_b = transactionJsonObj) === null || _b === void 0 ? void 0 : _b._fiscalTransactionNumber) {
70
83
  this._fiscalTransactionNumber = transactionJsonObj._fiscalTransactionNumber;
71
84
  }
85
+ if ((_c = transactionJsonObj) === null || _c === void 0 ? void 0 : _c._fiscalError) {
86
+ this._fiscalError = transactionJsonObj._fiscalError;
87
+ }
72
88
  }
73
89
  }
74
90
  exports.TillControlTransaction = TillControlTransaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "description": "This component library provides the common components to handle the coordination of processing the business events from the UI.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",