@aptos-scp/scp-component-store-selling-features-domain-model 1.18.0 → 1.20.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.
@@ -37,6 +37,7 @@ export interface IValidationRules {
37
37
  export interface ITenderGroup {
38
38
  tenderAuthCategory: TenderAuthCategory;
39
39
  tenderIds?: string[];
40
+ tenderType?: string;
40
41
  groupLabel?: ILabel;
41
42
  subType?: TenderSubType;
42
43
  }
@@ -137,6 +138,7 @@ export declare class TenderType {
137
138
  private static getActiveTenders;
138
139
  private static filterActiveTenderIds;
139
140
  private static tenderAuthCategoryIsActive;
141
+ private static tenderTypeIsActive;
140
142
  private static getActiveTenderGroupings;
141
143
  private static getActiveTenderGroupsByTenderGroupingsConfig;
142
144
  private static getActiveTenderGroupsByTenders;
@@ -338,6 +338,14 @@ class TenderType {
338
338
  });
339
339
  return !!activeTenderDef;
340
340
  }
341
+ static tenderTypeIsActive(tenderType, configuredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency) {
342
+ //search configured tenders for tenderType and check if active
343
+ const activeTenderDef = configuredTenders.find((configuredTender) => {
344
+ return (tenderType === configuredTender.tenderType &&
345
+ tenderIsActive(configuredTender, isRefund, withTransaction, false, false, withOfflineTransaction, accountingCurrency));
346
+ });
347
+ return !!activeTenderDef;
348
+ }
341
349
  static getActiveTenderGroupings(container, accountingCurrency, isRefund, withTransaction, activeTenders, originalTransactionsDetails, withOfflineTransaction) {
342
350
  const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
343
351
  const configuredTenderGroupings = configurationManager.getTendersUIValues().tenderGroupings;
@@ -360,9 +368,13 @@ class TenderType {
360
368
  else if (configuredTenderGroup.hasOwnProperty("tenderAuthCategory")) {
361
369
  return TenderType.tenderAuthCategoryIsActive(configuredTenderGroup.tenderAuthCategory, filterOriginalTenders(configuredTenders, originalTransactionsDetails, true), isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
362
370
  }
371
+ else if (configuredTenderGroup.hasOwnProperty("tenderType")) {
372
+ return TenderType.tenderTypeIsActive(configuredTenderGroup.tenderType, filterOriginalTenders(configuredTenders, originalTransactionsDetails, true), isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
373
+ }
363
374
  }).map((configuredTenderGroup) => ({
364
375
  tenderAuthCategory: configuredTenderGroup.tenderAuthCategory,
365
376
  tenderIds: TenderType.filterActiveTenderIds(configuredTenderGroup.tenderIds, filteredConfiguredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency),
377
+ tenderType: configuredTenderGroup.tenderType,
366
378
  groupLabel: configuredTenderGroup.groupButtonText,
367
379
  }));
368
380
  return handleValueCertificateGroup(activeTendersGroups, filterOriginalTenders(configuredTenders, originalTransactionsDetails, true), isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
@@ -216,6 +216,12 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
216
216
  if (originalDiscountReason) {
217
217
  itemLine._originalDiscountReason = originalDiscountReason;
218
218
  }
219
+ const originalTaxOverride = collectedData.get(Constants_1.CollectedDataKey.OriginalTaxOverride);
220
+ if (originalTaxOverride) {
221
+ itemLine._originalTaxOverride = originalTaxOverride;
222
+ itemLine._taxOverride = originalTaxOverride.taxOverride;
223
+ itemLine._preTaxOverrideDetails = originalTaxOverride.preTaxOverrideDetails;
224
+ }
219
225
  }
220
226
  const originalRedemptionLoyaltyTransactionKeys = collectedData.get(Constants_1.CollectedDataKey.OriginalRedemptionLoyaltyTransactionKeys);
221
227
  if (((_f = originalRedemptionLoyaltyTransactionKeys) === null || _f === void 0 ? void 0 : _f.length) > 0) {
@@ -23,6 +23,7 @@ export declare class TenderAuthorizationStatusLine extends BaseTransactionLine i
23
23
  private _offlineAuthorizationCode;
24
24
  private _tenderAuthCategory;
25
25
  private _tenderType;
26
+ private _tenderTypeName;
26
27
  private _entryMethod;
27
28
  private _tenderReversalFailed;
28
29
  private _actionType;
@@ -58,7 +59,7 @@ export declare class TenderAuthorizationStatusLine extends BaseTransactionLine i
58
59
  get subType(): TenderSubType;
59
60
  get mappedRefundTenderTypeName(): string;
60
61
  get isTenderAuthorizationFallback(): boolean;
61
- protected constructor(lineNumber: number, lineType: string, status: TenderAuthorizationStatus, tenderAmount: Money, authResponse: IAuthorizationResponse, failureReasonCode: TenderAuthFailureReasonCode, authorizationDeviceId: string, transactionLineReference: ITransactionLineReferenceType, forcedAuthorizationApproval: boolean, cardNumber: string, giftCardPin: string, valueCertificateNumber: string, offlineAuthorizationCode: string, offlineApprovalCode: string, tenderAuthCategory: TenderAuthCategory, tenderType: TenderType, entryMethod: EntryMethod, tenderReversalFailed: boolean, originalTenderLineReferences: IOriginalTransactionRefundReference[], actionType: ActionType, mappedRefundTenderTypeName: string, subType: TenderSubType, isChangeProcessing: boolean, isTenderAuthorizationFallback: boolean);
62
+ protected constructor(lineNumber: number, lineType: string, status: TenderAuthorizationStatus, tenderAmount: Money, authResponse: IAuthorizationResponse, failureReasonCode: TenderAuthFailureReasonCode, authorizationDeviceId: string, transactionLineReference: ITransactionLineReferenceType, forcedAuthorizationApproval: boolean, cardNumber: string, giftCardPin: string, valueCertificateNumber: string, offlineAuthorizationCode: string, offlineApprovalCode: string, tenderAuthCategory: TenderAuthCategory, tenderType: TenderType, tenderTypeName: string, entryMethod: EntryMethod, tenderReversalFailed: boolean, originalTenderLineReferences: IOriginalTransactionRefundReference[], actionType: ActionType, mappedRefundTenderTypeName: string, subType: TenderSubType, isChangeProcessing: boolean, isTenderAuthorizationFallback: boolean);
62
63
  protected newTransactionLine(): TenderAuthorizationStatusLine;
63
64
  }
64
65
  export declare function isTenderAuthorizationStatusLine(transactionLine: ITransactionLine): transactionLine is TenderAuthorizationStatusLine;
@@ -9,7 +9,7 @@ const Constants_1 = require("../Constants");
9
9
  const TenderType_1 = require("../TenderType");
10
10
  exports.TENDER_AUTH_STATUS_LINE_TYPE = "TenderAuthorizationStatus";
11
11
  class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
12
- constructor(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback) {
12
+ constructor(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, tenderTypeName, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback) {
13
13
  super(lineNumber, lineType);
14
14
  this._status = status;
15
15
  this._tenderAmount = tenderAmount;
@@ -25,6 +25,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
25
25
  this._valueCertificateNumber = valueCertificateNumber;
26
26
  this._tenderAuthCategory = tenderAuthCategory;
27
27
  this._tenderType = tenderType;
28
+ this._tenderTypeName = tenderTypeName;
28
29
  this._entryMethod = entryMethod;
29
30
  this._tenderReversalFailed = tenderReversalFailed;
30
31
  this._originalTenderLineReferences = originalTenderLineReferences;
@@ -35,6 +36,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
35
36
  this._isTenderAuthorizationFallback = isTenderAuthorizationFallback;
36
37
  }
37
38
  static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
39
+ var _a;
38
40
  const status = collectedData.get(Constants_1.CollectedDataKey.TenderAuthorizationStatus);
39
41
  const tenderAmount = collectedData.get(Constants_1.CollectedDataKey.TenderAmount);
40
42
  const authResponse = collectedData.get(Constants_1.CollectedDataKey.TenderAuthResponse);
@@ -49,6 +51,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
49
51
  const transactionLineReference = collectedData.get(Constants_1.CollectedDataKey.TransactionLineReference);
50
52
  const originalTenderLineReferences = collectedData.get(Constants_1.CollectedDataKey.OriginalTenderLineReferences);
51
53
  const tenderType = collectedData.get(Constants_1.CollectedDataKey.TenderType);
54
+ const tenderTypeName = ((_a = tenderType) === null || _a === void 0 ? void 0 : _a.tenderTypeName) || collectedData.get(Constants_1.CollectedDataKey.TenderTypeName);
52
55
  const tenderAuthCategory = tenderType
53
56
  ? tenderType.tenderAuthCategory
54
57
  : collectedData.get(Constants_1.CollectedDataKey.TenderAuthCategory);
@@ -60,7 +63,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
60
63
  const subType = collectedData.get(Constants_1.CollectedDataKey.TenderSubType);
61
64
  const isChangeProcessing = collectedData.get(Constants_1.CollectedDataKey.IsChangeProcessing);
62
65
  const isTenderAuthorizationFallback = collectedData.get(Constants_1.CollectedDataKey.IsTenderFallback);
63
- return new TenderAuthorizationStatusLine(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback);
66
+ return new TenderAuthorizationStatusLine(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, tenderTypeName, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback);
64
67
  }
65
68
  static createFromJsonObject(transactionLineJsonObj) {
66
69
  const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
@@ -76,6 +79,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
76
79
  const originalTenderLineReferences = transactionLineJsonObj._originalTenderLineReferences;
77
80
  const tenderAuthCategory = Constants_1.TenderAuthCategory[transactionLineJsonObj._tenderAuthCategory];
78
81
  const tenderType = TenderType_1.TenderType.createFromJsonObject(transactionLineJsonObj._tenderType);
82
+ const tenderTypeName = transactionLineJsonObj._tenderTypeName;
79
83
  const entryMethod = transactionLineJsonObj._entryMethod;
80
84
  const tenderReversalFailed = transactionLineJsonObj._tenderReversalFailed;
81
85
  const actionType = transactionLineJsonObj._actionType;
@@ -101,7 +105,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
101
105
  }
102
106
  const status = scp_types_commerce_transaction_1.TenderAuthorizationStatus[transactionLineJsonObj._status];
103
107
  const failureReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode[transactionLineJsonObj._failureReasonCode];
104
- const tenderAuthorizationStatusLine = new TenderAuthorizationStatusLine(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback);
108
+ const tenderAuthorizationStatusLine = new TenderAuthorizationStatusLine(lineNumber, lineType, status, tenderAmount, authResponse, failureReasonCode, authorizationDeviceId, transactionLineReference, forcedAuthorizationApproval, cardNumber, giftCardPin, valueCertificateNumber, offlineAuthorizationCode, offlineApprovalCode, tenderAuthCategory, tenderType, tenderTypeName, entryMethod, tenderReversalFailed, originalTenderLineReferences, actionType, mappedRefundTenderTypeName, subType, isChangeProcessing, isTenderAuthorizationFallback);
105
109
  tenderAuthorizationStatusLine.loadFromJsonObject(transactionLineJsonObj);
106
110
  return tenderAuthorizationStatusLine;
107
111
  }
@@ -154,7 +158,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
154
158
  return this.tenderType ? this.tenderType.tenderName : undefined;
155
159
  }
156
160
  get tenderTypeName() {
157
- return this.tenderType ? this.tenderType.tenderTypeName : undefined;
161
+ return this.tenderType ? this.tenderType.tenderTypeName : this._tenderTypeName;
158
162
  }
159
163
  get tenderAuthCategory() {
160
164
  return this._tenderAuthCategory;
@@ -184,7 +188,7 @@ class TenderAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactio
184
188
  return this._isTenderAuthorizationFallback;
185
189
  }
186
190
  newTransactionLine() {
187
- return new TenderAuthorizationStatusLine(this.lineNumber, this.lineType, this.status, this.tenderAmount, this.authResponse, this.failureReasonCode, this.authorizationDeviceId, this.transactionLineReference, this.forcedAuthorizationApproval, this.cardNumber, this.giftCardPin, this._valueCertificateNumber, this.offlineAuthorizationCode, this.offlineApprovalCode, this.tenderAuthCategory, this._tenderType, this._entryMethod, this._tenderReversalFailed, this._originalTenderLineReferences, this._actionType, this._mappedRefundTenderTypeName, this._subType, this._isChangeProcessing, this._isTenderAuthorizationFallback);
191
+ return new TenderAuthorizationStatusLine(this.lineNumber, this.lineType, this.status, this.tenderAmount, this.authResponse, this.failureReasonCode, this.authorizationDeviceId, this.transactionLineReference, this.forcedAuthorizationApproval, this.cardNumber, this.giftCardPin, this._valueCertificateNumber, this.offlineAuthorizationCode, this.offlineApprovalCode, this.tenderAuthCategory, this._tenderType, this.tenderTypeName, this._entryMethod, this._tenderReversalFailed, this._originalTenderLineReferences, this._actionType, this._mappedRefundTenderTypeName, this._subType, this._isChangeProcessing, this._isTenderAuthorizationFallback);
188
192
  }
189
193
  }
190
194
  exports.TenderAuthorizationStatusLine = TenderAuthorizationStatusLine;
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.18.0",
3
+ "version": "1.20.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",