@aptos-scp/scp-component-store-selling-features-domain-model 1.32.0 → 1.33.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.
@@ -1,6 +1,6 @@
1
1
  import { Container } from "inversify";
2
2
  import { Money } from "@aptos-scp/scp-component-business-core";
3
- import { IConfigurationValues } from "@aptos-scp/scp-component-store-selling-core";
3
+ import { IConfigurationManager, IConfigurationValues } from "@aptos-scp/scp-component-store-selling-core";
4
4
  import { CardType, EntryMethod, IAuthorizationResponse, TenderSubType } from "@aptos-scp/scp-types-commerce-devices";
5
5
  import { TenderAuthFailureReasonCode } from "@aptos-scp/scp-types-commerce-transaction";
6
6
  import { AllowRefund } from "./configuration/ITendersConfig";
@@ -97,9 +97,10 @@ export declare class TenderType {
97
97
  static getActiveConfiguredTenderGroups(container: Container, accountingCurrency: string, activeTenders: TenderType[]): ITenderGroup[];
98
98
  static getActiveRefundConfiguredTenderGroups(container: Container, accountingCurrency: string, withTransaction: boolean, activeTenders: TenderType[], originalTransactionsDetails: IOriginalTransactionDetails[], withOfflineTransaction: boolean): ITenderGroup[];
99
99
  static tenderIsCreditOrDebit(tenderType: any): boolean;
100
- static getWithoutTransactionTotal(displayInfo: any, accountingCurrency: string): Money;
101
- static getWithTransactionTotal(displayInfo: any, accountingCurrency: string): Money;
102
- static getWithOfflineTransactionTotal(displayInfo: any, accountingCurrency: string): Money;
100
+ static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money): Money;
101
+ static getWithoutTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
102
+ static getWithTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
103
+ static getWithOfflineTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
103
104
  static getOriginalRefundableTenders(container: Container, accountingCurrency: string, originalTransactionsDetails: IOriginalTransactionDetails[], balanceDue: Money, itemTypes?: string[], orderTypes?: string[], isRefund?: boolean, productAttributeTypes?: string[], displayInfo?: any): IOriginalTender[];
104
105
  static getDefaultConfiguredTenderType(container: Container, accountingCurrency: string): TenderType;
105
106
  static createFromJsonObject(tenderTypeFromJson: any): TenderType;
@@ -87,51 +87,125 @@ class TenderType {
87
87
  var _a, _b;
88
88
  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);
89
89
  }
90
- static getWithoutTransactionTotal(displayInfo, accountingCurrency) {
91
- var _a, _b;
90
+ static getRefundableAmountByGroup(group, displayInfo, currency, configuration, refundDue) {
91
+ var _a, _b, _c, _d;
92
+ const withoutTransactionTotal = TenderType.getWithoutTransactionTotal(displayInfo, currency, configuration);
93
+ const withTransactionTotal = TenderType.getWithTransactionTotal(displayInfo, currency, configuration);
94
+ const withOfflineTransactionTotal = TenderType.getWithOfflineTransactionTotal(displayInfo, currency, configuration);
95
+ const tenderAuthCategory = group.tenderAuthCategory;
96
+ const tenderIds = group.tenderIds;
97
+ const tenderType = group.tenderType;
98
+ const tenderDefinitions = (_b = (_a = configuration) === null || _a === void 0 ? void 0 : _a.getTendersValues()) === null || _b === void 0 ? void 0 : _b.tenderDefinitions;
99
+ const tenders = [];
100
+ if (!_.isEmpty(tenderIds)) {
101
+ tenderIds.forEach((id) => {
102
+ var _a;
103
+ tenders.push((_a = tenderDefinitions) === null || _a === void 0 ? void 0 : _a.find((tender) => tender.tenderId === id && tender.active));
104
+ });
105
+ }
106
+ else if (!_.isEmpty(tenderAuthCategory)) {
107
+ (_c = tenderDefinitions) === null || _c === void 0 ? void 0 : _c.forEach((tender) => {
108
+ var _a;
109
+ if ((tender.tenderAuthCategory === tenderAuthCategory || ((_a = tender.additionalTenderAuthCategories) === null || _a === void 0 ? void 0 : _a.includes(tenderAuthCategory))) &&
110
+ tender.active) {
111
+ tenders.push(tender);
112
+ }
113
+ });
114
+ }
115
+ else if (!_.isEmpty(tenderType)) {
116
+ (_d = tenderDefinitions) === null || _d === void 0 ? void 0 : _d.forEach((tender) => {
117
+ if (tender.tenderType === tenderType && tender.active) {
118
+ tenders.push(tender);
119
+ }
120
+ });
121
+ }
122
+ let tenderAllowRefund = [];
123
+ tenders.forEach((tender) => {
124
+ if (tender.allowRefund) {
125
+ tenderAllowRefund = _.union(tenderAllowRefund, tender.allowRefund);
126
+ }
127
+ });
128
+ let refundableAmount = new scp_component_business_core_1.Money(0, currency);
129
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithTransaction)) {
130
+ refundableAmount = refundableAmount.plus(withTransactionTotal);
131
+ }
132
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithoutTransaction)) {
133
+ refundableAmount = refundableAmount.plus(withoutTransactionTotal);
134
+ }
135
+ if (tenderAllowRefund.includes(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) {
136
+ refundableAmount = refundableAmount.plus(withOfflineTransactionTotal);
137
+ }
138
+ return getLowestRefundDue(refundDue, undefined, refundableAmount);
139
+ }
140
+ static getWithoutTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
141
+ var _a, _b, _c, _d;
92
142
  let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
93
143
  (_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
94
144
  if ((itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder && itemDisplayLine.cancelled) ||
95
145
  (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
96
- _.isEmpty(itemDisplayLine.lineNumberFromReturnTransaction) &&
97
- _.isEmpty(itemDisplayLine.sublineIndexFromReturnItem))) {
146
+ _.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
147
+ _.isUndefined(itemDisplayLine.sublineIndexFromReturnItem) &&
148
+ _.isUndefined(itemDisplayLine.offlineReturnReferenceNumber))) {
98
149
  withoutTransactionTotal = withoutTransactionTotal.plus(itemDisplayLine.extendedAmount.abs());
99
150
  withoutTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
100
151
  ? withoutTransactionTotal.plus(itemDisplayLine.totalLineTax.abs())
101
152
  : withoutTransactionTotal;
102
153
  }
103
154
  });
155
+ (_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
156
+ var _a, _b;
157
+ const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
158
+ if (_.isEmpty(tenderDisplayLine.originalTenderReferences) &&
159
+ ((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithoutTransaction)) >= 0) {
160
+ withoutTransactionTotal = withoutTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
161
+ }
162
+ });
104
163
  return withoutTransactionTotal;
105
164
  }
106
- static getWithTransactionTotal(displayInfo, accountingCurrency) {
107
- var _a, _b;
165
+ static getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
166
+ var _a, _b, _c, _d;
108
167
  let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
109
168
  (_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
110
169
  if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemCancel ||
111
170
  (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
112
- !_.isEmpty(itemDisplayLine.lineNumberFromReturnTransaction) &&
113
- !_.isEmpty(itemDisplayLine.sublineIndexFromReturnItem))) {
171
+ !_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
172
+ !_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem))) {
114
173
  withTransactionTotal = withTransactionTotal.plus(itemDisplayLine.extendedAmount.abs());
115
174
  withTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
116
175
  ? withTransactionTotal.plus(itemDisplayLine.totalLineTax.abs())
117
176
  : withTransactionTotal;
118
177
  }
119
178
  });
179
+ (_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
180
+ var _a, _b;
181
+ const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
182
+ if (((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithTransaction)) >= 0 ||
183
+ !_.isEmpty(tenderDisplayLine.originalTenderReferences)) {
184
+ withTransactionTotal = withTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
185
+ }
186
+ });
120
187
  return withTransactionTotal;
121
188
  }
122
- static getWithOfflineTransactionTotal(displayInfo, accountingCurrency) {
123
- var _a, _b;
189
+ static getWithOfflineTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
190
+ var _a, _b, _c, _d;
124
191
  let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
125
192
  (_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
126
193
  var _a, _b;
127
194
  if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
128
- !_.isEmpty(itemDisplayLine.offlineReturnReferenceNumber)) {
195
+ !_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber)) {
129
196
  withOfflineTransactionTotal = withOfflineTransactionTotal.plus((_a = itemDisplayLine.extendedAmount) === null || _a === void 0 ? void 0 : _a.abs());
130
197
  withOfflineTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
131
198
  ? withOfflineTransactionTotal.plus((_b = itemDisplayLine.totalLineTax) === null || _b === void 0 ? void 0 : _b.abs())
132
199
  : undefined;
133
200
  }
134
201
  });
202
+ (_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
203
+ var _a, _b;
204
+ const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
205
+ if (((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) >= 0) {
206
+ withOfflineTransactionTotal = withOfflineTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
207
+ }
208
+ });
135
209
  return withOfflineTransactionTotal;
136
210
  }
137
211
  static getOriginalRefundableTenders(container, accountingCurrency, originalTransactionsDetails, balanceDue, itemTypes, orderTypes, isRefund, productAttributeTypes, displayInfo) {
@@ -140,9 +214,9 @@ class TenderType {
140
214
  const suggestedRefundTenders = TenderType.getActiveSuggestedRefundTenders(container, accountingCurrency);
141
215
  let originalRefundableTenders = [];
142
216
  let originalReferencedTenders = [];
143
- const withoutTransactionTotal = this.getWithoutTransactionTotal(displayInfo, accountingCurrency);
144
- const withTransactionTotal = this.getWithTransactionTotal(displayInfo, accountingCurrency);
145
- const offlineTransactionTotal = this.getWithOfflineTransactionTotal(displayInfo, accountingCurrency);
217
+ const withoutTransactionTotal = this.getWithoutTransactionTotal(displayInfo, accountingCurrency, configurationManager);
218
+ const withTransactionTotal = this.getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager);
219
+ const offlineTransactionTotal = this.getWithOfflineTransactionTotal(displayInfo, accountingCurrency, configurationManager);
146
220
  const originalUnreferencedAndMappedTenders = [];
147
221
  (_a = originalTransactionsDetails) === null || _a === void 0 ? void 0 : _a.forEach((origTranDetail) => {
148
222
  var _a;
@@ -152,7 +226,7 @@ class TenderType {
152
226
  const configuredTransactionReferenceTender = (_a = suggestedRefundTenders) === null || _a === void 0 ? void 0 : _a.find((tender) => tender.id === originalTender.tenderId);
153
227
  if (configuredTransactionReferenceTender) {
154
228
  if (originalTender.showReference) {
155
- originalReferencedTenders.push(originalTender);
229
+ originalReferencedTenders.push(_.cloneDeep(originalTender));
156
230
  }
157
231
  else if (originalTender.tenderAuthCategory !== Constants_1.TenderAuthCategory.LoyaltyVoucherService) {
158
232
  combineOriginalUnreferencedAndMappedTenders(originalTender, originalUnreferencedAndMappedTenders);
@@ -169,7 +243,7 @@ class TenderType {
169
243
  originalRefundableTenders = [...originalReferencedTenders, ...originalUnreferencedAndMappedTenders];
170
244
  originalRefundableTenders.forEach((tender) => {
171
245
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
172
- const configuredTender = getConfiguredTender(tender, configurationManager);
246
+ const configuredTender = getConfiguredTender(tender.tenderId, configurationManager);
173
247
  const withoutTransaction = ((_b = (_a = configuredTender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithoutTransaction)) >= 0;
174
248
  const withTransaction = ((_d = (_c = configuredTender) === null || _c === void 0 ? void 0 : _c.allowRefund) === null || _d === void 0 ? void 0 : _d.indexOf(ITendersConfig_1.AllowRefund.WithTransaction)) >= 0;
175
249
  const withOfflineTransaction = ((_f = (_e = configuredTender) === null || _e === void 0 ? void 0 : _e.allowRefund) === null || _f === void 0 ? void 0 : _f.indexOf(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) >= 0;
@@ -536,7 +610,9 @@ function combineOriginalUnreferencedAndMappedTenders(tender, unreferencedAndMapp
536
610
  matchingUnreferencedTender.adjustmentAmount = matchingUnreferencedTender.adjustmentAmount.plus(tender.adjustmentAmount);
537
611
  }
538
612
  if (matchingUnreferencedTender.originalTransactionReferences) {
539
- if (((_a = tender.originalTransactionReferences) === null || _a === void 0 ? void 0 : _a.length) > 0) {
613
+ // If original tender is fully refunded, do not add its transaction reference with its refundable amount
614
+ if (!isOriginalTenderFullyRefunded(tender, undefined) &&
615
+ ((_a = tender.originalTransactionReferences) === null || _a === void 0 ? void 0 : _a.length) > 0) {
540
616
  tender.originalTransactionReferences.forEach((origTranRef) => {
541
617
  const matchingTranReference = matchingUnreferencedTender.originalTransactionReferences.find((ref) => ref.transactionLineReference.transactionId ===
542
618
  origTranRef.transactionLineReference.transactionId &&
@@ -550,12 +626,17 @@ function combineOriginalUnreferencedAndMappedTenders(tender, unreferencedAndMapp
550
626
  });
551
627
  }
552
628
  }
553
- else {
629
+ else if (!isOriginalTenderFullyRefunded(tender, undefined)) {
554
630
  matchingUnreferencedTender.originalTransactionReferences = tender.originalTransactionReferences;
555
631
  }
632
+ // If unreferencedOriginal tender also has a matching mappedTender and is not fully refunded, set it to mapped
633
+ if (tender.isMappedTender && !isOriginalTenderFullyRefunded(matchingUnreferencedTender, undefined)) {
634
+ matchingUnreferencedTender.isMappedTender = true;
635
+ matchingUnreferencedTender.mappedOriginTenderId = tender.mappedOriginTenderId;
636
+ }
556
637
  }
557
638
  else {
558
- unreferencedAndMappedTenders.push(tender);
639
+ unreferencedAndMappedTenders.push(_.cloneDeep(tender));
559
640
  }
560
641
  }
561
642
  function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTransactionDetails, withTransactionTotal, withoutTransactionTotal, withOfflineTransactionTotal) {
@@ -590,7 +671,7 @@ function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTr
590
671
  if (refundDue) {
591
672
  const returnTotalAmount = getReturnOrCancelTotalAmount(originalTran);
592
673
  // If transaction was partially returned, tranRef.refundableAmount will have the full original tender amount, default to the partial return total amount
593
- const originalTenderAmount = getLowestRefundDue(undefined, returnTotalAmount, adjustAmount(origTranRef.refundableAmount, originalTender.adjustmentAmount));
674
+ const originalTenderAmount = getLowestRefundDue(undefined, returnTotalAmount, origTranRef.refundableAmount);
594
675
  // Mapped tenders will only use their transaction references for refund amount calculation, if they have been fully tendered,
595
676
  // they will not have transaction references, do not subtract refunded amount
596
677
  const currentTranRefundableAmount = calculateRefundableAmount(originalTenderAmount, originalTender.isMappedTender ? undefined : originalTender.refundedAmount, returnTotalAmount, refundDue);
@@ -616,23 +697,23 @@ function getLowestRefundDue(refundDue, returnTotalAmount, remainingTenderAmount)
616
697
  : remainingTenderAmount) || lowestRefundDue);
617
698
  }
618
699
  function calculateRefundableAmount(originalTenderAmount, refundedAmount, returnTotalAmount, refundDue) {
619
- const remainingTenderAmount = (refundedAmount && originalTenderAmount && originalTenderAmount.minus(refundedAmount)) ||
620
- originalTenderAmount;
700
+ var _a;
701
+ const remainingTenderAmount = (refundedAmount && ((_a = originalTenderAmount) === null || _a === void 0 ? void 0 : _a.minus(refundedAmount))) || originalTenderAmount;
621
702
  return getLowestRefundDue(refundDue, returnTotalAmount, remainingTenderAmount);
622
703
  }
623
- function getConfiguredTender(originalTender, configurationManager) {
704
+ function getConfiguredTender(originalTenderId, configurationManager) {
624
705
  var _a, _b;
625
706
  return (_b = (_a = configurationManager
626
- .getTendersValues()) === null || _a === void 0 ? void 0 : _a.tenderDefinitions) === null || _b === void 0 ? void 0 : _b.find((tender) => tender.tenderId === originalTender.tenderId);
707
+ .getTendersValues()) === null || _a === void 0 ? void 0 : _a.tenderDefinitions) === null || _b === void 0 ? void 0 : _b.find((tender) => tender.tenderId === originalTenderId);
627
708
  }
628
709
  function getConfiguredMappedTenders(originalTender, configurationManager, transactionId, originalTransactions, refundDue) {
629
- var _a, _b, _c, _d, _e;
710
+ var _a, _b, _c, _d, _e, _f;
630
711
  const mappedTenders = [];
631
712
  const tenderConfig = (_a = configurationManager) === null || _a === void 0 ? void 0 : _a.getTendersValues();
632
713
  const tenderTypeBehaviors = (_c = (_b = tenderConfig) === null || _b === void 0 ? void 0 : _b.tenderBehaviors) === null || _c === void 0 ? void 0 : _c.tenderTypeBehaviors;
633
714
  const tenderDefinitions = (_d = tenderConfig) === null || _d === void 0 ? void 0 : _d.tenderDefinitions;
634
- const configuredTender = getConfiguredTender(originalTender, configurationManager);
635
- const tenderTypeBehavior = configuredTender && tenderTypeBehaviors && tenderTypeBehaviors[configuredTender.tenderType];
715
+ const configuredTender = getConfiguredTender(originalTender.tenderId, configurationManager);
716
+ const tenderTypeBehavior = configuredTender && ((_e = tenderTypeBehaviors) === null || _e === void 0 ? void 0 : _e[configuredTender.tenderType]);
636
717
  let refundCardTypes;
637
718
  let refundTenderTypes;
638
719
  let excludeCardTypes;
@@ -647,7 +728,7 @@ function getConfiguredMappedTenders(originalTender, configurationManager, transa
647
728
  }
648
729
  else {
649
730
  // otherwise use the refundTenderTypes from the root tenderTypeBehavior
650
- refundTenderTypes = (_e = tenderTypeBehavior) === null || _e === void 0 ? void 0 : _e.refundTenderTypes;
731
+ refundTenderTypes = (_f = tenderTypeBehavior) === null || _f === void 0 ? void 0 : _f.refundTenderTypes;
651
732
  // exclude ANY refundableCardTypes that exist under cardTypeExceptions
652
733
  excludeCardTypes = getAllRefundableCardTypes(tenderTypeBehavior);
653
734
  }
@@ -1022,11 +1103,12 @@ function buildMappedOriginalTender(originalTender, tenderName, tenderType, tende
1022
1103
  };
1023
1104
  }
1024
1105
  function isOriginalTenderFullyRefunded(originalTender, returnTotalAmount) {
1106
+ var _a;
1025
1107
  const totalRefundedAmount = originalTender &&
1026
1108
  calculateTotalRefundedAmount(originalTender.previouslyRefundedAmount, originalTender.refundedAmount);
1027
1109
  const adjustedOriginalTenderAmount = adjustAmount(originalTender.originalTenderAmount, originalTender.adjustmentAmount);
1028
- return ((totalRefundedAmount && totalRefundedAmount.gte(adjustedOriginalTenderAmount)) ||
1029
- originalTender.refundedAmount.gte(returnTotalAmount));
1110
+ return (((_a = totalRefundedAmount) === null || _a === void 0 ? void 0 : _a.gte(adjustedOriginalTenderAmount)) ||
1111
+ (returnTotalAmount && originalTender.refundedAmount.gte(returnTotalAmount)));
1030
1112
  }
1031
1113
  function calculateTotalRefundedAmount(previouslyRefundedAmount, refundedAmount) {
1032
1114
  if (previouslyRefundedAmount && refundedAmount) {
@@ -1317,10 +1399,10 @@ function getReturnOrCancelTotalAmount(originalTran) {
1317
1399
  }
1318
1400
  exports.getReturnOrCancelTotalAmount = getReturnOrCancelTotalAmount;
1319
1401
  function isTenderCurrentlyRefunded(originalTender, refundableAmount) {
1320
- var _a, _b, _c;
1402
+ var _a, _b, _c, _d;
1321
1403
  const refundedAmount = adjustAmount((_a = originalTender) === null || _a === void 0 ? void 0 : _a.refundedAmount, (_b = originalTender) === null || _b === void 0 ? void 0 : _b.adjustmentAmount);
1322
- return (refundableAmount &&
1323
- (((_c = originalTender) === null || _c === void 0 ? void 0 : _c.isMappedTender) ? !refundableAmount.isPositive() : refundedAmount.gte(refundableAmount)));
1404
+ return (!_.isEmpty(refundableAmount) &&
1405
+ (((_c = originalTender) === null || _c === void 0 ? void 0 : _c.isMappedTender) ? !refundableAmount.isPositive() : (_d = refundedAmount) === null || _d === void 0 ? void 0 : _d.gte(refundableAmount)));
1324
1406
  }
1325
1407
  exports.isTenderCurrentlyRefunded = isTenderCurrentlyRefunded;
1326
1408
  function allowWalletSpecificTender(tenderAuthCategory, tenders) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "1.32.0",
3
+ "version": "1.33.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",