@aptos-scp/scp-component-store-selling-features-domain-model 2.47.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.
- package/lib/domain/UIBusinessEventTypes.js +1 -1
- package/lib/domain/model/Constants.d.ts +9 -0
- package/lib/domain/model/Constants.js +9 -0
- package/lib/domain/model/TenderType.js +5 -2
- package/lib/domain/model/tender/BaseTenderLineDecorator.d.ts +1 -0
- package/lib/domain/model/tender/BaseTenderLineDecorator.js +3 -0
- package/lib/domain/model/tender/ITenderLine.d.ts +2 -0
- package/lib/domain/model/tender/TenderLine.d.ts +4 -0
- package/lib/domain/model/tender/TenderLine.js +24 -4
- package/package.json +3 -3
|
@@ -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",
|
|
@@ -986,6 +990,11 @@ export declare enum CollectedDataKey {
|
|
|
986
990
|
PrepaidTaxAmount = "prepaidTaxAmount",
|
|
987
991
|
PrepaidSavingsAmount = "prepaidSavingsAmount",
|
|
988
992
|
PreviouslyCollectedTender = "previouslyCollectedTender",
|
|
993
|
+
/**
|
|
994
|
+
* When ToBeStarted (or legacy boolean true) as collected data with TenderAuthResponse,
|
|
995
|
+
* merges IAuthorizationResponse.preAuthorizationReversalStatus.
|
|
996
|
+
*/
|
|
997
|
+
PreAuthorizationReversal = "PreAuthorizationReversal",
|
|
989
998
|
PresetRateExemption = "presetRateExemption",
|
|
990
999
|
PresetExemptionCategory = "presetExemptionCategory",
|
|
991
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";
|
|
@@ -993,6 +997,11 @@ var CollectedDataKey;
|
|
|
993
997
|
CollectedDataKey["PrepaidTaxAmount"] = "prepaidTaxAmount";
|
|
994
998
|
CollectedDataKey["PrepaidSavingsAmount"] = "prepaidSavingsAmount";
|
|
995
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";
|
|
996
1005
|
CollectedDataKey["PresetRateExemption"] = "presetRateExemption";
|
|
997
1006
|
CollectedDataKey["PresetExemptionCategory"] = "presetExemptionCategory";
|
|
998
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 = ((
|
|
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) {
|
|
@@ -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
|
-
|
|
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,
|
|
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
|
-
((
|
|
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.
|
|
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.
|
|
89
|
-
"@aptos-scp/scp-types-commerce-transaction": "^1.
|
|
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",
|