@aptos-scp/scp-component-store-selling-features-domain-model 2.9.0-patch.3 → 2.9.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.
@@ -161,7 +161,6 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
161
161
  private _prepaidTendersToApply?;
162
162
  private _transactionSubTotalExcludingPreviouslyCollected;
163
163
  private _transactionTotalSavingsExcludingPreviouslyCollected;
164
- private _transactionSubTotalExcPrepaidAndExcTranDisc;
165
164
  private _transactionTotalTaxExcludingPreviouslyCollected;
166
165
  private _balanceDueExcludingPreviouslyCollected;
167
166
  private _transactionTotalExcludingPreviouslyCollected;
@@ -197,7 +196,6 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
197
196
  get transactionTotalTransactionDiscounts(): Money;
198
197
  get transactionTotalTendered(): Money;
199
198
  get transactionTotalTenderedPreviouslyCollected(): Money;
200
- get transactionSubTotalExcPrepaidAndExcTranDisc(): Money;
201
199
  /**
202
200
  * Transaction SubTotal excluding previously collected tendered amount and excluding tax
203
201
  */
@@ -95,7 +95,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
95
95
  this._digestValue = digestValue;
96
96
  this._prepaidTendersToApply = prepaidTendersToApply;
97
97
  this._transactionSubTotalExcludingPreviouslyCollected = new scp_component_business_core_1.Money(0, accountingCurrency);
98
- this._transactionSubTotalExcPrepaidAndExcTranDisc = new scp_component_business_core_1.Money(0, accountingCurrency);
99
98
  this._transactionTotalSavingsExcludingPreviouslyCollected = new scp_component_business_core_1.Money(0, accountingCurrency);
100
99
  this._transactionTotalTaxExcludingPreviouslyCollected = new scp_component_business_core_1.Money(0, accountingCurrency);
101
100
  this._balanceDueExcludingPreviouslyCollected = new scp_component_business_core_1.Money(0, accountingCurrency);
@@ -225,8 +224,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
225
224
  transaction._prepaidTendersToApply = this._prepaidTendersToApply;
226
225
  transaction._transactionSubTotalExcludingPreviouslyCollected =
227
226
  this._transactionSubTotalExcludingPreviouslyCollected;
228
- transaction._transactionSubTotalExcPrepaidAndExcTranDisc =
229
- this._transactionSubTotalExcPrepaidAndExcTranDisc;
230
227
  transaction._transactionTotalSavingsExcludingPreviouslyCollected =
231
228
  this._transactionTotalSavingsExcludingPreviouslyCollected;
232
229
  transaction._transactionTotalTaxExcludingPreviouslyCollected =
@@ -348,9 +345,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
348
345
  get transactionTotalTenderedPreviouslyCollected() {
349
346
  return this._transactionTotalTenderedPreviouslyCollected;
350
347
  }
351
- get transactionSubTotalExcPrepaidAndExcTranDisc() {
352
- return this._transactionSubTotalExcPrepaidAndExcTranDisc;
353
- }
354
348
  /**
355
349
  * Transaction SubTotal excluding previously collected tendered amount and excluding tax
356
350
  */
@@ -858,10 +852,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
858
852
  "transaction.totalTenderedExcludingPreviouslyCollected",
859
853
  this.transactionTotalTenderedExcludingPreviouslyCollected,
860
854
  ],
861
- [
862
- "transaction.transactionSubTotalExcPrepaidAndExcTranDisc",
863
- this._transactionSubTotalExcPrepaidAndExcTranDisc,
864
- ],
865
855
  ["transaction.totalPreviouslyCollectedTenders", this.transactionTotalPreviouslyCollectedTenders],
866
856
  ["transaction.totalTenderedOnOrderCreate", this.transactionTotalTenderedOnOrderCreate],
867
857
  ["transaction.totalChangeTendered", this.transactionTotalChangeTendered],
@@ -1054,7 +1044,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1054
1044
  _digestValue: this._digestValue,
1055
1045
  _prepaidTendersToApply: this.prepaidTendersToApply,
1056
1046
  _transactionSubTotalExcludingPreviouslyCollected: this.transactionSubTotalExcludingPreviouslyCollected,
1057
- _transactionSubTotalExcPrepaidAndExcTranDisc: this.transactionSubTotalExcPrepaidAndExcTranDisc,
1058
1047
  _transactionTotalSavingsExcludingPreviouslyCollected: this.transactionTotalSavingsExcludingPreviouslyCollected,
1059
1048
  _transactionTotalTaxExcludingPreviouslyCollected: this.transactionTotalTaxExcludingPreviouslyCollected,
1060
1049
  _balanceDueExcludingPreviouslyCollected: this.transactionBalanceDueExcludingPreviouslyCollected,
@@ -1210,9 +1199,6 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1210
1199
  this._transactionSubTotalExcludingPreviouslyCollected =
1211
1200
  transactionJsonObj._transactionSubTotalExcludingPreviouslyCollected &&
1212
1201
  new scp_component_business_core_1.Money(transactionJsonObj._transactionSubTotalExcludingPreviouslyCollected);
1213
- this._transactionSubTotalExcPrepaidAndExcTranDisc =
1214
- transactionJsonObj._transactionSubTotalExcPrepaidAndExcTranDisc &&
1215
- new scp_component_business_core_1.Money(transactionJsonObj._transactionSubTotalExcPrepaidAndExcTranDisc);
1216
1202
  this._transactionTotalSavingsExcludingPreviouslyCollected =
1217
1203
  transactionJsonObj._transactionTotalSavingsExcludingPreviouslyCollected &&
1218
1204
  new scp_component_business_core_1.Money(transactionJsonObj._transactionTotalSavingsExcludingPreviouslyCollected);
@@ -7,7 +7,6 @@ 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>;
11
10
  export declare enum TenderSignatureCapturePolicy {
12
11
  AuthResponseOnly = "AuthResponseOnly",
13
12
  ConfigurationOnly = "ConfigurationOnly",
@@ -41,7 +40,6 @@ export interface ITenderGroup {
41
40
  tenderType?: string;
42
41
  groupLabel?: ILabel;
43
42
  subType?: TenderSubType;
44
- refundableAmount?: Money;
45
43
  }
46
44
  export interface IChangeBehaviorDefinition {
47
45
  forfeitChange?: boolean;
@@ -100,7 +98,7 @@ export declare class TenderType {
100
98
  static getActiveConfiguredTenderGroups(container: Container, accountingCurrency: string, activeTenders: TenderType[]): ITenderGroup[];
101
99
  static getActiveRefundConfiguredTenderGroups(container: Container, accountingCurrency: string, withTransaction: boolean, activeTenders: TenderType[], originalTransactionsDetails: IOriginalTransactionDetails[], withOfflineTransaction: boolean): ITenderGroup[];
102
100
  static tenderIsCreditOrDebit(tenderType: any): boolean;
103
- static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money, useGroupRefundableAmount?: boolean): Money;
101
+ static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money): Money;
104
102
  static getFeesTotal(displayInfo: any, accountingCurrency: string): Money;
105
103
  static getTenderedAmountsWithoutTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
106
104
  static getTenderedAmountsWithTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
@@ -161,10 +159,6 @@ export declare class TenderType {
161
159
  private static convertTenderTypeToGroup;
162
160
  private static getActiveCashTenders;
163
161
  }
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(tenderConfig: any, refundCardTypes: any): string[];
168
162
  export declare function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes: TenderType[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): TenderType[];
169
163
  export declare function getRefundableTendersByPaymentRestrictions(originalRefundableTenders: IOriginalTender[], saleItemTypes: string[], diContainer: Container, orderTypes?: string[], productAttributeTypes?: string[]): IOriginalTender[];
170
164
  export declare function getSaleItemTypes(transaction: MerchandiseTransaction): string[];
@@ -173,8 +167,6 @@ export declare function getProductAttributeTypes(transaction: MerchandiseTransac
173
167
  export declare function transactionHasPaymentRestrictionTypes(itemTypes: string[], orderTypes: string[], productAttributeTypes: string[]): boolean;
174
168
  export declare function getPaymentRestrictionBehaviors(diContainer: Container, tenderType: string): IConfigurationValues;
175
169
  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;
178
170
  export declare function tenderIsActive(tenderDef: IConfigurationValues, isRefund: boolean, withTransaction: boolean, withReference: boolean, mappedTender: boolean, offlineTransaction: boolean, accountingCurrency: string): boolean;
179
171
  export declare function findConfiguredTenderFor(activeTenders: TenderType[], responseData: IAuthorizationResponse, tenderAuthCategory?: TenderAuthCategory): TenderType | TenderAuthFailureReasonCode;
180
172
  export declare function getReturnOrCancelTotalAmount(originalTran: IOriginalTransactionDetails): Money;
@@ -183,4 +175,3 @@ export declare function allowWalletSpecificTender(tenderAuthCategory: TenderAuth
183
175
  export declare function paymentDeviceCardExists(activeTenders: TenderType[]): boolean;
184
176
  export declare function walletSpecificTenderExists(activeTenders: TenderType[]): boolean;
185
177
  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
- exports.mapTenderTypeToI18nCode = new Map([
16
+ const 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"],
@@ -88,7 +88,7 @@ class TenderType {
88
88
  var _a, _b;
89
89
  return (((_a = tenderType) === null || _a === void 0 ? void 0 : _a.tenderType) === scp_types_commerce_devices_1.TenderType.Credit || ((_b = tenderType) === null || _b === void 0 ? void 0 : _b.tenderTyp) === scp_types_commerce_devices_1.TenderType.Debit);
90
90
  }
91
- static getRefundableAmountByGroup(group, displayInfo, currency, configuration, refundDue, useGroupRefundableAmount = false) {
91
+ static getRefundableAmountByGroup(group, displayInfo, currency, configuration, refundDue) {
92
92
  var _a, _b, _c, _d;
93
93
  const withoutTransactionTotal = TenderType.getWithoutTransactionTotal(displayInfo, currency, configuration);
94
94
  const withTransactionTotal = TenderType.getWithTransactionTotal(displayInfo, currency, configuration);
@@ -127,19 +127,14 @@ class TenderType {
127
127
  }
128
128
  });
129
129
  let refundableAmount = new scp_component_business_core_1.Money(0, currency);
130
- if (group.refundableAmount && useGroupRefundableAmount) {
131
- refundableAmount = group.refundableAmount;
130
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithTransaction)) {
131
+ refundableAmount = refundableAmount.plus(withTransactionTotal);
132
132
  }
133
- else {
134
- if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithTransaction)) {
135
- refundableAmount = refundableAmount.plus(withTransactionTotal);
136
- }
137
- if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithoutTransaction)) {
138
- refundableAmount = refundableAmount.plus(withoutTransactionTotal);
139
- }
140
- if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) {
141
- refundableAmount = refundableAmount.plus(withOfflineTransactionTotal);
142
- }
133
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithoutTransaction)) {
134
+ refundableAmount = refundableAmount.plus(withoutTransactionTotal);
135
+ }
136
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) {
137
+ refundableAmount = refundableAmount.plus(withOfflineTransactionTotal);
143
138
  }
144
139
  return getLowestRefundDue(refundDue, undefined, refundableAmount);
145
140
  }
@@ -709,7 +704,6 @@ function combineOriginalUnreferencedAndMappedTenders(tender, unreferencedAndMapp
709
704
  unreferencedAndMappedTenders.push(_.cloneDeep(tender));
710
705
  }
711
706
  }
712
- exports.combineOriginalUnreferencedAndMappedTenders = combineOriginalUnreferencedAndMappedTenders;
713
707
  function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTransactionDetails, withTransactionTotal, withoutTransactionTotal, withOfflineTransactionTotal) {
714
708
  var _a;
715
709
  if (!originalTender) {
@@ -777,7 +771,6 @@ function getConfiguredTender(originalTenderId, configurationManager) {
777
771
  return (_b = (_a = configurationManager
778
772
  .getTendersValues()) === null || _a === void 0 ? void 0 : _a.tenderDefinitions) === null || _b === void 0 ? void 0 : _b.find((tender) => tender.tenderId === originalTenderId);
779
773
  }
780
- exports.getConfiguredTender = getConfiguredTender;
781
774
  function getConfiguredMappedTenders(originalTender, configurationManager, transactionId, originalTransactions, refundDue) {
782
775
  var _a, _b, _c, _d, _e, _f;
783
776
  const mappedTenders = [];
@@ -789,12 +782,12 @@ function getConfiguredMappedTenders(originalTender, configurationManager, transa
789
782
  let refundCardTypes;
790
783
  let refundTenderTypes;
791
784
  let excludeCardTypes;
792
- const cardTypeExceptionsForOriginalTender = getCardTypeExceptions(originalTender.tenderId, tenderDefinitions, tenderTypeBehavior);
785
+ const cardTypeExceptionsForOriginalTender = getCardTypeExceptions(originalTender, tenderDefinitions, tenderTypeBehavior);
793
786
  // If the card type for the original tender is defined in the cardTypeExceptions, then use that
794
787
  if (!_.isEmpty(cardTypeExceptionsForOriginalTender)) {
795
788
  refundTenderTypes = cardTypeExceptionsForOriginalTender.refundTenderTypes;
796
789
  refundCardTypes = cardTypeExceptionsForOriginalTender.refundCardTypes;
797
- const mappedCardTypeNames = getMappedCardTypeNames(tenderConfig, refundCardTypes);
790
+ const mappedCardTypeNames = getMappedCardTypeNames(originalTender, tenderConfig, refundCardTypes);
798
791
  excludeCardTypes = mappedCardTypeNames;
799
792
  addCardTypeTendersToMappedTenders(mappedCardTypeNames, tenderDefinitions, mappedTenders, originalTender, transactionId, originalTransactions);
800
793
  }
@@ -826,7 +819,6 @@ function getAllRefundableCardTypes(tenderTypeBehavior) {
826
819
  }
827
820
  return refundableCardTypes;
828
821
  }
829
- exports.getAllRefundableCardTypes = getAllRefundableCardTypes;
830
822
  function addCardTypeTendersToMappedTenders(mappedCardTypeNames, tenderDefinitions, mappedTenders, originalTender, transactionId, originalTransactions) {
831
823
  var _a;
832
824
  (_a = mappedCardTypeNames) === null || _a === void 0 ? void 0 : _a.forEach((cardType) => {
@@ -853,7 +845,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
853
845
  if ((_a = tenderDefs) === null || _a === void 0 ? void 0 : _a.length) {
854
846
  tenderDefs.forEach((tenderDef) => {
855
847
  const label = tenderDef.tenderType === scp_types_commerce_devices_1.TenderType.Cash
856
- ? I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
848
+ ? I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
857
849
  : (tenderDef.tenderLabel &&
858
850
  I18n.t(tenderDef.tenderLabel.i18nCode, {
859
851
  defaultValue: tenderDef.tenderLabel.default,
@@ -863,7 +855,7 @@ function addTenderTypesToMappedTenders(mappedTenderTypeNames, tenderDefinitions,
863
855
  });
864
856
  }
865
857
  else {
866
- const tenderName = I18n.t(exports.mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
858
+ const tenderName = I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
867
859
  mappedTenders.push(buildMappedOriginalTender(originalTender, tenderName, tenderType, undefined, getTenderAuthCategoryFromTenderType(tenderType), transactionId, originalTransactions, undefined, undefined, excludedCardTypes));
868
860
  }
869
861
  });
@@ -878,7 +870,7 @@ function getMappedTenderTypeNames(originalTender, tenderConfig, originalTransact
878
870
  isOriginalTenderAmountAllowed(originalTender, mappedRefundTenderType, originalTransactions, refundDue));
879
871
  }));
880
872
  }
881
- function getMappedCardTypeNames(tenderConfig, refundCardTypes) {
873
+ function getMappedCardTypeNames(originalTender, tenderConfig, refundCardTypes) {
882
874
  return (refundCardTypes &&
883
875
  Object.keys(refundCardTypes).filter((cardType) => {
884
876
  const mappedRefundCardType = refundCardTypes[cardType];
@@ -887,7 +879,6 @@ function getMappedCardTypeNames(tenderConfig, refundCardTypes) {
887
879
  (!mappedRefundCardType.hasOwnProperty("allowed") || mappedRefundCardType["allowed"] === true));
888
880
  }));
889
881
  }
890
- exports.getMappedCardTypeNames = getMappedCardTypeNames;
891
882
  function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes, saleItemTypes, diContainer, orderTypes, productAttributeTypes) {
892
883
  let nonRestrictedTenderTypes = [];
893
884
  let restrictedTenderTypes = [];
@@ -1138,7 +1129,6 @@ function sortOriginalTenders(originalTenders) {
1138
1129
  return a.originalTenderAmount.gt(b.originalTenderAmount) ? -1 : 0;
1139
1130
  });
1140
1131
  }
1141
- exports.sortOriginalTenders = sortOriginalTenders;
1142
1132
  function allowMappedTender(tenderType, tenderConfig) {
1143
1133
  return tenderConfig.tenderDefinitions.some((tender) => { var _a; return tender.tenderType === tenderType && ((_a = tender.allowRefund) === null || _a === void 0 ? void 0 : _a.indexOf("WhenMapped")) > -1; });
1144
1134
  }
@@ -1177,7 +1167,6 @@ function buildMappedOriginalTender(originalTender, tenderName, tenderType, tende
1177
1167
  mappedOriginTenderId: originalTender.tenderId,
1178
1168
  };
1179
1169
  }
1180
- exports.buildMappedOriginalTender = buildMappedOriginalTender;
1181
1170
  function isOriginalTenderFullyRefunded(originalTender, returnTotalAmount) {
1182
1171
  var _a;
1183
1172
  const totalRefundedAmount = originalTender &&
@@ -1627,15 +1616,14 @@ function getChangeAmount(balanceDue, tenderAmount) {
1627
1616
  return tenderAmount.minus(balanceDue);
1628
1617
  }
1629
1618
  }
1630
- function getCardTypeExceptions(tenderId, tenderDefinitions, tenderTypeBehavior) {
1619
+ function getCardTypeExceptions(originalTender, tenderDefinitions, tenderTypeBehavior) {
1631
1620
  var _a, _b;
1632
1621
  // Find the tender definition for the original tender
1633
- const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId === tenderId);
1622
+ const originalTenderDefinition = tenderDefinitions.find((tender) => tender.tenderId === originalTender.tenderId);
1634
1623
  // If
1635
1624
  if (originalTenderDefinition && ((_b = (_a = tenderTypeBehavior) === null || _a === void 0 ? void 0 : _a.cardTypeExceptions) === null || _b === void 0 ? void 0 : _b.enabled)) {
1636
1625
  // Is there an entry for the card type in the cardTypeExceptions?
1637
1626
  return tenderTypeBehavior.cardTypeExceptions[originalTenderDefinition.cardType];
1638
1627
  }
1639
1628
  }
1640
- exports.getCardTypeExceptions = getCardTypeExceptions;
1641
1629
  //# 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.9.0-patch.3",
3
+ "version": "2.9.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",