@aptos-scp/scp-component-store-selling-features-domain-model 2.19.1 → 2.19.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.
|
@@ -7,6 +7,7 @@ import { AllowRefund } from "./configuration/ITendersConfig";
|
|
|
7
7
|
import { ILabel, IPinRules, OverTenderRule, TenderAuthCategory } from "./Constants";
|
|
8
8
|
import { MerchandiseTransaction } from "./MerchandiseTransaction";
|
|
9
9
|
import { IOriginalTender, IOriginalTransactionDetails } from "./TenderHandlingSession";
|
|
10
|
+
export declare const mapTenderTypeToI18nCode: Map<string, string>;
|
|
10
11
|
export declare enum TenderSignatureCapturePolicy {
|
|
11
12
|
AuthResponseOnly = "AuthResponseOnly",
|
|
12
13
|
ConfigurationOnly = "ConfigurationOnly",
|
|
@@ -160,6 +161,10 @@ export declare class TenderType {
|
|
|
160
161
|
private static convertTenderTypeToGroup;
|
|
161
162
|
private static getActiveCashTenders;
|
|
162
163
|
}
|
|
164
|
+
export declare function combineOriginalUnreferencedAndMappedTenders(tender: IOriginalTender, unreferencedAndMappedTenders: IOriginalTender[]): void;
|
|
165
|
+
export declare function getConfiguredTender(originalTenderId: string, configurationManager: IConfigurationManager): any;
|
|
166
|
+
export declare function getAllRefundableCardTypes(tenderTypeBehavior: any): string[];
|
|
167
|
+
export declare function getMappedCardTypeNames(originalTender: IOriginalTender, tenderConfig: any, refundCardTypes: any): string[];
|
|
163
168
|
export declare function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes: TenderType[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): TenderType[];
|
|
164
169
|
export declare function getRefundableTendersByPaymentRestrictions(originalRefundableTenders: IOriginalTender[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): IOriginalTender[];
|
|
165
170
|
export declare function getSaleItemTypes(transaction: MerchandiseTransaction): string[];
|
|
@@ -168,6 +173,8 @@ export declare function getProductAttributeTypes(transaction: MerchandiseTransac
|
|
|
168
173
|
export declare function transactionHasPaymentRestrictionTypes(itemTypes: string[], orderTypes: string[], productAttributeTypes: string[]): boolean;
|
|
169
174
|
export declare function getPaymentRestrictionBehaviors(diContainer: Container, tenderType: string): IConfigurationValues;
|
|
170
175
|
export declare function isPaymentRestrictionBehaviorsConfigured(diContainer: Container, activeTenderTypes: TenderType[]): boolean;
|
|
176
|
+
export declare function sortOriginalTenders(originalTenders: IOriginalTender[]): IOriginalTender[];
|
|
177
|
+
export declare function buildMappedOriginalTender(originalTender: IOriginalTender, tenderName: string, tenderType: string, tenderId: string, tenderAuthCategory: TenderAuthCategory, transactionId: string, originalTransactions: IOriginalTransactionDetails[], subType: TenderSubType, cardType?: string, excludedCardTypes?: string[]): IOriginalTender;
|
|
171
178
|
export declare function tenderIsActive(tenderDef: IConfigurationValues, isRefund: boolean, withTransaction: boolean, withReference: boolean, mappedTender: boolean, offlineTransaction: boolean, accountingCurrency: string): boolean;
|
|
172
179
|
export declare function findConfiguredTenderFor(activeTenders: TenderType[], responseData: IAuthorizationResponse, tenderAuthCategory?: TenderAuthCategory): TenderType | TenderAuthFailureReasonCode;
|
|
173
180
|
export declare function getReturnOrCancelTotalAmount(originalTran: IOriginalTransactionDetails): Money;
|
|
@@ -176,3 +183,4 @@ export declare function allowWalletSpecificTender(tenderAuthCategory: TenderAuth
|
|
|
176
183
|
export declare function paymentDeviceCardExists(activeTenders: TenderType[]): boolean;
|
|
177
184
|
export declare function walletSpecificTenderExists(activeTenders: TenderType[]): boolean;
|
|
178
185
|
export declare function getTenderAuthCategoryFromTenderType(tenderType: string): TenderAuthCategory;
|
|
186
|
+
export declare function getCardTypeExceptions(tenderId: string, tenderDefinitions: any, tenderTypeBehavior: any): any;
|
|
@@ -13,7 +13,7 @@ const ItemLine_1 = require("./item/ItemLine");
|
|
|
13
13
|
const utility_1 = require("../utility");
|
|
14
14
|
const TenderHandlingSession_1 = require("./TenderHandlingSession");
|
|
15
15
|
const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.storesellingfeatures.domain.model.tendertype");
|
|
16
|
-
|
|
16
|
+
exports.mapTenderTypeToI18nCode = new Map([
|
|
17
17
|
[scp_types_commerce_devices_1.TenderType.Credit, "tenderTypeCredit"],
|
|
18
18
|
[scp_types_commerce_devices_1.TenderType.Debit, "tenderTypeDebit"],
|
|
19
19
|
[scp_types_commerce_devices_1.TenderType.Cash, "tenderTypeCash"],
|
|
@@ -709,6 +709,7 @@ function combineOriginalUnreferencedAndMappedTenders(tender, unreferencedAndMapp
|
|
|
709
709
|
unreferencedAndMappedTenders.push(_.cloneDeep(tender));
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
+
exports.combineOriginalUnreferencedAndMappedTenders = combineOriginalUnreferencedAndMappedTenders;
|
|
712
713
|
function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTransactionDetails, withTransactionTotal, withoutTransactionTotal, withOfflineTransactionTotal) {
|
|
713
714
|
var _a;
|
|
714
715
|
if (!originalTender) {
|
|
@@ -776,6 +777,7 @@ function getConfiguredTender(originalTenderId, configurationManager) {
|
|
|
776
777
|
return (_b = (_a = configurationManager
|
|
777
778
|
.getTendersValues()) === null || _a === void 0 ? void 0 : _a.tenderDefinitions) === null || _b === void 0 ? void 0 : _b.find((tender) => tender.tenderId === originalTenderId);
|
|
778
779
|
}
|
|
780
|
+
exports.getConfiguredTender = getConfiguredTender;
|
|
779
781
|
function getConfiguredMappedTenders(originalTender, configurationManager, transactionId, originalTransactions, refundDue) {
|
|
780
782
|
var _a, _b, _c, _d, _e, _f;
|
|
781
783
|
const mappedTenders = [];
|
|
@@ -787,7 +789,7 @@ function getConfiguredMappedTenders(originalTender, configurationManager, transa
|
|
|
787
789
|
let refundCardTypes;
|
|
788
790
|
let refundTenderTypes;
|
|
789
791
|
let excludeCardTypes;
|
|
790
|
-
const cardTypeExceptionsForOriginalTender = getCardTypeExceptions(originalTender, tenderDefinitions, tenderTypeBehavior);
|
|
792
|
+
const cardTypeExceptionsForOriginalTender = getCardTypeExceptions(originalTender.tenderId, tenderDefinitions, tenderTypeBehavior);
|
|
791
793
|
// If the card type for the original tender is defined in the cardTypeExceptions, then use that
|
|
792
794
|
if (!_.isEmpty(cardTypeExceptionsForOriginalTender)) {
|
|
793
795
|
refundTenderTypes = cardTypeExceptionsForOriginalTender.refundTenderTypes;
|
|
@@ -824,6 +826,7 @@ function getAllRefundableCardTypes(tenderTypeBehavior) {
|
|
|
824
826
|
}
|
|
825
827
|
return refundableCardTypes;
|
|
826
828
|
}
|
|
829
|
+
exports.getAllRefundableCardTypes = getAllRefundableCardTypes;
|
|
827
830
|
function addCardTypeTendersToMappedTenders(mappedCardTypeNames, tenderDefinitions, mappedTenders, originalTender, transactionId, originalTransactions) {
|
|
828
831
|
var _a;
|
|
829
832
|
(_a = mappedCardTypeNames) === null || _a === void 0 ? void 0 : _a.forEach((cardType) => {
|
|
@@ -850,7 +853,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
|
|
|
850
853
|
if ((_a = tenderDefs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
851
854
|
tenderDefs.forEach((tenderDef) => {
|
|
852
855
|
const label = tenderDef.tenderType === scp_types_commerce_devices_1.TenderType.Cash
|
|
853
|
-
? I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
|
|
856
|
+
? I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
|
|
854
857
|
: (tenderDef.tenderLabel &&
|
|
855
858
|
I18n.t(tenderDef.tenderLabel.i18nCode, {
|
|
856
859
|
defaultValue: tenderDef.tenderLabel.default,
|
|
@@ -860,7 +863,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
|
|
|
860
863
|
});
|
|
861
864
|
}
|
|
862
865
|
else {
|
|
863
|
-
const tenderName = I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
|
|
866
|
+
const tenderName = I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
|
|
864
867
|
mappedTenders.push(buildMappedOriginalTender(originalTender, tenderName, tenderType, undefined, getTenderAuthCategoryFromTenderType(tenderType), transactionId, originalTransactions, undefined, undefined, excludedCardTypes));
|
|
865
868
|
}
|
|
866
869
|
});
|
|
@@ -884,6 +887,7 @@ function getMappedCardTypeNames(originalTender, tenderConfig, refundCardTypes) {
|
|
|
884
887
|
(!mappedRefundCardType.hasOwnProperty("allowed") || mappedRefundCardType["allowed"] === true));
|
|
885
888
|
}));
|
|
886
889
|
}
|
|
890
|
+
exports.getMappedCardTypeNames = getMappedCardTypeNames;
|
|
887
891
|
function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes, saleItemTypes, diContainer, orderTypes, productAttributeTypes) {
|
|
888
892
|
let nonRestrictedTenderTypes = [];
|
|
889
893
|
let restrictedTenderTypes = [];
|
|
@@ -1134,6 +1138,7 @@ function sortOriginalTenders(originalTenders) {
|
|
|
1134
1138
|
return a.originalTenderAmount.gt(b.originalTenderAmount) ? -1 : 0;
|
|
1135
1139
|
});
|
|
1136
1140
|
}
|
|
1141
|
+
exports.sortOriginalTenders = sortOriginalTenders;
|
|
1137
1142
|
function allowMappedTender(tenderType, tenderConfig) {
|
|
1138
1143
|
return tenderConfig.tenderDefinitions.some((tender) => { var _a; return tender.tenderType === tenderType && ((_a = tender.allowRefund) === null || _a === void 0 ? void 0 : _a.indexOf("WhenMapped")) > -1; });
|
|
1139
1144
|
}
|
|
@@ -1172,6 +1177,7 @@ function buildMappedOriginalTender(originalTender, tenderName, tenderType, tende
|
|
|
1172
1177
|
mappedOriginTenderId: originalTender.tenderId,
|
|
1173
1178
|
};
|
|
1174
1179
|
}
|
|
1180
|
+
exports.buildMappedOriginalTender = buildMappedOriginalTender;
|
|
1175
1181
|
function isOriginalTenderFullyRefunded(originalTender, returnTotalAmount) {
|
|
1176
1182
|
var _a;
|
|
1177
1183
|
const totalRefundedAmount = originalTender &&
|
|
@@ -1621,14 +1627,15 @@ function getChangeAmount(balanceDue, tenderAmount) {
|
|
|
1621
1627
|
return tenderAmount.minus(balanceDue);
|
|
1622
1628
|
}
|
|
1623
1629
|
}
|
|
1624
|
-
function getCardTypeExceptions(
|
|
1630
|
+
function getCardTypeExceptions(tenderId, tenderDefinitions, tenderTypeBehavior) {
|
|
1625
1631
|
var _a, _b;
|
|
1626
1632
|
// Find the tender definition for the original tender
|
|
1627
|
-
const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId ===
|
|
1633
|
+
const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId === tenderId);
|
|
1628
1634
|
// If
|
|
1629
1635
|
if (originalTenderDefinition && ((_b = (_a = tenderTypeBehavior) === null || _a === void 0 ? void 0 : _a.cardTypeExceptions) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
1630
1636
|
// Is there an entry for the card type in the cardTypeExceptions?
|
|
1631
1637
|
return tenderTypeBehavior.cardTypeExceptions[originalTenderDefinition.cardType];
|
|
1632
1638
|
}
|
|
1633
1639
|
}
|
|
1640
|
+
exports.getCardTypeExceptions = getCardTypeExceptions;
|
|
1634
1641
|
//# sourceMappingURL=TenderType.js.map
|
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.19.
|
|
3
|
+
"version": "2.19.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",
|