@aptos-scp/scp-component-store-selling-features-domain-model 1.10.1 → 1.10.3
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.
- package/lib/domain/UIBusinessEventTypes.d.ts +1 -1
- package/lib/domain/UIBusinessEventTypes.js +1 -1
- package/lib/domain/model/Constants.d.ts +8 -1
- package/lib/domain/model/Constants.js +7 -0
- package/lib/domain/model/cashDrawer/CashDrawerSession.d.ts +1 -0
- package/lib/domain/model/cashDrawer/CashDrawerSession.js +4 -0
- package/lib/domain/model/fee/FeeLine.d.ts +4 -0
- package/lib/domain/model/fee/FeeLine.js +54 -4
- package/package.json +1 -1
|
@@ -282,7 +282,7 @@ export declare const TAX_REFUND_VOID_EVENT: string;
|
|
|
282
282
|
export declare const START_TAX_REFUND_DEFERRED_EVENT: string;
|
|
283
283
|
export declare const TAX_REFUND_DEFERRED_EVENT: string;
|
|
284
284
|
export declare const START_OPEN_CASH_DRAWER_EVENT: string;
|
|
285
|
-
export declare const
|
|
285
|
+
export declare const TENDER_EXCHANGE_VALIDATE_CASH_DRAWER_EVENT: string;
|
|
286
286
|
export declare const CAPTURE_LOTTERY_CODE_EVENT: string;
|
|
287
287
|
export declare const APPLY_ITEM_SUBSCRIPTION_EVENT: string;
|
|
288
288
|
export declare const ADD_ITEM_SUBSCRIPTION_EVENT: string;
|
|
@@ -289,7 +289,7 @@ exports.TAX_REFUND_VOID_EVENT = "TaxRefundVoid";
|
|
|
289
289
|
exports.START_TAX_REFUND_DEFERRED_EVENT = "StartTaxRefundDeferred";
|
|
290
290
|
exports.TAX_REFUND_DEFERRED_EVENT = "TaxRefundDeferred";
|
|
291
291
|
exports.START_OPEN_CASH_DRAWER_EVENT = "StartOpenCashDrawer";
|
|
292
|
-
exports.
|
|
292
|
+
exports.TENDER_EXCHANGE_VALIDATE_CASH_DRAWER_EVENT = "TenderExchangeValidateCashDrawer";
|
|
293
293
|
exports.CAPTURE_LOTTERY_CODE_EVENT = "CaptureLotteryCode";
|
|
294
294
|
exports.APPLY_ITEM_SUBSCRIPTION_EVENT = "ApplyItemSubscription";
|
|
295
295
|
exports.ADD_ITEM_SUBSCRIPTION_EVENT = "AddItemSubscription";
|
|
@@ -496,8 +496,12 @@ export declare enum CollectedDataKey {
|
|
|
496
496
|
FeeDepartmentGroup = "feeDepartmentGroup",
|
|
497
497
|
FeeDescription = "feeDescription",
|
|
498
498
|
FeeExternalId = "feeExternalId",
|
|
499
|
+
FeeExtendedAmount = "feeExtendedAmount",
|
|
500
|
+
FeeExtendedAmountExcludingTax = "FeeExtendedAmountExcludingTax",
|
|
501
|
+
FeeExtendedAmountIncludingTax = "FeeExtendedAmountIncludingTax",
|
|
499
502
|
FeeId = "feeId",
|
|
500
503
|
FeeLongDescription = "feeLongDescription",
|
|
504
|
+
FeeSublines = "FeeSublines",
|
|
501
505
|
FeeQuantity = "feeQuantity",
|
|
502
506
|
PrevFeeQuantity = "prevFeeQuantity",
|
|
503
507
|
FeeLineReference = "feeLineReference",
|
|
@@ -680,6 +684,7 @@ export declare enum CollectedDataKey {
|
|
|
680
684
|
TaxExemptType = "taxExemptType",
|
|
681
685
|
TaxGroupId = "taxGroupId",
|
|
682
686
|
TaxOverrideType = "taxOverrideType",
|
|
687
|
+
TaxByAuthority = "taxByAuthority",
|
|
683
688
|
TenderAdjustmentType = "TenderAdjustmentType",
|
|
684
689
|
TenderAmount = "TenderAmount",
|
|
685
690
|
TenderAmountOriginal = "TenderAmountOriginal",
|
|
@@ -896,7 +901,8 @@ export declare enum CollectedDataKey {
|
|
|
896
901
|
MembershipTypeName = "membershipTypeName",
|
|
897
902
|
MembershipTypeDescription = "membershipTypeDescription",
|
|
898
903
|
IsPermanentMembershipDiscount = "isPermanentMembershipDiscount",
|
|
899
|
-
TerminalForceClosed = "TerminalForceClosed"
|
|
904
|
+
TerminalForceClosed = "TerminalForceClosed",
|
|
905
|
+
TotalLineTax = "totalLineTax"
|
|
900
906
|
}
|
|
901
907
|
export declare enum ItemLookupType {
|
|
902
908
|
ProductInquiryDetail = "ProductInquiryDetail",
|
|
@@ -923,6 +929,7 @@ export declare const TRANSACTION_RESUMING_ON_STARTUP_EVENT: string;
|
|
|
923
929
|
export declare const STORED_VALUE_REVERSAL_COMPLETED_EVENT_TYPE: string;
|
|
924
930
|
export declare const STORED_VALUE_CERTIFICATE_REVERSAL_COMPLETED_EVENT_TYPE: string;
|
|
925
931
|
export declare const TENDER_CHANGE_CANCEL_EVENT_TYPE: string;
|
|
932
|
+
export declare const CASH_DRAWER_SELECTED_EVENT: string;
|
|
926
933
|
export declare const CASH_DRAWER_OPEN_REQUESTED_EVENT: string;
|
|
927
934
|
export interface ICashDrawerEventData {
|
|
928
935
|
cashDrawerKey: string;
|
|
@@ -505,8 +505,12 @@ var CollectedDataKey;
|
|
|
505
505
|
CollectedDataKey["FeeDepartmentGroup"] = "feeDepartmentGroup";
|
|
506
506
|
CollectedDataKey["FeeDescription"] = "feeDescription";
|
|
507
507
|
CollectedDataKey["FeeExternalId"] = "feeExternalId";
|
|
508
|
+
CollectedDataKey["FeeExtendedAmount"] = "feeExtendedAmount";
|
|
509
|
+
CollectedDataKey["FeeExtendedAmountExcludingTax"] = "FeeExtendedAmountExcludingTax";
|
|
510
|
+
CollectedDataKey["FeeExtendedAmountIncludingTax"] = "FeeExtendedAmountIncludingTax";
|
|
508
511
|
CollectedDataKey["FeeId"] = "feeId";
|
|
509
512
|
CollectedDataKey["FeeLongDescription"] = "feeLongDescription";
|
|
513
|
+
CollectedDataKey["FeeSublines"] = "FeeSublines";
|
|
510
514
|
CollectedDataKey["FeeQuantity"] = "feeQuantity";
|
|
511
515
|
CollectedDataKey["PrevFeeQuantity"] = "prevFeeQuantity";
|
|
512
516
|
CollectedDataKey["FeeLineReference"] = "feeLineReference";
|
|
@@ -689,6 +693,7 @@ var CollectedDataKey;
|
|
|
689
693
|
CollectedDataKey["TaxExemptType"] = "taxExemptType";
|
|
690
694
|
CollectedDataKey["TaxGroupId"] = "taxGroupId";
|
|
691
695
|
CollectedDataKey["TaxOverrideType"] = "taxOverrideType";
|
|
696
|
+
CollectedDataKey["TaxByAuthority"] = "taxByAuthority";
|
|
692
697
|
CollectedDataKey["TenderAdjustmentType"] = "TenderAdjustmentType";
|
|
693
698
|
CollectedDataKey["TenderAmount"] = "TenderAmount";
|
|
694
699
|
CollectedDataKey["TenderAmountOriginal"] = "TenderAmountOriginal";
|
|
@@ -906,6 +911,7 @@ var CollectedDataKey;
|
|
|
906
911
|
CollectedDataKey["MembershipTypeDescription"] = "membershipTypeDescription";
|
|
907
912
|
CollectedDataKey["IsPermanentMembershipDiscount"] = "isPermanentMembershipDiscount";
|
|
908
913
|
CollectedDataKey["TerminalForceClosed"] = "TerminalForceClosed";
|
|
914
|
+
CollectedDataKey["TotalLineTax"] = "totalLineTax";
|
|
909
915
|
})(CollectedDataKey = exports.CollectedDataKey || (exports.CollectedDataKey = {}));
|
|
910
916
|
var ItemLookupType;
|
|
911
917
|
(function (ItemLookupType) {
|
|
@@ -936,6 +942,7 @@ exports.TRANSACTION_RESUMING_ON_STARTUP_EVENT = "Transaction.ResumingOnStartup";
|
|
|
936
942
|
exports.STORED_VALUE_REVERSAL_COMPLETED_EVENT_TYPE = "StoredValue.ReversalCompleted";
|
|
937
943
|
exports.STORED_VALUE_CERTIFICATE_REVERSAL_COMPLETED_EVENT_TYPE = "StoredValueCertificate.ReversalCompleted";
|
|
938
944
|
exports.TENDER_CHANGE_CANCEL_EVENT_TYPE = "TenderChange.Cancel";
|
|
945
|
+
exports.CASH_DRAWER_SELECTED_EVENT = "CashDrawer.Selected";
|
|
939
946
|
exports.CASH_DRAWER_OPEN_REQUESTED_EVENT = "CashDrawer.OpenRequested";
|
|
940
947
|
exports.ITEM_QUANTITY_CHANGE_EVENT = "Item.QuantityChange";
|
|
941
948
|
exports.CANCEL_TRANSACTION_ITEM_EVENT = "Item.CancelTransaction";
|
|
@@ -39,6 +39,7 @@ export declare class CashDrawerSession implements IState {
|
|
|
39
39
|
recordIsForGiftCertificate(giftCertState: GiftCertificateState): CashDrawerSession;
|
|
40
40
|
confirmingCashDrawerClosed(cashDrawerKey: string, lineNumber: number): CashDrawerSession;
|
|
41
41
|
skipConfirmCashDrawerClosed(): CashDrawerSession;
|
|
42
|
+
selectCashDrawer(cashDrawerKey: string, inputSource: string): CashDrawerSession;
|
|
42
43
|
openingCashDrawer(cashDrawerKey: string, inputSource: string, lineNumber: number): CashDrawerSession;
|
|
43
44
|
promptUserInteractionToSelectCashDrawer(): CashDrawerSession;
|
|
44
45
|
recordStatusCode(incomingStatusCode: CashDrawerStatusCode): CashDrawerSession;
|
|
@@ -85,6 +85,10 @@ class CashDrawerSession {
|
|
|
85
85
|
logger.traceEntry("checkDrawerClosedRequestSent");
|
|
86
86
|
return new CashDrawerSession(CashDrawerSessionState.Closed, this._cashDrawerStatusCode, this.cashDrawerKey, this._expectedAmounts, this._inputSource, undefined, true, this._giftCertificateState, this._expectedFloatAmounts);
|
|
87
87
|
}
|
|
88
|
+
selectCashDrawer(cashDrawerKey, inputSource) {
|
|
89
|
+
logger.traceEntry("selectCashDrawer");
|
|
90
|
+
return new CashDrawerSession(CashDrawerSessionState.Closed, this._cashDrawerStatusCode, cashDrawerKey, this._expectedAmounts, inputSource, undefined, this._skipConfirmClose, this._giftCertificateState, this._expectedFloatAmounts);
|
|
91
|
+
}
|
|
88
92
|
openingCashDrawer(cashDrawerKey, inputSource, lineNumber) {
|
|
89
93
|
logger.traceEntry("openCashDrawerRequestSent");
|
|
90
94
|
return new CashDrawerSession(CashDrawerSessionState.WaitingForOpenDrawerResponse, this._cashDrawerStatusCode, cashDrawerKey, this._expectedAmounts, inputSource, lineNumber, this._skipConfirmClose, this._giftCertificateState, this._expectedFloatAmounts);
|
|
@@ -57,6 +57,7 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
57
57
|
private _sublineIndexFromReturnCanonicalTransaction?;
|
|
58
58
|
private _lineNumberFromReturnTransaction?;
|
|
59
59
|
private _originalTaxOverride?;
|
|
60
|
+
static isPickupFulfilmentTransaction?: boolean;
|
|
60
61
|
/**
|
|
61
62
|
* The create method is called by the transaction line factory to create an instance and initialize it from the
|
|
62
63
|
* data collected during the qualification process.
|
|
@@ -142,6 +143,9 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
142
143
|
static feeTypeFromJsonObject(transactionLineJsonObj: any): FeeType;
|
|
143
144
|
static feeTypeFromCollectedData(collectedData: Readonly<Map<string, any>>): FeeType;
|
|
144
145
|
static taxGroupIdFromJsonObject(transactionLineJsonObj: any): string;
|
|
146
|
+
static getExtendedAmountFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
|
|
147
|
+
static getExtendedAmountExcludingTaxFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
|
|
148
|
+
static getExtendedAmountIncludingTaxFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
|
|
145
149
|
copyLineWithNewLineNumber(newLineNumber: number): FeeLine;
|
|
146
150
|
/**
|
|
147
151
|
* This method should be implemented only in decorator and not in the Fee line.
|
|
@@ -5,6 +5,7 @@ const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-
|
|
|
5
5
|
const BaseTransactionLine_1 = require("../BaseTransactionLine");
|
|
6
6
|
const Constants_1 = require("../Constants");
|
|
7
7
|
const ItemLine_1 = require("../item/ItemLine");
|
|
8
|
+
const UIBusinessEventTypes_1 = require("../../UIBusinessEventTypes");
|
|
8
9
|
exports.TRANSACTION_FEE_LINE_TYPE = "TransactionFee";
|
|
9
10
|
exports.TRANSACTION_FEE_REFUND_LINE_TYPE = "TransactionFeeRefund";
|
|
10
11
|
exports.ITEM_FEE_LINE_TYPE = "ItemFee";
|
|
@@ -47,8 +48,12 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
47
48
|
* @return {FeeLine}
|
|
48
49
|
*/
|
|
49
50
|
static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
|
|
51
|
+
this.isPickupFulfilmentTransaction = uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_PICKUP_EVENT;
|
|
52
|
+
const extendedAmount = this.getExtendedAmountFromCollectedData(collectedData);
|
|
53
|
+
const extendedAmountExcludingTax = this.getExtendedAmountExcludingTaxFromCollectedData(collectedData);
|
|
54
|
+
const extendedAmountIncludingTax = this.getExtendedAmountIncludingTaxFromCollectedData(collectedData);
|
|
50
55
|
const feeType = this.feeTypeFromCollectedData(collectedData);
|
|
51
|
-
let feeLine = new FeeLine(lineNumber, lineType, feeType);
|
|
56
|
+
let feeLine = new FeeLine(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax);
|
|
52
57
|
feeLine.loadFromCollectedData(collectedData);
|
|
53
58
|
return feeLine;
|
|
54
59
|
}
|
|
@@ -88,10 +93,16 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
88
93
|
return this._feeId;
|
|
89
94
|
}
|
|
90
95
|
get couldAffectPricing() {
|
|
96
|
+
if (FeeLine.isPickupFulfilmentTransaction) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
91
99
|
return true;
|
|
92
100
|
}
|
|
93
101
|
get couldAffectTaxation() {
|
|
94
|
-
if (
|
|
102
|
+
if (FeeLine.isPickupFulfilmentTransaction) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
else if (this._sublineFromOriginalItemFee !== undefined) {
|
|
95
106
|
return true;
|
|
96
107
|
}
|
|
97
108
|
return this.couldAffectPricing;
|
|
@@ -248,6 +259,26 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
248
259
|
static taxGroupIdFromJsonObject(transactionLineJsonObj) {
|
|
249
260
|
return transactionLineJsonObj._taxGroupId;
|
|
250
261
|
}
|
|
262
|
+
static getExtendedAmountFromCollectedData(collectedData) {
|
|
263
|
+
if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmount) && FeeLine.isPickupFulfilmentTransaction) {
|
|
264
|
+
return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmount);
|
|
265
|
+
}
|
|
266
|
+
undefined;
|
|
267
|
+
}
|
|
268
|
+
static getExtendedAmountExcludingTaxFromCollectedData(collectedData) {
|
|
269
|
+
if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax) &&
|
|
270
|
+
FeeLine.isPickupFulfilmentTransaction) {
|
|
271
|
+
return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax);
|
|
272
|
+
}
|
|
273
|
+
undefined;
|
|
274
|
+
}
|
|
275
|
+
static getExtendedAmountIncludingTaxFromCollectedData(collectedData) {
|
|
276
|
+
if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax) &&
|
|
277
|
+
FeeLine.isPickupFulfilmentTransaction) {
|
|
278
|
+
return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax);
|
|
279
|
+
}
|
|
280
|
+
undefined;
|
|
281
|
+
}
|
|
251
282
|
copyLineWithNewLineNumber(newLineNumber) {
|
|
252
283
|
const clonedItem = this.clone();
|
|
253
284
|
return clonedItem.updateLineNumber(newLineNumber);
|
|
@@ -257,6 +288,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
257
288
|
* @param sublines fee's sublines
|
|
258
289
|
*/
|
|
259
290
|
setSublines(sublines) {
|
|
291
|
+
if (FeeLine.isPickupFulfilmentTransaction) {
|
|
292
|
+
const newLine = this.clone();
|
|
293
|
+
newLine._sublines = sublines;
|
|
294
|
+
return newLine;
|
|
295
|
+
}
|
|
260
296
|
throw new Error("Method not implemented.");
|
|
261
297
|
}
|
|
262
298
|
setItemLineReference(itemLineReference) {
|
|
@@ -554,6 +590,17 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
554
590
|
if (collectedData.has(Constants_1.CollectedDataKey.LineNumberFromReturnTransaction)) {
|
|
555
591
|
this._lineNumberFromReturnTransaction = collectedData.get(Constants_1.CollectedDataKey.LineNumberFromReturnTransaction);
|
|
556
592
|
}
|
|
593
|
+
if (FeeLine.isPickupFulfilmentTransaction) {
|
|
594
|
+
if (!this._totalLineTax && collectedData.has(Constants_1.CollectedDataKey.TotalLineTax)) {
|
|
595
|
+
this._totalLineTax = collectedData.get(Constants_1.CollectedDataKey.TotalLineTax);
|
|
596
|
+
}
|
|
597
|
+
if (!this._quantity && collectedData.has(Constants_1.CollectedDataKey.FeeQuantity)) {
|
|
598
|
+
this._quantity = collectedData.get(Constants_1.CollectedDataKey.FeeQuantity);
|
|
599
|
+
}
|
|
600
|
+
if (!this.taxByAuthority && collectedData.has(Constants_1.CollectedDataKey.TaxByAuthority)) {
|
|
601
|
+
this._taxByAuthority = collectedData.get(Constants_1.CollectedDataKey.TaxByAuthority);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
557
604
|
if (collectedData.has(Constants_1.CollectedDataKey.OriginalTaxOverride)) {
|
|
558
605
|
const originalTaxOverride = collectedData.get(Constants_1.CollectedDataKey.OriginalTaxOverride);
|
|
559
606
|
if (originalTaxOverride) {
|
|
@@ -565,8 +612,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
565
612
|
if (collectedData.has(Constants_1.CollectedDataKey.SublineIndexFromReturnItem)) {
|
|
566
613
|
this._sublineIndexFromReturnCanonicalTransaction = collectedData.get(Constants_1.CollectedDataKey.SublineIndexFromReturnItem);
|
|
567
614
|
}
|
|
568
|
-
|
|
569
|
-
|
|
615
|
+
if (collectedData.has(Constants_1.CollectedDataKey.FeeSublines) && FeeLine.isPickupFulfilmentTransaction) {
|
|
616
|
+
this._sublines = collectedData.get(Constants_1.CollectedDataKey.FeeSublines);
|
|
617
|
+
}
|
|
618
|
+
else if (this._itemLineReference && this._quantity) {
|
|
619
|
+
// initial value for sublines, will be replaced when taxes are calculated
|
|
570
620
|
this._sublines = [
|
|
571
621
|
{
|
|
572
622
|
quantity: this._quantity.amount,
|
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.10.
|
|
3
|
+
"version": "1.10.3",
|
|
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",
|