@aptos-scp/scp-component-store-selling-features-domain-model 2.19.0 → 2.19.2

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.
@@ -1321,14 +1321,11 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1321
1321
  });
1322
1322
  }
1323
1323
  taxIncludedInPrice() {
1324
- const transactionTax = this.transactionTaxes && _.first(this.transactionTaxes);
1325
- const taxAuthority = transactionTax && transactionTax.taxAuthorities && _.first(transactionTax.taxAuthorities);
1326
- if (taxAuthority &&
1327
- taxAuthority.taxByRule &&
1328
- taxAuthority.taxByRule.find((rule) => rule.taxIncludedInPrice)) {
1329
- return true;
1330
- }
1331
- return false;
1324
+ var _a, _b;
1325
+ return (_b = (_a = this.transactionTaxes) === null || _a === void 0 ? void 0 : _a.some((tax) => {
1326
+ var _a;
1327
+ return (_a = tax.taxAuthorities) === null || _a === void 0 ? void 0 : _a.some((authority) => { var _a; return (_a = authority.taxByRule) === null || _a === void 0 ? void 0 : _a.some((rule) => rule.taxIncludedInPrice); });
1328
+ }), (_b !== null && _b !== void 0 ? _b : false));
1332
1329
  }
1333
1330
  convertAmountToAccountingCurrency(amount) {
1334
1331
  if (amount === undefined || isNaN(+amount)) {
@@ -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,9 @@ 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 getMappedCardTypeNames(originalTender: IOriginalTender, tenderConfig: any, refundCardTypes: any): string[];
163
167
  export declare function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes: TenderType[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): TenderType[];
164
168
  export declare function getRefundableTendersByPaymentRestrictions(originalRefundableTenders: IOriginalTender[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): IOriginalTender[];
165
169
  export declare function getSaleItemTypes(transaction: MerchandiseTransaction): string[];
@@ -168,6 +172,8 @@ export declare function getProductAttributeTypes(transaction: MerchandiseTransac
168
172
  export declare function transactionHasPaymentRestrictionTypes(itemTypes: string[], orderTypes: string[], productAttributeTypes: string[]): boolean;
169
173
  export declare function getPaymentRestrictionBehaviors(diContainer: Container, tenderType: string): IConfigurationValues;
170
174
  export declare function isPaymentRestrictionBehaviorsConfigured(diContainer: Container, activeTenderTypes: TenderType[]): boolean;
175
+ export declare function sortOriginalTenders(originalTenders: IOriginalTender[]): IOriginalTender[];
176
+ 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
177
  export declare function tenderIsActive(tenderDef: IConfigurationValues, isRefund: boolean, withTransaction: boolean, withReference: boolean, mappedTender: boolean, offlineTransaction: boolean, accountingCurrency: string): boolean;
172
178
  export declare function findConfiguredTenderFor(activeTenders: TenderType[], responseData: IAuthorizationResponse, tenderAuthCategory?: TenderAuthCategory): TenderType | TenderAuthFailureReasonCode;
173
179
  export declare function getReturnOrCancelTotalAmount(originalTran: IOriginalTransactionDetails): Money;
@@ -176,3 +182,4 @@ export declare function allowWalletSpecificTender(tenderAuthCategory: TenderAuth
176
182
  export declare function paymentDeviceCardExists(activeTenders: TenderType[]): boolean;
177
183
  export declare function walletSpecificTenderExists(activeTenders: TenderType[]): boolean;
178
184
  export declare function getTenderAuthCategoryFromTenderType(tenderType: string): TenderAuthCategory;
185
+ 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
- const mapTenderTypeToI18nCode = new Map([
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;
@@ -850,7 +852,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
850
852
  if ((_a = tenderDefs) === null || _a === void 0 ? void 0 : _a.length) {
851
853
  tenderDefs.forEach((tenderDef) => {
852
854
  const label = tenderDef.tenderType === scp_types_commerce_devices_1.TenderType.Cash
853
- ? I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
855
+ ? I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
854
856
  : (tenderDef.tenderLabel &&
855
857
  I18n.t(tenderDef.tenderLabel.i18nCode, {
856
858
  defaultValue: tenderDef.tenderLabel.default,
@@ -860,7 +862,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
860
862
  });
861
863
  }
862
864
  else {
863
- const tenderName = I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
865
+ const tenderName = I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
864
866
  mappedTenders.push(buildMappedOriginalTender(originalTender, tenderName, tenderType, undefined, getTenderAuthCategoryFromTenderType(tenderType), transactionId, originalTransactions, undefined, undefined, excludedCardTypes));
865
867
  }
866
868
  });
@@ -884,6 +886,7 @@ function getMappedCardTypeNames(originalTender, tenderConfig, refundCardTypes) {
884
886
  (!mappedRefundCardType.hasOwnProperty("allowed") || mappedRefundCardType["allowed"] === true));
885
887
  }));
886
888
  }
889
+ exports.getMappedCardTypeNames = getMappedCardTypeNames;
887
890
  function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes, saleItemTypes, diContainer, orderTypes, productAttributeTypes) {
888
891
  let nonRestrictedTenderTypes = [];
889
892
  let restrictedTenderTypes = [];
@@ -1134,6 +1137,7 @@ function sortOriginalTenders(originalTenders) {
1134
1137
  return a.originalTenderAmount.gt(b.originalTenderAmount) ? -1 : 0;
1135
1138
  });
1136
1139
  }
1140
+ exports.sortOriginalTenders = sortOriginalTenders;
1137
1141
  function allowMappedTender(tenderType, tenderConfig) {
1138
1142
  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
1143
  }
@@ -1172,6 +1176,7 @@ function buildMappedOriginalTender(originalTender, tenderName, tenderType, tende
1172
1176
  mappedOriginTenderId: originalTender.tenderId,
1173
1177
  };
1174
1178
  }
1179
+ exports.buildMappedOriginalTender = buildMappedOriginalTender;
1175
1180
  function isOriginalTenderFullyRefunded(originalTender, returnTotalAmount) {
1176
1181
  var _a;
1177
1182
  const totalRefundedAmount = originalTender &&
@@ -1621,14 +1626,15 @@ function getChangeAmount(balanceDue, tenderAmount) {
1621
1626
  return tenderAmount.minus(balanceDue);
1622
1627
  }
1623
1628
  }
1624
- function getCardTypeExceptions(originalTender, tenderDefinitions, tenderTypeBehavior) {
1629
+ function getCardTypeExceptions(tenderId, tenderDefinitions, tenderTypeBehavior) {
1625
1630
  var _a, _b;
1626
1631
  // Find the tender definition for the original tender
1627
- const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId === originalTender.tenderId);
1632
+ const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId === tenderId);
1628
1633
  // If
1629
1634
  if (originalTenderDefinition && ((_b = (_a = tenderTypeBehavior) === null || _a === void 0 ? void 0 : _a.cardTypeExceptions) === null || _b === void 0 ? void 0 : _b.enabled)) {
1630
1635
  // Is there an entry for the card type in the cardTypeExceptions?
1631
1636
  return tenderTypeBehavior.cardTypeExceptions[originalTenderDefinition.cardType];
1632
1637
  }
1633
1638
  }
1639
+ exports.getCardTypeExceptions = getCardTypeExceptions;
1634
1640
  //# 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.0",
3
+ "version": "2.19.2",
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",