@final-commerce/common 2.0.12 → 2.0.14

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.
package/dist/index.mjs CHANGED
@@ -717,6 +717,26 @@ function amountToString(amount) {
717
717
  return majorValue.toFixed(amount.minorUnits);
718
718
  }
719
719
 
720
+ // utils/order-totals.util.ts
721
+ function toMinorUnits2(value) {
722
+ return Number(value) || 0;
723
+ }
724
+ function getTotalCollected(amountPaid, tipTotal) {
725
+ return toMinorUnits2(amountPaid) + toMinorUnits2(tipTotal);
726
+ }
727
+ function getPaymentLegTotal(amount, tipAmount) {
728
+ return toMinorUnits2(amount) + toMinorUnits2(tipAmount);
729
+ }
730
+ function getCashAmountDue(amount, cashRounding) {
731
+ return toMinorUnits2(amount) - toMinorUnits2(cashRounding);
732
+ }
733
+ function getSettlementTotal(payments, tipTotal) {
734
+ return toMinorUnits2(payments?.cardTotal) + toMinorUnits2(payments?.cashTotal) + toMinorUnits2(payments?.customTotal) + toMinorUnits2(tipTotal);
735
+ }
736
+ function getGoodsPortion(total, totalTax) {
737
+ return toMinorUnits2(total) - toMinorUnits2(totalTax);
738
+ }
739
+
720
740
  // constants/pricing.constants.ts
721
741
  var REGION_MAPPING = {
722
742
  // North America
@@ -2528,13 +2548,18 @@ export {
2528
2548
  fromMinorUnits,
2529
2549
  generateMongoID,
2530
2550
  getAvailableTransitions,
2551
+ getCashAmountDue,
2531
2552
  getCountriesByRegion,
2532
2553
  getCurrencyConfig,
2533
2554
  getCurrentISODate,
2534
2555
  getFinancialInvariantViolations,
2556
+ getGoodsPortion,
2535
2557
  getMinorUnitMultiplier,
2536
2558
  getMinorUnits,
2559
+ getPaymentLegTotal,
2537
2560
  getPricingRegionFromCountry,
2561
+ getSettlementTotal,
2562
+ getTotalCollected,
2538
2563
  inferStatesFromLegacyStatus,
2539
2564
  isConditionOperator,
2540
2565
  isFulfillmentState,