@final-commerce/common 2.0.13 → 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.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -724,6 +724,18 @@ function toMinorUnits2(value) {
|
|
|
724
724
|
function getTotalCollected(amountPaid, tipTotal) {
|
|
725
725
|
return toMinorUnits2(amountPaid) + toMinorUnits2(tipTotal);
|
|
726
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
|
+
}
|
|
727
739
|
|
|
728
740
|
// constants/pricing.constants.ts
|
|
729
741
|
var REGION_MAPPING = {
|
|
@@ -2536,13 +2548,17 @@ export {
|
|
|
2536
2548
|
fromMinorUnits,
|
|
2537
2549
|
generateMongoID,
|
|
2538
2550
|
getAvailableTransitions,
|
|
2551
|
+
getCashAmountDue,
|
|
2539
2552
|
getCountriesByRegion,
|
|
2540
2553
|
getCurrencyConfig,
|
|
2541
2554
|
getCurrentISODate,
|
|
2542
2555
|
getFinancialInvariantViolations,
|
|
2556
|
+
getGoodsPortion,
|
|
2543
2557
|
getMinorUnitMultiplier,
|
|
2544
2558
|
getMinorUnits,
|
|
2559
|
+
getPaymentLegTotal,
|
|
2545
2560
|
getPricingRegionFromCountry,
|
|
2561
|
+
getSettlementTotal,
|
|
2546
2562
|
getTotalCollected,
|
|
2547
2563
|
inferStatesFromLegacyStatus,
|
|
2548
2564
|
isConditionOperator,
|