@aptos-scp/scp-component-store-selling-features-domain-model 1.21.0 → 1.22.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 { Money } from "@aptos-scp/scp-component-business-core";
2
2
  import { DeviceIdentity, ITransaction, ITransactionLine, ITransactionLineFactory, IUser } from "@aptos-scp/scp-component-store-selling-core";
3
3
  import { IBaseTransactionTaxCalculationResults } from "@aptos-scp/scp-component-taxation";
4
4
  import { IFiscalSignature, ITaxByTaxAuthority, ITaxByTaxRule, ITaxOverride, MerchandiseTransactionReservationStatus, MerchandiseTransactionTradeType, TaxCalculationSystem } from "@aptos-scp/scp-types-commerce-transaction";
5
+ import { FiscalResponseCode } from "@aptos-scp/scp-types-commerce-devices";
5
6
  import { PotentialPromotion } from "@aptos-scp/scp-types-pricing";
6
7
  import { GiftReceiptMode } from "./Constants";
7
8
  import { Coupon } from "./Coupon";
@@ -70,6 +71,11 @@ export interface IAppTransactionTaxes extends IBaseTransactionTaxCalculationResu
70
71
  taxCalculationSystem?: TaxCalculationSystem;
71
72
  taxCalculationSystemReason?: string;
72
73
  }
74
+ export interface IFiscalError {
75
+ isStartTransaction?: boolean;
76
+ fiscalErrorCode?: FiscalResponseCode;
77
+ fiscalErrorDescription?: string;
78
+ }
73
79
  export declare class MerchandiseTransaction extends RetailTransaction implements IInvoiceOperation, IFiscalTransactionNumberMaintainer {
74
80
  private _accountingCurrency;
75
81
  private _transactionSubTotal;
@@ -158,6 +164,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
158
164
  private _balanceDueExcludingPreviouslyCollected;
159
165
  private _transactionTotalExcludingPreviouslyCollected;
160
166
  private _transactionSubTotalExcludingPreviouslyCollectedExcludingTax;
167
+ private _fiscalError?;
161
168
  static createFromJsonObj(transactionJsonObj: any, transactionLineFactory: ITransactionLineFactory, transactionReferenceFormatter: ITransactionReferenceFormatter): MerchandiseTransaction;
162
169
  constructor(deviceIdentity: DeviceIdentity, businessDayDate: string, transactionNumber: number, accountingCurrency: string, transactionReferenceFormatter: ITransactionReferenceFormatter, governmentIssuedIds?: GovernmentBusinessId[], performingUser?: IUser, transactionId?: string, giftReceiptMode?: GiftReceiptMode, giftReceipt?: boolean, totalsBeforeVoid?: TotalsBeforeVoid, unusedCoupons?: Coupon[], employeeCustomer?: IEmployee, invoiceNumber?: string, invoiceSequenceNumber?: number, taxLotteryNumber?: string, order?: Order, invoiceSequenceNumberGenerator?: string, taxLotteryCustomerCode?: string, taxScanCodeData?: string, fiscalSignature?: IFiscalSignature, requiresVoid?: boolean, eInvoiceReference?: string, prepaidTendersToApply?: IPrepaidTenderToApply[], digestValue?: string, potentialPromotions?: PotentialPromotion[]);
163
170
  clone(): ITransaction;
@@ -244,6 +251,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
244
251
  get orderReferenceSequenceNumberGenerator(): string;
245
252
  get transactionTaxExemptAmount(): Money;
246
253
  get transactionTaxAdjustmentAmount(): Money;
254
+ get fiscalError(): IFiscalError;
247
255
  get tradeType(): MerchandiseTransactionTradeType;
248
256
  get taxLotteryNumber(): string;
249
257
  get taxLotteryCustomerCode(): string;
@@ -288,6 +296,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
288
296
  assignFiscalTransactionNumber(fiscalTransactionNumber: string): ITransaction;
289
297
  assignFiscalTypeCode(fiscalTypeCode: string): ITransaction;
290
298
  assignFiscalTransactionSequenceNumber(fiscalTransactionSequenceNumber: number, fiscalTransactionSequenceNumberGenerator: string): ITransaction;
299
+ setFiscalError(fiscalError: IFiscalError): ITransaction;
291
300
  assignOrderReferenceSequenceNumber(orderReferenceSequenceNumber: number, orderReferenceSequenceNumberGenerator: string): ITransaction;
292
301
  assignInvoiceFiscalTransactionNumber(invoiceTransactionNumber: number, invoiceFiscalTransactionNumber: string): ITransaction;
293
302
  assignTaxlotteryNumber(taxLotteryNumber: string): ITransaction;
@@ -82,6 +82,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
82
82
  this._taxLotteryNumber = taxLotteryNumber;
83
83
  this._transactionTaxExemptAmount = undefined;
84
84
  this._transactionTaxAdjustmentAmount = undefined;
85
+ this._fiscalError = undefined;
85
86
  this._tradeType = undefined;
86
87
  this._denominationRounding = new scp_component_business_core_1.Money(0, accountingCurrency);
87
88
  this._order = order;
@@ -195,6 +196,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
195
196
  transaction._invoiceSequenceNumberGenerator = this._invoiceSequenceNumberGenerator;
196
197
  transaction._transactionTaxExemptAmount = this._transactionTaxExemptAmount;
197
198
  transaction._transactionTaxAdjustmentAmount = this._transactionTaxAdjustmentAmount;
199
+ transaction._fiscalError = this._fiscalError;
198
200
  transaction._tradeType = this._tradeType;
199
201
  transaction._taxLotteryNumber = this._taxLotteryNumber;
200
202
  transaction._denominationRounding = this._denominationRounding;
@@ -488,6 +490,9 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
488
490
  get transactionTaxAdjustmentAmount() {
489
491
  return this._transactionTaxAdjustmentAmount;
490
492
  }
493
+ get fiscalError() {
494
+ return this._fiscalError;
495
+ }
491
496
  get tradeType() {
492
497
  return this._tradeType;
493
498
  }
@@ -703,6 +708,11 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
703
708
  newTransaction._fiscalTransactionSequenceNumberGenerator = fiscalTransactionSequenceNumberGenerator;
704
709
  return newTransaction;
705
710
  }
711
+ setFiscalError(fiscalError) {
712
+ const newTransaction = this.clone();
713
+ newTransaction._fiscalError = fiscalError;
714
+ return newTransaction;
715
+ }
706
716
  assignOrderReferenceSequenceNumber(orderReferenceSequenceNumber, orderReferenceSequenceNumberGenerator) {
707
717
  const newTransaction = this.clone();
708
718
  newTransaction._orderReferenceSequenceNumber = orderReferenceSequenceNumber;
@@ -874,6 +884,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
874
884
  ["transaction.invoiceNumber", this._invoiceNumber],
875
885
  ["transaction.taxExemptAmount", this._transactionTaxExemptAmount],
876
886
  ["transaction.transactionTaxAdjustmentAmount", this._transactionTaxAdjustmentAmount],
887
+ ["transaction.fiscalError", this._fiscalError],
877
888
  ["transaction.tradeType", this._tradeType],
878
889
  ["transaction.signatureCollected", this.signatureCollected],
879
890
  ["transaction.itemPickupSignatureCollected", this.itemPickupSignatureCollected],
@@ -999,6 +1010,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
999
1010
  _invoiceSequenceNumberGenerator: this._invoiceSequenceNumberGenerator,
1000
1011
  _transactionTaxExemptAmount: this._transactionTaxExemptAmount,
1001
1012
  _transactionTaxAdjustmentAmount: this._transactionTaxAdjustmentAmount,
1013
+ _fiscalError: this._fiscalError,
1002
1014
  _transactionSubTotalAfterTaxAdjustment: this._transactionSubTotalAfterTaxAdjustment,
1003
1015
  _transactionTotalFeeAfterTaxAdjustment: this._transactionTotalFeeAfterTaxAdjustment,
1004
1016
  _tradeType: this._tradeType,
@@ -1149,6 +1161,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1149
1161
  this._transactionTaxAdjustmentAmount = transactionJsonObj._transactionTaxAdjustmentAmount
1150
1162
  ? new scp_component_business_core_1.Money(transactionJsonObj._transactionTaxAdjustmentAmount)
1151
1163
  : undefined;
1164
+ this._fiscalError = transactionJsonObj._fiscalError;
1152
1165
  this._tradeType = findMerchandiseTransactionTradeType(transactionJsonObj._tradeType);
1153
1166
  this._taxLotteryNumber = transactionJsonObj._taxLotteryNumber;
1154
1167
  this._denominationRounding =
@@ -545,6 +545,7 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
545
545
  }
546
546
  }
547
547
  loadFromCollectedData(collectedData) {
548
+ var _a, _b;
548
549
  const accountingCurrency = collectedData.get(Constants_1.CollectedDataKey.AccountingCurrency);
549
550
  if (!this._feeId && collectedData.has(Constants_1.CollectedDataKey.FeeId)) {
550
551
  this._feeId = collectedData.get(Constants_1.CollectedDataKey.FeeId);
@@ -637,7 +638,7 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
637
638
  }
638
639
  if (collectedData.has(Constants_1.CollectedDataKey.OriginalTaxOverride)) {
639
640
  const originalTaxOverride = collectedData.get(Constants_1.CollectedDataKey.OriginalTaxOverride);
640
- if (originalTaxOverride) {
641
+ if (((_b = (_a = originalTaxOverride) === null || _a === void 0 ? void 0 : _a.taxOverride) === null || _b === void 0 ? void 0 : _b.taxOverrideType) === scp_types_commerce_transaction_1.TaxOverrideType.Transaction) {
641
642
  this._originalTaxOverride = originalTaxOverride;
642
643
  this._taxOverride = originalTaxOverride.taxOverride;
643
644
  this._preTaxOverrideDetails = originalTaxOverride.preTaxOverrideDetails;
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.21.0",
3
+ "version": "1.22.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",
@@ -83,7 +83,7 @@
83
83
  "@aptos-scp/scp-component-taxation": "^5.27.3",
84
84
  "@aptos-scp/scp-component-user": "^1.4.0",
85
85
  "@aptos-scp/scp-types-client-registration": "^1.4.0",
86
- "@aptos-scp/scp-types-commerce-devices": "^3.3.0",
86
+ "@aptos-scp/scp-types-commerce-devices": "^3.4.0",
87
87
  "@aptos-scp/scp-types-commerce-transaction": "^1.63.0",
88
88
  "@aptos-scp/scp-types-core": "^1.0.5",
89
89
  "@aptos-scp/scp-types-core-config": "^2.2.1",