@final-commerce/common 2.0.13 → 2.0.15
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -724,6 +724,21 @@ 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 getLineSubtotal(price, quantity) {
|
|
737
|
+
return toMinorUnits2(price) * toMinorUnits2(quantity);
|
|
738
|
+
}
|
|
739
|
+
function getGoodsPortion(total, totalTax) {
|
|
740
|
+
return toMinorUnits2(total) - toMinorUnits2(totalTax);
|
|
741
|
+
}
|
|
727
742
|
|
|
728
743
|
// constants/pricing.constants.ts
|
|
729
744
|
var REGION_MAPPING = {
|
|
@@ -2536,13 +2551,18 @@ export {
|
|
|
2536
2551
|
fromMinorUnits,
|
|
2537
2552
|
generateMongoID,
|
|
2538
2553
|
getAvailableTransitions,
|
|
2554
|
+
getCashAmountDue,
|
|
2539
2555
|
getCountriesByRegion,
|
|
2540
2556
|
getCurrencyConfig,
|
|
2541
2557
|
getCurrentISODate,
|
|
2542
2558
|
getFinancialInvariantViolations,
|
|
2559
|
+
getGoodsPortion,
|
|
2560
|
+
getLineSubtotal,
|
|
2543
2561
|
getMinorUnitMultiplier,
|
|
2544
2562
|
getMinorUnits,
|
|
2563
|
+
getPaymentLegTotal,
|
|
2545
2564
|
getPricingRegionFromCountry,
|
|
2565
|
+
getSettlementTotal,
|
|
2546
2566
|
getTotalCollected,
|
|
2547
2567
|
inferStatesFromLegacyStatus,
|
|
2548
2568
|
isConditionOperator,
|