@aptos-scp/scp-component-store-selling-features-domain-model 2.30.0 → 2.31.0-patch.1

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.
@@ -210,6 +210,7 @@ class Customer {
210
210
  customer.loyaltyMembershipLookupIndicator = customerFromJson.loyaltyMembershipLookupIndicator;
211
211
  customer.hasLoyaltyMemberships = customerFromJson.hasLoyaltyMemberships;
212
212
  customer.loyaltyMemberships = customerFromJson.loyaltyMemberships;
213
+ customer.hiddenLoyaltyMemberships = customerFromJson.hiddenLoyaltyMemberships;
213
214
  customer.availableLoyaltyPlans = customerFromJson.availableLoyaltyPlans;
214
215
  customer.allowPromptForLoyaltyEnrollment = customerFromJson.allowPromptForLoyaltyEnrollment;
215
216
  customer.earliestNextLoyaltyEnrollmentPromptDate =
@@ -741,8 +741,19 @@ function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTr
741
741
  const originalTran = (_b = originalTransactionDetails) === null || _b === void 0 ? void 0 : _b.find((origTran) => origTran.originalTransactionId === originalTenderReferenceTranId);
742
742
  if (refundDue) {
743
743
  const returnTotalAmount = getReturnOrCancelTotalAmount(originalTran);
744
+ const originalTenderId = originalTender.isMappedTender
745
+ ? originalTender.mappedOriginTenderId
746
+ : originalTender.tenderId;
747
+ // originalTranTenderAdjustmentTotal is the aggregate of all adjustments that were applied to
748
+ // the tender in the source transaction
749
+ const originalTranTenderAdjustmentTotal = originalTran.originalTenders.reduce((adjustmentTotal, tender) => tender.tenderId === originalTenderId && tender.adjustmentAmount instanceof scp_component_business_core_1.Money
750
+ ? adjustmentTotal.plus(tender.adjustmentAmount)
751
+ : adjustmentTotal, new scp_component_business_core_1.Money(0, refundDue.currency));
752
+ // adjust the raw refundableAmount of origTranRef to factor in the total adjustments
753
+ // applied to the tender
754
+ const adjustedOriginalTranRefRefundableAmount = adjustAmount(origTranRef.refundableAmount, originalTranTenderAdjustmentTotal);
744
755
  // If transaction was partially returned, tranRef.refundableAmount will have the full original tender amount, default to the partial return total amount
745
- const originalTenderAmount = getLowestRefundDue(undefined, returnTotalAmount, origTranRef.refundableAmount);
756
+ const originalTenderAmount = getLowestRefundDue(undefined, returnTotalAmount, adjustedOriginalTranRefRefundableAmount);
746
757
  // Mapped tenders will only use their transaction references for refund amount calculation, if they have been fully tendered,
747
758
  // they will not have transaction references, do not subtract refunded amount
748
759
  const currentTranRefundableAmount = calculateRefundableAmount(originalTenderAmount, originalTender.isMappedTender ? undefined : originalTender.refundedAmount, returnTotalAmount, refundDue);
@@ -292,24 +292,24 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
292
292
  return transactionLineJsonObj._taxGroupId;
293
293
  }
294
294
  static getExtendedAmountFromCollectedData(collectedData) {
295
- if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmount) && FeeLine.isPickupFulfilmentTransaction) {
295
+ if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmount)) {
296
296
  return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmount);
297
297
  }
298
- undefined;
298
+ return undefined;
299
299
  }
300
300
  static getExtendedAmountExcludingTaxFromCollectedData(collectedData) {
301
301
  if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax) &&
302
302
  FeeLine.isPickupFulfilmentTransaction) {
303
303
  return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax);
304
304
  }
305
- undefined;
305
+ return undefined;
306
306
  }
307
307
  static getExtendedAmountIncludingTaxFromCollectedData(collectedData) {
308
308
  if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax) &&
309
309
  FeeLine.isPickupFulfilmentTransaction) {
310
310
  return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax);
311
311
  }
312
- undefined;
312
+ return undefined;
313
313
  }
314
314
  copyLineWithNewLineNumber(newLineNumber) {
315
315
  const clonedItem = this.clone();
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.30.0",
3
+ "version": "2.31.0-patch.1",
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",