@aptos-scp/scp-component-store-selling-features-domain-model 2.10.4 → 2.10.6

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.
@@ -154,7 +154,8 @@ export declare class StoreItem implements ISourceIndication, IStoreItemDescripto
154
154
  isEmployeeDiscountAllowed(): boolean;
155
155
  private static extractRetailLocationSpecificItemData;
156
156
  private static calculatePermanentPrice;
157
- private static calculatePermanentPriceAtLevel;
157
+ private static calculateBasePermanentPriceAtLevel;
158
+ private static calculatePermanentPriceChangeAtLevel;
158
159
  private static calculateTemporaryPrice;
159
160
  private static calculateTemporaryPriceAtLevel;
160
161
  private static temporaryPriceEffectiveDateTime;
@@ -490,7 +490,7 @@ class StoreItem {
490
490
  return { storeGroupItem, retailStoreItem };
491
491
  }
492
492
  static calculatePermanentPrice(itemToConvert, storeGroupItem, retailStoreItem, accountingCurrency) {
493
- let permanentPrice = StoreItem.calculatePermanentPriceAtLevel(retailStoreItem, accountingCurrency);
493
+ let permanentPrice = StoreItem.calculatePermanentPriceChangeAtLevel(retailStoreItem, accountingCurrency);
494
494
  if (permanentPrice) {
495
495
  return {
496
496
  price: permanentPrice.price,
@@ -500,7 +500,7 @@ class StoreItem {
500
500
  },
501
501
  };
502
502
  }
503
- permanentPrice = StoreItem.calculatePermanentPriceAtLevel(storeGroupItem, accountingCurrency);
503
+ permanentPrice = StoreItem.calculatePermanentPriceChangeAtLevel(storeGroupItem, accountingCurrency);
504
504
  if (permanentPrice) {
505
505
  return {
506
506
  price: permanentPrice.price,
@@ -510,7 +510,37 @@ class StoreItem {
510
510
  },
511
511
  };
512
512
  }
513
- permanentPrice = StoreItem.calculatePermanentPriceAtLevel(itemToConvert, accountingCurrency);
513
+ permanentPrice = StoreItem.calculatePermanentPriceChangeAtLevel(itemToConvert, accountingCurrency);
514
+ if (permanentPrice) {
515
+ return {
516
+ price: permanentPrice.price,
517
+ source: {
518
+ organizationScope: scp_component_store_items_1.OrganizationScope.AllRetailLocations,
519
+ changeScope: permanentPrice.changeScope,
520
+ },
521
+ };
522
+ }
523
+ permanentPrice = StoreItem.calculateBasePermanentPriceAtLevel(retailStoreItem, accountingCurrency);
524
+ if (permanentPrice) {
525
+ return {
526
+ price: permanentPrice.price,
527
+ source: {
528
+ organizationScope: scp_component_store_items_1.OrganizationScope.OneRetailLocation,
529
+ changeScope: permanentPrice.changeScope,
530
+ },
531
+ };
532
+ }
533
+ permanentPrice = StoreItem.calculateBasePermanentPriceAtLevel(storeGroupItem, accountingCurrency);
534
+ if (permanentPrice) {
535
+ return {
536
+ price: permanentPrice.price,
537
+ source: {
538
+ organizationScope: scp_component_store_items_1.OrganizationScope.RetailLocationsGroup,
539
+ changeScope: permanentPrice.changeScope,
540
+ },
541
+ };
542
+ }
543
+ permanentPrice = StoreItem.calculateBasePermanentPriceAtLevel(itemToConvert, accountingCurrency);
514
544
  if (permanentPrice) {
515
545
  return {
516
546
  price: permanentPrice.price,
@@ -521,8 +551,19 @@ class StoreItem {
521
551
  };
522
552
  }
523
553
  }
524
- static calculatePermanentPriceAtLevel(item, accountingCurrency) {
525
- var _a, _b;
554
+ static calculateBasePermanentPriceAtLevel(item, accountingCurrency) {
555
+ var _a;
556
+ if (accountingCurrency && item) {
557
+ const price2 = item.permanentPrice;
558
+ if (((_a = price2) === null || _a === void 0 ? void 0 : _a.currency) === accountingCurrency) {
559
+ const price = StoreItem.convertStoreItemComponentIPriceToPrice(price2);
560
+ return { price, changeScope: scp_component_store_items_1.PriceChangeLevelType.Item };
561
+ }
562
+ }
563
+ return undefined;
564
+ }
565
+ static calculatePermanentPriceChangeAtLevel(item, accountingCurrency) {
566
+ var _a;
526
567
  if (accountingCurrency && item) {
527
568
  if (item.effectivePricing) {
528
569
  const price1 = item.effectivePricing.permanentPrice;
@@ -531,11 +572,6 @@ class StoreItem {
531
572
  return { price, changeScope: item.effectivePricing.permanentPriceSource };
532
573
  }
533
574
  }
534
- const price2 = item.permanentPrice;
535
- if (((_b = price2) === null || _b === void 0 ? void 0 : _b.currency) === accountingCurrency) {
536
- const price = StoreItem.convertStoreItemComponentIPriceToPrice(price2);
537
- return { price, changeScope: scp_component_store_items_1.PriceChangeLevelType.Item };
538
- }
539
575
  }
540
576
  return undefined;
541
577
  }
@@ -40,6 +40,7 @@ export interface ITenderGroup {
40
40
  tenderType?: string;
41
41
  groupLabel?: ILabel;
42
42
  subType?: TenderSubType;
43
+ refundableAmount?: Money;
43
44
  }
44
45
  export interface IChangeBehaviorDefinition {
45
46
  forfeitChange?: boolean;
@@ -98,7 +99,7 @@ export declare class TenderType {
98
99
  static getActiveConfiguredTenderGroups(container: Container, accountingCurrency: string, activeTenders: TenderType[]): ITenderGroup[];
99
100
  static getActiveRefundConfiguredTenderGroups(container: Container, accountingCurrency: string, withTransaction: boolean, activeTenders: TenderType[], originalTransactionsDetails: IOriginalTransactionDetails[], withOfflineTransaction: boolean): ITenderGroup[];
100
101
  static tenderIsCreditOrDebit(tenderType: any): boolean;
101
- static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money): Money;
102
+ static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money, useGroupRefundableAmount?: boolean): Money;
102
103
  static getFeesTotal(displayInfo: any, accountingCurrency: string): Money;
103
104
  static getTenderedAmountsWithoutTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
104
105
  static getTenderedAmountsWithTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
@@ -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) {
91
+ static getRefundableAmountByGroup(group, displayInfo, currency, configuration, refundDue, useGroupRefundableAmount = false) {
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,14 +127,19 @@ class TenderType {
127
127
  }
128
128
  });
129
129
  let refundableAmount = new scp_component_business_core_1.Money(0, currency);
130
- if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithTransaction)) {
131
- refundableAmount = refundableAmount.plus(withTransactionTotal);
130
+ if (group.refundableAmount && useGroupRefundableAmount) {
131
+ refundableAmount = group.refundableAmount;
132
132
  }
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);
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
+ }
138
143
  }
139
144
  return getLowestRefundDue(refundDue, undefined, refundableAmount);
140
145
  }
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.10.4",
3
+ "version": "2.10.6",
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",
@@ -202,13 +202,5 @@
202
202
  "extends": [
203
203
  "@aptos-scp/scp-component-commit-configs/.commitlintrc.js"
204
204
  ]
205
- },
206
- "release": {
207
- "repositoryUrl": "https://auth@bitbucket.org/aptosretail/scp-component-store-selling-features-domain-model.git",
208
- "tagFormat": "@aptos-scp/scp-component-store-selling-features-domain-model@${version}",
209
- "extends": [
210
- "@aptos-scp/scp-component-commit-configs/releaserc.config.js"
211
- ],
212
- "npmPublish": true
213
205
  }
214
206
  }