@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.d.mts
CHANGED
|
@@ -628,6 +628,15 @@ declare function amountToString(amount: Amount | undefined | null): string;
|
|
|
628
628
|
|
|
629
629
|
type MoneyInput = number | string | null | undefined;
|
|
630
630
|
declare function getTotalCollected(amountPaid: MoneyInput, tipTotal: MoneyInput): number;
|
|
631
|
+
declare function getPaymentLegTotal(amount: MoneyInput, tipAmount: MoneyInput): number;
|
|
632
|
+
declare function getCashAmountDue(amount: MoneyInput, cashRounding: MoneyInput): number;
|
|
633
|
+
interface SettlementBuckets {
|
|
634
|
+
cardTotal?: MoneyInput;
|
|
635
|
+
cashTotal?: MoneyInput;
|
|
636
|
+
customTotal?: MoneyInput;
|
|
637
|
+
}
|
|
638
|
+
declare function getSettlementTotal(payments: SettlementBuckets | undefined | null, tipTotal: MoneyInput): number;
|
|
639
|
+
declare function getGoodsPortion(total: MoneyInput, totalTax: MoneyInput): number;
|
|
631
640
|
|
|
632
641
|
declare function getPricingRegionFromCountry(countryCode?: string): PricingRegionEnum;
|
|
633
642
|
declare const NORTH_AMERICA: Set<string>;
|
|
@@ -1068,4 +1077,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1068
1077
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1069
1078
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1070
1079
|
|
|
1071
|
-
export { type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
|
1080
|
+
export { type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -628,6 +628,15 @@ declare function amountToString(amount: Amount | undefined | null): string;
|
|
|
628
628
|
|
|
629
629
|
type MoneyInput = number | string | null | undefined;
|
|
630
630
|
declare function getTotalCollected(amountPaid: MoneyInput, tipTotal: MoneyInput): number;
|
|
631
|
+
declare function getPaymentLegTotal(amount: MoneyInput, tipAmount: MoneyInput): number;
|
|
632
|
+
declare function getCashAmountDue(amount: MoneyInput, cashRounding: MoneyInput): number;
|
|
633
|
+
interface SettlementBuckets {
|
|
634
|
+
cardTotal?: MoneyInput;
|
|
635
|
+
cashTotal?: MoneyInput;
|
|
636
|
+
customTotal?: MoneyInput;
|
|
637
|
+
}
|
|
638
|
+
declare function getSettlementTotal(payments: SettlementBuckets | undefined | null, tipTotal: MoneyInput): number;
|
|
639
|
+
declare function getGoodsPortion(total: MoneyInput, totalTax: MoneyInput): number;
|
|
631
640
|
|
|
632
641
|
declare function getPricingRegionFromCountry(countryCode?: string): PricingRegionEnum;
|
|
633
642
|
declare const NORTH_AMERICA: Set<string>;
|
|
@@ -1068,4 +1077,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1068
1077
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1069
1078
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1070
1079
|
|
|
1071
|
-
export { type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
|
1080
|
+
export { type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.js
CHANGED
|
@@ -102,13 +102,17 @@ __export(index_exports, {
|
|
|
102
102
|
fromMinorUnits: () => fromMinorUnits,
|
|
103
103
|
generateMongoID: () => generateMongoID,
|
|
104
104
|
getAvailableTransitions: () => getAvailableTransitions,
|
|
105
|
+
getCashAmountDue: () => getCashAmountDue,
|
|
105
106
|
getCountriesByRegion: () => getCountriesByRegion,
|
|
106
107
|
getCurrencyConfig: () => getCurrencyConfig,
|
|
107
108
|
getCurrentISODate: () => getCurrentISODate,
|
|
108
109
|
getFinancialInvariantViolations: () => getFinancialInvariantViolations,
|
|
110
|
+
getGoodsPortion: () => getGoodsPortion,
|
|
109
111
|
getMinorUnitMultiplier: () => getMinorUnitMultiplier,
|
|
110
112
|
getMinorUnits: () => getMinorUnits,
|
|
113
|
+
getPaymentLegTotal: () => getPaymentLegTotal,
|
|
111
114
|
getPricingRegionFromCountry: () => getPricingRegionFromCountry,
|
|
115
|
+
getSettlementTotal: () => getSettlementTotal,
|
|
112
116
|
getTotalCollected: () => getTotalCollected,
|
|
113
117
|
inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
|
|
114
118
|
isConditionOperator: () => isConditionOperator,
|
|
@@ -861,6 +865,18 @@ function toMinorUnits2(value) {
|
|
|
861
865
|
function getTotalCollected(amountPaid, tipTotal) {
|
|
862
866
|
return toMinorUnits2(amountPaid) + toMinorUnits2(tipTotal);
|
|
863
867
|
}
|
|
868
|
+
function getPaymentLegTotal(amount, tipAmount) {
|
|
869
|
+
return toMinorUnits2(amount) + toMinorUnits2(tipAmount);
|
|
870
|
+
}
|
|
871
|
+
function getCashAmountDue(amount, cashRounding) {
|
|
872
|
+
return toMinorUnits2(amount) - toMinorUnits2(cashRounding);
|
|
873
|
+
}
|
|
874
|
+
function getSettlementTotal(payments, tipTotal) {
|
|
875
|
+
return toMinorUnits2(payments?.cardTotal) + toMinorUnits2(payments?.cashTotal) + toMinorUnits2(payments?.customTotal) + toMinorUnits2(tipTotal);
|
|
876
|
+
}
|
|
877
|
+
function getGoodsPortion(total, totalTax) {
|
|
878
|
+
return toMinorUnits2(total) - toMinorUnits2(totalTax);
|
|
879
|
+
}
|
|
864
880
|
|
|
865
881
|
// constants/pricing.constants.ts
|
|
866
882
|
var REGION_MAPPING = {
|
|
@@ -2674,13 +2690,17 @@ var ORDER_STATE_EVENTS = {
|
|
|
2674
2690
|
fromMinorUnits,
|
|
2675
2691
|
generateMongoID,
|
|
2676
2692
|
getAvailableTransitions,
|
|
2693
|
+
getCashAmountDue,
|
|
2677
2694
|
getCountriesByRegion,
|
|
2678
2695
|
getCurrencyConfig,
|
|
2679
2696
|
getCurrentISODate,
|
|
2680
2697
|
getFinancialInvariantViolations,
|
|
2698
|
+
getGoodsPortion,
|
|
2681
2699
|
getMinorUnitMultiplier,
|
|
2682
2700
|
getMinorUnits,
|
|
2701
|
+
getPaymentLegTotal,
|
|
2683
2702
|
getPricingRegionFromCountry,
|
|
2703
|
+
getSettlementTotal,
|
|
2684
2704
|
getTotalCollected,
|
|
2685
2705
|
inferStatesFromLegacyStatus,
|
|
2686
2706
|
isConditionOperator,
|