@aptos-scp/scp-component-store-selling-features-domain-model 2.46.0 → 2.48.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.
@@ -53,7 +53,7 @@ exports.ITEM_TAX_OVERRIDE_EVENT = "ItemTaxOverride";
53
53
  exports.SELL_ITEM_NOT_ON_FILE_EVENT = "SellItemNotOnFile";
54
54
  exports.ORDER_ITEM_NOT_ON_FILE_EVENT = "OrderItemNotOnFile";
55
55
  exports.ORDER_ITEM_CANCELLATION_EVENT = "OrderItemCancellation";
56
- exports.FINALIZE_ORDER_ITEM_CANCELLATION_EVENT = "FinalizeOrderItemCancellation";
56
+ exports.FINALIZE_ORDER_ITEM_CANCELLATION_EVENT = "FinalizeOrderItemCancellation"; //Deprecated
57
57
  exports.ORDER_ITEM_RESTORE_EVENT = "OrderItemRestore";
58
58
  exports.RESERVED_ORDER_ITEM_CANCELLATION_EVENT = "ReservedOrderItemCancellation";
59
59
  exports.ORDER_ITEM_PICKUP_EVENT = "OrderItemPickup";
@@ -333,6 +333,10 @@ export declare enum UiInputKey {
333
333
  MAPPED_REFUND_TENDER_TYPE_NAME = "input_mappedRefundTenderTypeName",
334
334
  MAPPED_REFUND_CARD_TYPE_NAME = "input_mappedRefundCardTypeName",
335
335
  PRE_AUTH = "input_preAuth",
336
+ /**
337
+ * When true, APPLY_TENDER (routed to refund) is reversing tender held as authorization only (e.g. order cancel).
338
+ */
339
+ PRE_AUTHORIZATION_REVERSAL = "input_preAuthorizationReversal",
336
340
  EXCLUDED_REFUND_CARD_TYPE_NAMES = "input_excludedRefundCardTypeNames",
337
341
  TRANSACTION_NUMBER_FIELD = "input_transactionNumberField",
338
342
  TRANSACTION_REFERENCE_NUMBER_FIELD = "input_referenceNumberField",
@@ -472,7 +476,8 @@ export declare enum UiInputKey {
472
476
  SELECTED_RETURN_ITEMS = "input_selectedReturnItems",
473
477
  FEE_LINE_FOR_REFUND = "input_feeLineForRefund",
474
478
  FEE_REFUND_SOURCE = "input_feeRefundSource",
475
- FEE_REFUNDABLE_AMOUNT = "input_feeRefundableAmount"
479
+ FEE_REFUNDABLE_AMOUNT = "input_feeRefundableAmount",
480
+ ITEM_TERMS_AND_CONDITIONS_ACCEPTED = "input_itemTermsAndConditionsAccepted"
476
481
  }
477
482
  export declare enum CollectedDataKey {
478
483
  Abort = "abort",
@@ -985,6 +990,11 @@ export declare enum CollectedDataKey {
985
990
  PrepaidTaxAmount = "prepaidTaxAmount",
986
991
  PrepaidSavingsAmount = "prepaidSavingsAmount",
987
992
  PreviouslyCollectedTender = "previouslyCollectedTender",
993
+ /**
994
+ * When ToBeStarted (or legacy boolean true) as collected data with TenderAuthResponse,
995
+ * merges IAuthorizationResponse.preAuthorizationReversalStatus.
996
+ */
997
+ PreAuthorizationReversal = "PreAuthorizationReversal",
988
998
  PresetRateExemption = "presetRateExemption",
989
999
  PresetExemptionCategory = "presetExemptionCategory",
990
1000
  PresetExemptionRate = "presetExemptionRate",
@@ -334,6 +334,10 @@ var UiInputKey;
334
334
  UiInputKey["MAPPED_REFUND_TENDER_TYPE_NAME"] = "input_mappedRefundTenderTypeName";
335
335
  UiInputKey["MAPPED_REFUND_CARD_TYPE_NAME"] = "input_mappedRefundCardTypeName";
336
336
  UiInputKey["PRE_AUTH"] = "input_preAuth";
337
+ /**
338
+ * When true, APPLY_TENDER (routed to refund) is reversing tender held as authorization only (e.g. order cancel).
339
+ */
340
+ UiInputKey["PRE_AUTHORIZATION_REVERSAL"] = "input_preAuthorizationReversal";
337
341
  UiInputKey["EXCLUDED_REFUND_CARD_TYPE_NAMES"] = "input_excludedRefundCardTypeNames";
338
342
  UiInputKey["TRANSACTION_NUMBER_FIELD"] = "input_transactionNumberField";
339
343
  UiInputKey["TRANSACTION_REFERENCE_NUMBER_FIELD"] = "input_referenceNumberField";
@@ -474,6 +478,7 @@ var UiInputKey;
474
478
  UiInputKey["FEE_LINE_FOR_REFUND"] = "input_feeLineForRefund";
475
479
  UiInputKey["FEE_REFUND_SOURCE"] = "input_feeRefundSource";
476
480
  UiInputKey["FEE_REFUNDABLE_AMOUNT"] = "input_feeRefundableAmount";
481
+ UiInputKey["ITEM_TERMS_AND_CONDITIONS_ACCEPTED"] = "input_itemTermsAndConditionsAccepted";
477
482
  })(UiInputKey = exports.UiInputKey || (exports.UiInputKey = {}));
478
483
  //
479
484
  // Keys for use in relaying data collectedData (qualification) and nonContextualData (action).
@@ -992,6 +997,11 @@ var CollectedDataKey;
992
997
  CollectedDataKey["PrepaidTaxAmount"] = "prepaidTaxAmount";
993
998
  CollectedDataKey["PrepaidSavingsAmount"] = "prepaidSavingsAmount";
994
999
  CollectedDataKey["PreviouslyCollectedTender"] = "previouslyCollectedTender";
1000
+ /**
1001
+ * When ToBeStarted (or legacy boolean true) as collected data with TenderAuthResponse,
1002
+ * merges IAuthorizationResponse.preAuthorizationReversalStatus.
1003
+ */
1004
+ CollectedDataKey["PreAuthorizationReversal"] = "PreAuthorizationReversal";
995
1005
  CollectedDataKey["PresetRateExemption"] = "presetRateExemption";
996
1006
  CollectedDataKey["PresetExemptionCategory"] = "presetExemptionCategory";
997
1007
  CollectedDataKey["PresetExemptionRate"] = "presetExemptionRate";
@@ -352,10 +352,13 @@ class TenderType {
352
352
  return tenderType;
353
353
  }
354
354
  signatureRequired(tenderAmount, authResponse) {
355
- var _a;
355
+ var _a, _b;
356
356
  let sigRequired = false;
357
+ if (((_a = authResponse) === null || _a === void 0 ? void 0 : _a.preAuthorizationReversalStatus) != null) {
358
+ return false;
359
+ }
357
360
  //if the auth type is updateAuthorization then use signatureCapturePolicyForCallForAuth
358
- const signatureCapturePolicy = ((_a = authResponse) === null || _a === void 0 ? void 0 : _a.requestType) === scp_types_commerce_devices_1.PaymentRequestType.UpdateAuthorization
361
+ const signatureCapturePolicy = ((_b = authResponse) === null || _b === void 0 ? void 0 : _b.requestType) === scp_types_commerce_devices_1.PaymentRequestType.UpdateAuthorization
359
362
  ? this.signatureCapturePolicyForCallForAuth
360
363
  : this.signatureCapturePolicy;
361
364
  switch (signatureCapturePolicy) {
@@ -1,9 +1,14 @@
1
+ import { ConditionType, IConditionalAttributeBehaviorRuleAttributeGroups } from "./IConditionalAttributeBehaviorRuleConfig";
2
+ import { ITranslatableMessage } from "./IFeatureAccessConfig";
1
3
  export interface ICustomerConfig {
2
4
  loyalty: ILoyaltyConfig;
3
5
  }
4
6
  export interface ILoyaltyConfig {
5
7
  readonly enabled: boolean;
6
8
  readonly realTimePoints: IRealTimePointConfig;
9
+ readonly enrollment?: IEnrollmentConfig;
10
+ readonly displayBehavior?: IDisplayBehavior;
11
+ readonly redemption?: IRedemptionConfig;
7
12
  readonly applyPermanentMembershipDiscounts?: boolean;
8
13
  }
9
14
  export declare enum LoyaltyQualifyingTransactions {
@@ -18,6 +23,7 @@ export interface IDisplayBehavior {
18
23
  readonly showCurrentTransactionTotalPoints: boolean;
19
24
  readonly showCurrentTransactionRegularPoints: boolean;
20
25
  readonly showCurrentTransactionConditionalPoints: boolean;
26
+ readonly hiddenLoyaltyPlanIds: string[];
21
27
  }
22
28
  export interface IRealTimePointConfig {
23
29
  readonly qualifyingTransactions: LoyaltyQualifyingTransactions;
@@ -29,3 +35,88 @@ export declare enum AssignCustomerFromOriginalSaleForReturns {
29
35
  AssignWithPrompt = "AssignWithPrompt",
30
36
  AssignWithoutPrompt = "AssignWithoutPrompt"
31
37
  }
38
+ export interface IEnrollmentConfig {
39
+ readonly hiddenMembershipTypeCodes?: string[];
40
+ readonly manualEnrollment?: IEnabledConfig;
41
+ readonly customerFields?: ICustomerFieldsConfig;
42
+ readonly enrollmentPrompt?: IEnrollmentPromptConfig;
43
+ readonly minimumAgeValidation?: MinimumAgeValidation;
44
+ readonly customOptIn?: ICustomOptInConfig;
45
+ }
46
+ export interface IEnabledConfig {
47
+ readonly enabled?: boolean;
48
+ }
49
+ export interface ICustomerFieldsConfig {
50
+ readonly emailAddress?: ILoyaltyEnrollmentFieldConfig;
51
+ readonly attributes?: ILoyaltyScreenAttributesConfig;
52
+ }
53
+ export interface ILoyaltyScreenAttributesConfig {
54
+ readonly attributeGroupCodes?: string[];
55
+ readonly conditionsToDisableEnrollment?: IConditionalAttributeBehaviorRuleAttributeGroups;
56
+ readonly conditionType?: ConditionType;
57
+ }
58
+ export interface ILoyaltyEnrollmentFieldConfig {
59
+ readonly usage?: FieldUsage;
60
+ readonly displayBehavior?: DisplayBehavior;
61
+ readonly editableBehavior?: DisplayBehavior;
62
+ }
63
+ export interface IEnrollmentPromptConfig {
64
+ readonly appliesTo?: AppliesTo;
65
+ readonly deferralButton?: IDeferralButtonConfig;
66
+ }
67
+ export interface IDeferralButtonConfig {
68
+ readonly enabled?: boolean;
69
+ readonly deferralDays?: number;
70
+ }
71
+ export interface ICustomOptInConfig {
72
+ readonly customOptInDetails: ICustomOptInDetailsConfig;
73
+ readonly conditionsToDisableEnrollment?: IConditionalAttributeBehaviorRuleAttributeGroups;
74
+ readonly conditionType?: ConditionType;
75
+ readonly customerConfirmation?: ICustomerConfirmationConfig;
76
+ }
77
+ export interface ICustomOptInDetailsConfig {
78
+ readonly [key: string]: ICustomOptInContentConfig;
79
+ }
80
+ export interface ICustomOptInContentConfig {
81
+ readonly customOptInTitle: ITranslatableMessage;
82
+ readonly customOptInLink?: ITranslatableMessage;
83
+ readonly customOptInFullDetails?: ITranslatableMessage;
84
+ readonly optInResponseLabel?: ITranslatableMessage;
85
+ readonly customOptInSummary?: ITranslatableMessage;
86
+ readonly customOptInLinks?: ICustomOptInLinksConfig;
87
+ }
88
+ export interface ICustomOptInLinksConfig {
89
+ readonly [key: string]: ITranslatableMessage;
90
+ }
91
+ export interface ICustomerConfirmationConfig {
92
+ readonly enabled: boolean;
93
+ readonly allowBypassConfirmationUponDeviceError: boolean;
94
+ }
95
+ export interface IRedemptionConfig {
96
+ readonly calculateMaxVariableDiscount: boolean;
97
+ readonly automaticLoyaltyRedemptionBehavior: RedemptionBehavior;
98
+ }
99
+ export declare enum AppliesTo {
100
+ None = "None",
101
+ AllQualifyingCustomers = "AllQualifyingCustomers",
102
+ NewCustomersOnly = "NewCustomersOnly"
103
+ }
104
+ export declare enum MinimumAgeValidation {
105
+ NoValidation = "NoValidation",
106
+ PreventEnrollingMinors = "PreventEnrollingMinors",
107
+ PreventEnrollAndSaveWithCustomerTypeMinor = "PreventEnrollAndSaveWithCustomerTypeMinor"
108
+ }
109
+ export declare enum FieldUsage {
110
+ Required = "Required",
111
+ Optional = "Optional",
112
+ NotUsed = "NotUsed"
113
+ }
114
+ export declare enum DisplayBehavior {
115
+ Always = "Always",
116
+ OnlyIfEmpty = "OnlyIfEmpty"
117
+ }
118
+ export declare enum RedemptionBehavior {
119
+ Disabled = "Disabled",
120
+ Prompt = "Prompt",
121
+ ApplyWithoutPrompting = "ApplyWithoutPrompting"
122
+ }
@@ -12,4 +12,33 @@ var AssignCustomerFromOriginalSaleForReturns;
12
12
  AssignCustomerFromOriginalSaleForReturns["AssignWithPrompt"] = "AssignWithPrompt";
13
13
  AssignCustomerFromOriginalSaleForReturns["AssignWithoutPrompt"] = "AssignWithoutPrompt";
14
14
  })(AssignCustomerFromOriginalSaleForReturns = exports.AssignCustomerFromOriginalSaleForReturns || (exports.AssignCustomerFromOriginalSaleForReturns = {}));
15
+ var AppliesTo;
16
+ (function (AppliesTo) {
17
+ AppliesTo["None"] = "None";
18
+ AppliesTo["AllQualifyingCustomers"] = "AllQualifyingCustomers";
19
+ AppliesTo["NewCustomersOnly"] = "NewCustomersOnly";
20
+ })(AppliesTo = exports.AppliesTo || (exports.AppliesTo = {}));
21
+ var MinimumAgeValidation;
22
+ (function (MinimumAgeValidation) {
23
+ MinimumAgeValidation["NoValidation"] = "NoValidation";
24
+ MinimumAgeValidation["PreventEnrollingMinors"] = "PreventEnrollingMinors";
25
+ MinimumAgeValidation["PreventEnrollAndSaveWithCustomerTypeMinor"] = "PreventEnrollAndSaveWithCustomerTypeMinor";
26
+ })(MinimumAgeValidation = exports.MinimumAgeValidation || (exports.MinimumAgeValidation = {}));
27
+ var FieldUsage;
28
+ (function (FieldUsage) {
29
+ FieldUsage["Required"] = "Required";
30
+ FieldUsage["Optional"] = "Optional";
31
+ FieldUsage["NotUsed"] = "NotUsed";
32
+ })(FieldUsage = exports.FieldUsage || (exports.FieldUsage = {}));
33
+ var DisplayBehavior;
34
+ (function (DisplayBehavior) {
35
+ DisplayBehavior["Always"] = "Always";
36
+ DisplayBehavior["OnlyIfEmpty"] = "OnlyIfEmpty";
37
+ })(DisplayBehavior = exports.DisplayBehavior || (exports.DisplayBehavior = {}));
38
+ var RedemptionBehavior;
39
+ (function (RedemptionBehavior) {
40
+ RedemptionBehavior["Disabled"] = "Disabled";
41
+ RedemptionBehavior["Prompt"] = "Prompt";
42
+ RedemptionBehavior["ApplyWithoutPrompting"] = "ApplyWithoutPrompting";
43
+ })(RedemptionBehavior = exports.RedemptionBehavior || (exports.RedemptionBehavior = {}));
15
44
  //# sourceMappingURL=ICustomerConfig.js.map
@@ -27,6 +27,7 @@ export declare abstract class BaseTenderLineDecorator extends BaseLineDecorator<
27
27
  get transactionLineReference(): ITransactionLineReferenceType;
28
28
  get refundedLineReference(): ITransactionLineReferenceType;
29
29
  get originalTenderReferences(): IOriginalTenderReference[];
30
+ get isPreAuthorizationReversal(): boolean;
30
31
  get refunded(): boolean;
31
32
  signatureRequired(): boolean;
32
33
  printDeclineDetails(): boolean;
@@ -51,6 +51,9 @@ class BaseTenderLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
51
51
  get originalTenderReferences() {
52
52
  return this.decoratedTransactionLine.originalTenderReferences;
53
53
  }
54
+ get isPreAuthorizationReversal() {
55
+ return this.decoratedTransactionLine.isPreAuthorizationReversal;
56
+ }
54
57
  get refunded() {
55
58
  return this.decoratedTransactionLine.refunded;
56
59
  }
@@ -26,6 +26,8 @@ export interface ITenderLine extends ITransactionLine, IVoidableLine {
26
26
  readonly adjustmentType?: TenderAdjustmentType;
27
27
  readonly originalTenderReferences?: IOriginalTenderReference[];
28
28
  readonly actionType?: ActionType;
29
+ /** True when this TenderRefund reverses an authorization-only hold (see IAuthorizationResponse.preAuthorizationReversalStatus). */
30
+ readonly isPreAuthorizationReversal?: boolean;
29
31
  readonly tax?: Money;
30
32
  /**
31
33
  * The amount given before the conversion
@@ -78,6 +78,10 @@ export declare class TenderLine extends BaseTransactionLine implements ITenderLi
78
78
  get preventsTransactionVoid(): boolean;
79
79
  get forfeitTenderChangeConfirmed(): boolean;
80
80
  get isPreviouslyCollected(): boolean;
81
+ /**
82
+ * True when this TenderRefund line reverses a tender that was only pre-authorized (authorization reversal).
83
+ */
84
+ get isPreAuthorizationReversal(): boolean;
81
85
  get allowVoid(): boolean;
82
86
  get adjustmentType(): TenderAdjustmentType;
83
87
  get voidingLine(): boolean;
@@ -61,7 +61,19 @@ class TenderLine extends BaseTransactionLine_1.BaseTransactionLine {
61
61
  // The tender could (in the future) be a foreign tender with a currency other than the accounting currency.
62
62
  const accountingCurrency = collectedData.get("accountingCurrency");
63
63
  const extendedAmount = TenderLine.determineExtendedAmount(lineType, tenderAmount, accountingCurrency);
64
- const authResponse = collectedData.get(Constants_1.CollectedDataKey.TenderAuthResponse);
64
+ // Auth payload from qualification (e.g. device response). When PreAuthorizationReversal is collected
65
+ // (order-cancel apply of OMS pre-auth), copy and stamp preAuthorizationReversalStatus so posting/display
66
+ // treat the line as a reversal; default requestType to Refund if none was supplied.
67
+ let mergedAuthResponse = collectedData.get(Constants_1.CollectedDataKey.TenderAuthResponse);
68
+ const rawPreAuthReversal = collectedData.get(Constants_1.CollectedDataKey.PreAuthorizationReversal);
69
+ const preAuthorizationReversalCollected = rawPreAuthReversal === true || rawPreAuthReversal === scp_types_commerce_devices_1.PreAuthorizationReversalStatus.ToBeStarted;
70
+ if (preAuthorizationReversalCollected) {
71
+ mergedAuthResponse = Object.assign({}, (mergedAuthResponse || {}));
72
+ mergedAuthResponse.preAuthorizationReversalStatus = scp_types_commerce_devices_1.PreAuthorizationReversalStatus.ToBeStarted;
73
+ if (mergedAuthResponse.requestType === undefined) {
74
+ mergedAuthResponse.requestType = scp_types_commerce_devices_1.PaymentRequestType.Refund;
75
+ }
76
+ }
65
77
  const authorizationDeviceId = collectedData.get(Constants_1.CollectedDataKey.AuthorizationDeviceId);
66
78
  const preventsTransactionVoid = !!collectedData.get(Constants_1.CollectedDataKey.TenderPreventsTransactionVoid);
67
79
  const adjustmentType = collectedData.get(Constants_1.CollectedDataKey.TenderAdjustmentType);
@@ -81,7 +93,7 @@ class TenderLine extends BaseTransactionLine_1.BaseTransactionLine {
81
93
  const previouslyCollectedTender = collectedData.get(Constants_1.CollectedDataKey.PreviouslyCollectedTender)
82
94
  ? collectedData.get(Constants_1.CollectedDataKey.PreviouslyCollectedTender)
83
95
  : false;
84
- return new TenderLine(lineNumber, lineType, extendedAmount, tenderAuthCategory, tenderType, tenderAmount, authResponse, authorizationDeviceId, preventsTransactionVoid, adjustmentType, transactionLineReference, refundedLineReference, referenceNumber, residentLimit, promptRuleType, originalTenderReferences, actionType, supervisorOverrideLineReference, tax, foreignTenderAmount, exchangeRateValue, exchangeRateManualEntryLineReference, forfeitTenderChangeConfirmed, previouslyCollectedTender);
96
+ return new TenderLine(lineNumber, lineType, extendedAmount, tenderAuthCategory, tenderType, tenderAmount, mergedAuthResponse, authorizationDeviceId, preventsTransactionVoid, adjustmentType, transactionLineReference, refundedLineReference, referenceNumber, residentLimit, promptRuleType, originalTenderReferences, actionType, supervisorOverrideLineReference, tax, foreignTenderAmount, exchangeRateValue, exchangeRateManualEntryLineReference, forfeitTenderChangeConfirmed, previouslyCollectedTender);
85
97
  }
86
98
  static createFromJsonObject(transactionLineJsonObj) {
87
99
  const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
@@ -210,12 +222,20 @@ class TenderLine extends BaseTransactionLine_1.BaseTransactionLine {
210
222
  get isPreviouslyCollected() {
211
223
  return this._previouslyCollectedTender;
212
224
  }
225
+ /**
226
+ * True when this TenderRefund line reverses a tender that was only pre-authorized (authorization reversal).
227
+ */
228
+ get isPreAuthorizationReversal() {
229
+ var _a;
230
+ return ((_a = this._authResponse) === null || _a === void 0 ? void 0 : _a.preAuthorizationReversalStatus) != null;
231
+ }
213
232
  get allowVoid() {
214
233
  var _a;
215
234
  if (this.authResponse &&
216
- this.authResponse.paymentProvider === scp_types_commerce_devices_1.PaymentProvider.Adyen &&
217
235
  this.lineType === exports.TENDER_REFUND_LINE_TYPE &&
218
- ((_a = this.tenderType) === null || _a === void 0 ? void 0 : _a.cardType) !== scp_types_commerce_devices_1.CardType.Gift) {
236
+ ((this.authResponse.paymentProvider === scp_types_commerce_devices_1.PaymentProvider.Adyen &&
237
+ ((_a = this.tenderType) === null || _a === void 0 ? void 0 : _a.cardType) !== scp_types_commerce_devices_1.CardType.Gift) ||
238
+ this.authResponse.preAuthorizationReversalStatus != null)) {
219
239
  //a payment provider was used for a refund that can't be voided, so don't allow voiding
220
240
  return false;
221
241
  }
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.46.0",
3
+ "version": "2.48.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",
@@ -85,8 +85,8 @@
85
85
  "@aptos-scp/scp-component-taxation": "^5.28.0",
86
86
  "@aptos-scp/scp-component-user": "^1.4.0",
87
87
  "@aptos-scp/scp-types-client-registration": "^1.4.0",
88
- "@aptos-scp/scp-types-commerce-devices": "^6.10.0",
89
- "@aptos-scp/scp-types-commerce-transaction": "^1.93.0",
88
+ "@aptos-scp/scp-types-commerce-devices": "^6.12.0",
89
+ "@aptos-scp/scp-types-commerce-transaction": "^1.94.0",
90
90
  "@aptos-scp/scp-types-core": "^1.0.5",
91
91
  "@aptos-scp/scp-types-core-config": "^2.2.1",
92
92
  "@aptos-scp/scp-types-currency-conversion": "^1.2.0",