@aptos-scp/scp-component-store-selling-features-domain-model 2.50.0 → 3.0.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.
@@ -381,6 +381,58 @@ const coreStateModel = {
381
381
  ],
382
382
  uiBusinessEvents: [],
383
383
  },
384
+ {
385
+ /**
386
+ * State-agnostic catch-all for any TerminalControlTransaction
387
+ * in ctx. PEPS calls findLogicalStateName on every UI business event; if
388
+ * no matcher returns a name it throws SSC_PEPS_CANNOT_FIND_STATE_FOR_CONTEXT_ERROR_CODE
389
+ * which becomes UI_MODE_FATAL_ERROR -> FatalErrorScreen.
390
+ *
391
+ * During fresh-install boot DB sync, a redundant TerminalStateSync flow can leave
392
+ * a closed TerminalControlTransaction in ctx.transaction while a late
393
+ * LookupExchangeRatesEvent is still being processed. At the throw moment we
394
+ * captured: state="Closed", isOpen()=false, isWaitingToClose()=false,
395
+ * isClosing()=false, isClosed()=true. UserSession is also LoggedOff (pre-login).
396
+ *
397
+ * Unlike IN_TILL_CONTROL_TRANSACTION (which is a post-login operational state
398
+ * requiring loggedOn=true + isOpen=true), this matcher is purely a fallback to
399
+ * keep PEPS off the fatal path. fieldMatchers like isOpen=true or loggedOn=true
400
+ * would miss the actual race window. fieldMatchers:[] makes the matcher match
401
+ * any state of a TerminalControlTransaction in ctx.
402
+ *
403
+ * Pairs with a same IN_TERMINAL_CONTROL_TRANSACTION UIBE registration in scp-component-store-selling-features-user-employee
404
+ * that add AUTO_LOG_OFF_OR_LOCK_EVENT + LOCK_USER_SESSION_EVENT to satisfy the
405
+ * engine's "every logical state has at least one event" rule.
406
+ */
407
+ logicalName: exports.IN_TERMINAL_CONTROL_TRANSACTION,
408
+ stateMatchers: [
409
+ {
410
+ matcherType: scp_component_store_selling_core_1.StateMatcherDefinitionType.Transaction,
411
+ transactionType: domain_1.TERMINAL_CONTROL_TRANSACTION_TYPE,
412
+ fieldMatchers: [],
413
+ },
414
+ ],
415
+ uiBusinessEvents: [],
416
+ },
417
+ {
418
+ /**
419
+ * NOTE: this is kept as a no-op alias for the WAITING_TO_CLOSE name. The matcher
420
+ * above already wins because both share the same transactionType-only predicate
421
+ * (first match wins in findLogicalStateName). This entry exists so the constant
422
+ * IN_TERMINAL_CONTROL_TRANSACTION_WAITING_TO_CLOSE (apparently defined for symmetry
423
+ * with the IN_TILL family) still resolves to *some* matcher should a downstream
424
+ * dependency reference it; otherwise it would be unreachable.
425
+ */
426
+ logicalName: exports.IN_TERMINAL_CONTROL_TRANSACTION_WAITING_TO_CLOSE,
427
+ stateMatchers: [
428
+ {
429
+ matcherType: scp_component_store_selling_core_1.StateMatcherDefinitionType.Transaction,
430
+ transactionType: domain_1.TERMINAL_CONTROL_TRANSACTION_TYPE,
431
+ fieldMatchers: [],
432
+ },
433
+ ],
434
+ uiBusinessEvents: [],
435
+ },
384
436
  {
385
437
  logicalName: exports.IN_FISCAL_CONTROL_TRANSACTION,
386
438
  stateMatchers: [
@@ -1,6 +1,7 @@
1
1
  import { DeviceIdentity, ITransaction, ITransactionLineFactory, IUser } from "@aptos-scp/scp-component-store-selling-core";
2
2
  import { IFiscalSignature } from "@aptos-scp/scp-types-commerce-transaction";
3
3
  import { IFiscalTransactionNumberMaintainer } from "./IFiscalTransactionNumberMaintainer";
4
+ import { ICountryBoxFiscalError } from "./MerchandiseTransaction";
4
5
  import { RetailTransaction } from "./RetailTransaction";
5
6
  import { IInvoiceOperation } from "./IInvoiceOperation";
6
7
  import { Customer } from "./Customer";
@@ -18,10 +19,13 @@ export declare class ReprintReceiptTransaction extends RetailTransaction impleme
18
19
  private _invoiceFiscalTransactionNumber?;
19
20
  private _invoiceTransactionNumber?;
20
21
  private _accountingCurrency?;
22
+ private _countryBoxFiscalError?;
21
23
  static createFromJsonObj(transactionJsonObj: any, transactionLineFactory: ITransactionLineFactory): ReprintReceiptTransaction;
22
24
  constructor(deviceIdentity: DeviceIdentity, businessDayDate: string, transactionNumber: number, user?: IUser, transactionId?: string, invoiceNumber?: string, invoiceSequenceNumber?: number, invoiceSequenceNumberGenerator?: string, fiscalSignature?: IFiscalSignature, customer?: Customer, accountingCurrency?: string);
23
25
  clone(): ITransaction;
24
26
  get transactionStateValues(): Readonly<Map<string, any>>;
27
+ get countryBoxFiscalError(): ICountryBoxFiscalError;
28
+ setCountryBoxFiscalError(countryBoxFiscalError: ICountryBoxFiscalError): ITransaction;
25
29
  get invoiceNumber(): string;
26
30
  get invoiceSequenceNumber(): number;
27
31
  get invoiceSequenceNumberGenerator(): string;
@@ -14,6 +14,7 @@ class ReprintReceiptTransaction extends RetailTransaction_1.RetailTransaction {
14
14
  this._fiscalSignature = fiscalSignature;
15
15
  this._customer = customer;
16
16
  this._accountingCurrency = accountingCurrency;
17
+ this._countryBoxFiscalError = undefined;
17
18
  }
18
19
  static createFromJsonObj(transactionJsonObj, transactionLineFactory) {
19
20
  const transactionId = RetailTransaction_1.RetailTransaction.getTransactionIdFromJsonObject(transactionJsonObj);
@@ -66,7 +67,21 @@ class ReprintReceiptTransaction extends RetailTransaction_1.RetailTransaction {
66
67
  return transaction;
67
68
  }
68
69
  get transactionStateValues() {
69
- return super.transactionStateValues;
70
+ if (!this._countryBoxFiscalError) {
71
+ return super.transactionStateValues;
72
+ }
73
+ return new Map([
74
+ ...super.transactionStateValues.entries(),
75
+ ["transaction.countryBoxFiscalError", this._countryBoxFiscalError],
76
+ ]);
77
+ }
78
+ get countryBoxFiscalError() {
79
+ return this._countryBoxFiscalError;
80
+ }
81
+ setCountryBoxFiscalError(countryBoxFiscalError) {
82
+ const newTransaction = this.clone();
83
+ newTransaction._countryBoxFiscalError = countryBoxFiscalError;
84
+ return newTransaction;
70
85
  }
71
86
  get invoiceNumber() {
72
87
  return this._invoiceNumber;
@@ -169,6 +184,7 @@ class ReprintReceiptTransaction extends RetailTransaction_1.RetailTransaction {
169
184
  this._invoiceFiscalTransactionNumber = transactionJsonObj._invoiceFiscalTransactionNumber;
170
185
  this._invoiceTransactionNumber = transactionJsonObj._invoiceTransactionNumber;
171
186
  this._accountingCurrency = transactionJsonObj._accountingCurrency;
187
+ this._countryBoxFiscalError = transactionJsonObj._countryBoxFiscalError;
172
188
  }
173
189
  }
174
190
  exports.ReprintReceiptTransaction = ReprintReceiptTransaction;
@@ -112,6 +112,9 @@ class RetailTransaction {
112
112
  transaction._taxFreeCreditNoteNumber = this._taxFreeCreditNoteNumber;
113
113
  transaction._taxFreeCreditNoteSequenceNumber = this._taxFreeCreditNoteSequenceNumber;
114
114
  transaction._taxFreeCreditNoteSequenceNumberGenerator = this._taxFreeCreditNoteSequenceNumberGenerator;
115
+ if ("_countryBoxFiscalError" in this) {
116
+ transaction._countryBoxFiscalError = this._countryBoxFiscalError;
117
+ }
115
118
  return transaction;
116
119
  }
117
120
  setTransactionProperty(propertyName, propertyValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "2.50.0",
3
+ "version": "3.0.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",