@final-commerce/common 2.8.1-online.2 → 2.8.1-online.4
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 +84 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.js +183 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +36 -12
- package/dist/pos-types/index.d.ts +36 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -481,6 +481,25 @@ declare enum ShippingZoneError {
|
|
|
481
481
|
MISSING_NAME = "MISSING_NAME"
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
declare enum TaxRegistrationKind {
|
|
485
|
+
GST_HST = "GST_HST",
|
|
486
|
+
PST = "PST",
|
|
487
|
+
QST = "QST"
|
|
488
|
+
}
|
|
489
|
+
declare enum TaxSource {
|
|
490
|
+
MERCHANT = "merchant",
|
|
491
|
+
AUTOMATIC = "automatic"
|
|
492
|
+
}
|
|
493
|
+
declare enum OutOfProvinceTaxes {
|
|
494
|
+
AUTOMATIC = "automatic",
|
|
495
|
+
HOME = "home"
|
|
496
|
+
}
|
|
497
|
+
declare enum TaxWarningCode {
|
|
498
|
+
NOT_REGISTERED = "NOT_REGISTERED",
|
|
499
|
+
NO_RULES_FOR_PLACE = "NO_RULES_FOR_PLACE",
|
|
500
|
+
NO_TABLE = "NO_TABLE"
|
|
501
|
+
}
|
|
502
|
+
|
|
484
503
|
interface CurrencyConfig {
|
|
485
504
|
minorUnits: number;
|
|
486
505
|
symbol: string;
|
|
@@ -1843,6 +1862,70 @@ interface ShippingZoneProblem {
|
|
|
1843
1862
|
}
|
|
1844
1863
|
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1845
1864
|
|
|
1865
|
+
interface TaxRegistration {
|
|
1866
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1867
|
+
place: string;
|
|
1868
|
+
number?: string | null;
|
|
1869
|
+
from?: string | null;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
declare const STANDARD_TAX_TYPE = "standard";
|
|
1873
|
+
type AutomaticTaxRowStatus = 'confirmed' | 'to_confirm';
|
|
1874
|
+
interface AutomaticTaxTypeRow {
|
|
1875
|
+
key: string;
|
|
1876
|
+
name: string;
|
|
1877
|
+
description?: string | null;
|
|
1878
|
+
sortOrder: number;
|
|
1879
|
+
active: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
interface AutomaticTaxPart {
|
|
1882
|
+
code: string;
|
|
1883
|
+
name: string;
|
|
1884
|
+
rate: string;
|
|
1885
|
+
level: 'federal' | 'provincial';
|
|
1886
|
+
}
|
|
1887
|
+
interface AutomaticTaxRateRow {
|
|
1888
|
+
code: string;
|
|
1889
|
+
name: string;
|
|
1890
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1891
|
+
places: string[];
|
|
1892
|
+
rate: string;
|
|
1893
|
+
from?: string | null;
|
|
1894
|
+
to?: string | null;
|
|
1895
|
+
order: number;
|
|
1896
|
+
compound: boolean;
|
|
1897
|
+
registrationPlace: string;
|
|
1898
|
+
harmonized: boolean;
|
|
1899
|
+
parts?: AutomaticTaxPart[] | null;
|
|
1900
|
+
sourceUrl?: string | null;
|
|
1901
|
+
status: AutomaticTaxRowStatus;
|
|
1902
|
+
}
|
|
1903
|
+
interface AutomaticTaxRuleRow {
|
|
1904
|
+
taxType: string;
|
|
1905
|
+
codes: string[];
|
|
1906
|
+
rate: string;
|
|
1907
|
+
from?: string | null;
|
|
1908
|
+
to?: string | null;
|
|
1909
|
+
sourceUrl?: string | null;
|
|
1910
|
+
status: AutomaticTaxRowStatus;
|
|
1911
|
+
note?: string | null;
|
|
1912
|
+
}
|
|
1913
|
+
interface AutomaticTaxTable {
|
|
1914
|
+
version: string;
|
|
1915
|
+
types: AutomaticTaxTypeRow[];
|
|
1916
|
+
rates: AutomaticTaxRateRow[];
|
|
1917
|
+
rules: AutomaticTaxRuleRow[];
|
|
1918
|
+
}
|
|
1919
|
+
declare function automaticTaxTableVersion(table: Omit<AutomaticTaxTable, 'version'>): string;
|
|
1920
|
+
declare function buildAutomaticTaxTable(rows: {
|
|
1921
|
+
types: readonly AutomaticTaxTypeRow[];
|
|
1922
|
+
rates: readonly AutomaticTaxRateRow[];
|
|
1923
|
+
rules: readonly AutomaticTaxRuleRow[];
|
|
1924
|
+
}): AutomaticTaxTable;
|
|
1925
|
+
declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[]): ReadonlyMap<string, readonly string[]>;
|
|
1926
|
+
|
|
1927
|
+
declare function sha1Hex(text: string): string;
|
|
1928
|
+
|
|
1846
1929
|
interface CurrencyRate {
|
|
1847
1930
|
rate: number;
|
|
1848
1931
|
country: string;
|
|
@@ -1911,4 +1994,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
1911
1994
|
}];
|
|
1912
1995
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
1913
1996
|
|
|
1914
|
-
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, 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, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1997
|
+
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OutOfProvinceTaxes, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxRegistration, TaxRegistrationKind, TaxSource, TaxWarningCode, 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, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -481,6 +481,25 @@ declare enum ShippingZoneError {
|
|
|
481
481
|
MISSING_NAME = "MISSING_NAME"
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
declare enum TaxRegistrationKind {
|
|
485
|
+
GST_HST = "GST_HST",
|
|
486
|
+
PST = "PST",
|
|
487
|
+
QST = "QST"
|
|
488
|
+
}
|
|
489
|
+
declare enum TaxSource {
|
|
490
|
+
MERCHANT = "merchant",
|
|
491
|
+
AUTOMATIC = "automatic"
|
|
492
|
+
}
|
|
493
|
+
declare enum OutOfProvinceTaxes {
|
|
494
|
+
AUTOMATIC = "automatic",
|
|
495
|
+
HOME = "home"
|
|
496
|
+
}
|
|
497
|
+
declare enum TaxWarningCode {
|
|
498
|
+
NOT_REGISTERED = "NOT_REGISTERED",
|
|
499
|
+
NO_RULES_FOR_PLACE = "NO_RULES_FOR_PLACE",
|
|
500
|
+
NO_TABLE = "NO_TABLE"
|
|
501
|
+
}
|
|
502
|
+
|
|
484
503
|
interface CurrencyConfig {
|
|
485
504
|
minorUnits: number;
|
|
486
505
|
symbol: string;
|
|
@@ -1843,6 +1862,70 @@ interface ShippingZoneProblem {
|
|
|
1843
1862
|
}
|
|
1844
1863
|
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1845
1864
|
|
|
1865
|
+
interface TaxRegistration {
|
|
1866
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1867
|
+
place: string;
|
|
1868
|
+
number?: string | null;
|
|
1869
|
+
from?: string | null;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
declare const STANDARD_TAX_TYPE = "standard";
|
|
1873
|
+
type AutomaticTaxRowStatus = 'confirmed' | 'to_confirm';
|
|
1874
|
+
interface AutomaticTaxTypeRow {
|
|
1875
|
+
key: string;
|
|
1876
|
+
name: string;
|
|
1877
|
+
description?: string | null;
|
|
1878
|
+
sortOrder: number;
|
|
1879
|
+
active: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
interface AutomaticTaxPart {
|
|
1882
|
+
code: string;
|
|
1883
|
+
name: string;
|
|
1884
|
+
rate: string;
|
|
1885
|
+
level: 'federal' | 'provincial';
|
|
1886
|
+
}
|
|
1887
|
+
interface AutomaticTaxRateRow {
|
|
1888
|
+
code: string;
|
|
1889
|
+
name: string;
|
|
1890
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1891
|
+
places: string[];
|
|
1892
|
+
rate: string;
|
|
1893
|
+
from?: string | null;
|
|
1894
|
+
to?: string | null;
|
|
1895
|
+
order: number;
|
|
1896
|
+
compound: boolean;
|
|
1897
|
+
registrationPlace: string;
|
|
1898
|
+
harmonized: boolean;
|
|
1899
|
+
parts?: AutomaticTaxPart[] | null;
|
|
1900
|
+
sourceUrl?: string | null;
|
|
1901
|
+
status: AutomaticTaxRowStatus;
|
|
1902
|
+
}
|
|
1903
|
+
interface AutomaticTaxRuleRow {
|
|
1904
|
+
taxType: string;
|
|
1905
|
+
codes: string[];
|
|
1906
|
+
rate: string;
|
|
1907
|
+
from?: string | null;
|
|
1908
|
+
to?: string | null;
|
|
1909
|
+
sourceUrl?: string | null;
|
|
1910
|
+
status: AutomaticTaxRowStatus;
|
|
1911
|
+
note?: string | null;
|
|
1912
|
+
}
|
|
1913
|
+
interface AutomaticTaxTable {
|
|
1914
|
+
version: string;
|
|
1915
|
+
types: AutomaticTaxTypeRow[];
|
|
1916
|
+
rates: AutomaticTaxRateRow[];
|
|
1917
|
+
rules: AutomaticTaxRuleRow[];
|
|
1918
|
+
}
|
|
1919
|
+
declare function automaticTaxTableVersion(table: Omit<AutomaticTaxTable, 'version'>): string;
|
|
1920
|
+
declare function buildAutomaticTaxTable(rows: {
|
|
1921
|
+
types: readonly AutomaticTaxTypeRow[];
|
|
1922
|
+
rates: readonly AutomaticTaxRateRow[];
|
|
1923
|
+
rules: readonly AutomaticTaxRuleRow[];
|
|
1924
|
+
}): AutomaticTaxTable;
|
|
1925
|
+
declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[]): ReadonlyMap<string, readonly string[]>;
|
|
1926
|
+
|
|
1927
|
+
declare function sha1Hex(text: string): string;
|
|
1928
|
+
|
|
1846
1929
|
interface CurrencyRate {
|
|
1847
1930
|
rate: number;
|
|
1848
1931
|
country: string;
|
|
@@ -1911,4 +1994,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
1911
1994
|
}];
|
|
1912
1995
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
1913
1996
|
|
|
1914
|
-
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, 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, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1997
|
+
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OutOfProvinceTaxes, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxRegistration, TaxRegistrationKind, TaxSource, TaxWarningCode, 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, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ __export(index_exports, {
|
|
|
76
76
|
ORDER_STATE_TOPIC: () => ORDER_STATE_TOPIC,
|
|
77
77
|
OrderPlatform: () => OrderPlatform,
|
|
78
78
|
OtherFixedRates: () => OtherFixedRates,
|
|
79
|
+
OutOfProvinceTaxes: () => OutOfProvinceTaxes,
|
|
79
80
|
OwnerType: () => OwnerType,
|
|
80
81
|
PATH_MODES: () => PATH_MODES,
|
|
81
82
|
PAYMENT_CHANNELS: () => PAYMENT_CHANNELS,
|
|
@@ -101,6 +102,7 @@ __export(index_exports, {
|
|
|
101
102
|
ResidualPaymentMethod: () => ResidualPaymentMethod,
|
|
102
103
|
ResidualStatus: () => ResidualStatus,
|
|
103
104
|
ResourceAvailabilityState: () => ResourceAvailabilityState,
|
|
105
|
+
STANDARD_TAX_TYPE: () => STANDARD_TAX_TYPE,
|
|
104
106
|
STATE_SCHEMA: () => STATE_SCHEMA,
|
|
105
107
|
STRIPE_SUPPORTED_COUNTRIES: () => STRIPE_SUPPORTED_COUNTRIES,
|
|
106
108
|
SYSTEM_FAMILIES: () => SYSTEM_FAMILIES,
|
|
@@ -116,6 +118,9 @@ __export(index_exports, {
|
|
|
116
118
|
StationStatus: () => StationStatus,
|
|
117
119
|
StripeCurrencyCode: () => StripeCurrencyCode,
|
|
118
120
|
StripeStatus: () => StripeStatus,
|
|
121
|
+
TaxRegistrationKind: () => TaxRegistrationKind,
|
|
122
|
+
TaxSource: () => TaxSource,
|
|
123
|
+
TaxWarningCode: () => TaxWarningCode,
|
|
119
124
|
TimePeriod: () => TimePeriod,
|
|
120
125
|
TopMetericsSort: () => TopMetericsSort,
|
|
121
126
|
UserTypes: () => UserTypes,
|
|
@@ -129,11 +134,13 @@ __export(index_exports, {
|
|
|
129
134
|
amountToString: () => amountToString,
|
|
130
135
|
ancestorChain: () => ancestorChain,
|
|
131
136
|
assertUnitSane: () => assertUnitSane,
|
|
137
|
+
automaticTaxTableVersion: () => automaticTaxTableVersion,
|
|
132
138
|
availableIn: () => availableIn,
|
|
133
139
|
baseFor: () => baseFor,
|
|
134
140
|
baseFulfillmentDefinitions: () => baseFulfillmentDefinitions,
|
|
135
141
|
baseOf: () => baseOf,
|
|
136
142
|
basePaymentDefinitions: () => basePaymentDefinitions,
|
|
143
|
+
buildAutomaticTaxTable: () => buildAutomaticTaxTable,
|
|
137
144
|
buildAvailability: () => buildAvailability,
|
|
138
145
|
buildGrid: () => buildGrid,
|
|
139
146
|
buildOrderContext: () => buildOrderContext,
|
|
@@ -227,6 +234,7 @@ __export(index_exports, {
|
|
|
227
234
|
presentAt: () => presentAt,
|
|
228
235
|
priceForTotal: () => priceForTotal,
|
|
229
236
|
provincesForPostCode: () => provincesForPostCode,
|
|
237
|
+
registrationPlacesByKind: () => registrationPlacesByKind,
|
|
230
238
|
removeFragment: () => removeFragment,
|
|
231
239
|
resolveFamily: () => resolveFamily,
|
|
232
240
|
resolveModifiersForProduct: () => resolveModifiersForProduct,
|
|
@@ -236,6 +244,7 @@ __export(index_exports, {
|
|
|
236
244
|
roundToPrecision: () => roundToPrecision,
|
|
237
245
|
sameFamily: () => sameFamily,
|
|
238
246
|
setOrderState: () => setOrderState,
|
|
247
|
+
sha1Hex: () => sha1Hex,
|
|
239
248
|
shopDayKey: () => shopDayKey,
|
|
240
249
|
shopDayRange: () => shopDayRange,
|
|
241
250
|
signReportForDisplay: () => signReportForDisplay,
|
|
@@ -787,6 +796,30 @@ var ShippingZoneError = /* @__PURE__ */ ((ShippingZoneError2) => {
|
|
|
787
796
|
return ShippingZoneError2;
|
|
788
797
|
})(ShippingZoneError || {});
|
|
789
798
|
|
|
799
|
+
// enums/tax.enum.ts
|
|
800
|
+
var TaxRegistrationKind = /* @__PURE__ */ ((TaxRegistrationKind2) => {
|
|
801
|
+
TaxRegistrationKind2["GST_HST"] = "GST_HST";
|
|
802
|
+
TaxRegistrationKind2["PST"] = "PST";
|
|
803
|
+
TaxRegistrationKind2["QST"] = "QST";
|
|
804
|
+
return TaxRegistrationKind2;
|
|
805
|
+
})(TaxRegistrationKind || {});
|
|
806
|
+
var TaxSource = /* @__PURE__ */ ((TaxSource2) => {
|
|
807
|
+
TaxSource2["MERCHANT"] = "merchant";
|
|
808
|
+
TaxSource2["AUTOMATIC"] = "automatic";
|
|
809
|
+
return TaxSource2;
|
|
810
|
+
})(TaxSource || {});
|
|
811
|
+
var OutOfProvinceTaxes = /* @__PURE__ */ ((OutOfProvinceTaxes2) => {
|
|
812
|
+
OutOfProvinceTaxes2["AUTOMATIC"] = "automatic";
|
|
813
|
+
OutOfProvinceTaxes2["HOME"] = "home";
|
|
814
|
+
return OutOfProvinceTaxes2;
|
|
815
|
+
})(OutOfProvinceTaxes || {});
|
|
816
|
+
var TaxWarningCode = /* @__PURE__ */ ((TaxWarningCode2) => {
|
|
817
|
+
TaxWarningCode2["NOT_REGISTERED"] = "NOT_REGISTERED";
|
|
818
|
+
TaxWarningCode2["NO_RULES_FOR_PLACE"] = "NO_RULES_FOR_PLACE";
|
|
819
|
+
TaxWarningCode2["NO_TABLE"] = "NO_TABLE";
|
|
820
|
+
return TaxWarningCode2;
|
|
821
|
+
})(TaxWarningCode || {});
|
|
822
|
+
|
|
790
823
|
// utils/currency.util.ts
|
|
791
824
|
var CURRENCY_CONFIG = {
|
|
792
825
|
// Major currencies with 2 decimal places
|
|
@@ -4222,6 +4255,147 @@ function tiersAreValid(option) {
|
|
|
4222
4255
|
return tiers.every((tier) => Number.isInteger(tier.from) && tier.from > 0 && isAmount(tier.price)) && new Set(froms).size === froms.length;
|
|
4223
4256
|
}
|
|
4224
4257
|
|
|
4258
|
+
// tax/sha1.ts
|
|
4259
|
+
function utf8Bytes(text) {
|
|
4260
|
+
const bytes = [];
|
|
4261
|
+
for (const char of text) {
|
|
4262
|
+
const cp = char.codePointAt(0);
|
|
4263
|
+
if (cp < 128) bytes.push(cp);
|
|
4264
|
+
else if (cp < 2048) bytes.push(192 | cp >> 6, 128 | cp & 63);
|
|
4265
|
+
else if (cp < 65536) bytes.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
4266
|
+
else bytes.push(240 | cp >> 18, 128 | cp >> 12 & 63, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
4267
|
+
}
|
|
4268
|
+
return bytes;
|
|
4269
|
+
}
|
|
4270
|
+
var rotl = (x, n) => x << n | x >>> 32 - n;
|
|
4271
|
+
function sha1Hex(text) {
|
|
4272
|
+
const bytes = utf8Bytes(text);
|
|
4273
|
+
const bitLength = bytes.length * 8;
|
|
4274
|
+
bytes.push(128);
|
|
4275
|
+
while (bytes.length % 64 !== 56) bytes.push(0);
|
|
4276
|
+
const high = Math.floor(bitLength / 4294967296);
|
|
4277
|
+
for (const word of [high, bitLength >>> 0])
|
|
4278
|
+
bytes.push(word >>> 24 & 255, word >>> 16 & 255, word >>> 8 & 255, word & 255);
|
|
4279
|
+
const h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
4280
|
+
const w = new Array(80);
|
|
4281
|
+
for (let offset = 0; offset < bytes.length; offset += 64) {
|
|
4282
|
+
for (let i = 0; i < 16; i++) {
|
|
4283
|
+
const j = offset + i * 4;
|
|
4284
|
+
w[i] = bytes[j] << 24 | bytes[j + 1] << 16 | bytes[j + 2] << 8 | bytes[j + 3];
|
|
4285
|
+
}
|
|
4286
|
+
for (let i = 16; i < 80; i++) w[i] = rotl(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
|
|
4287
|
+
let [a, b, c, d, e] = h;
|
|
4288
|
+
for (let i = 0; i < 80; i++) {
|
|
4289
|
+
const [f, k] = i < 20 ? [b & c | ~b & d, 1518500249] : i < 40 ? [b ^ c ^ d, 1859775393] : i < 60 ? [b & c | b & d | c & d, 2400959708] : [b ^ c ^ d, 3395469782];
|
|
4290
|
+
const t = rotl(a, 5) + f + e + k + w[i] | 0;
|
|
4291
|
+
e = d;
|
|
4292
|
+
d = c;
|
|
4293
|
+
c = rotl(b, 30);
|
|
4294
|
+
b = a;
|
|
4295
|
+
a = t;
|
|
4296
|
+
}
|
|
4297
|
+
h[0] = h[0] + a | 0;
|
|
4298
|
+
h[1] = h[1] + b | 0;
|
|
4299
|
+
h[2] = h[2] + c | 0;
|
|
4300
|
+
h[3] = h[3] + d | 0;
|
|
4301
|
+
h[4] = h[4] + e | 0;
|
|
4302
|
+
}
|
|
4303
|
+
return h.map((x) => (x >>> 0).toString(16).padStart(8, "0")).join("");
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
// tax/table.ts
|
|
4307
|
+
var STANDARD_TAX_TYPE = "standard";
|
|
4308
|
+
var TYPE_FIELDS = ["key", "name", "description", "sortOrder", "active"];
|
|
4309
|
+
var RATE_FIELDS = [
|
|
4310
|
+
"code",
|
|
4311
|
+
"name",
|
|
4312
|
+
"kind",
|
|
4313
|
+
"places",
|
|
4314
|
+
"rate",
|
|
4315
|
+
"from",
|
|
4316
|
+
"to",
|
|
4317
|
+
"order",
|
|
4318
|
+
"compound",
|
|
4319
|
+
"registrationPlace",
|
|
4320
|
+
"harmonized",
|
|
4321
|
+
"parts",
|
|
4322
|
+
"sourceUrl",
|
|
4323
|
+
"status"
|
|
4324
|
+
];
|
|
4325
|
+
var RULE_FIELDS = ["taxType", "codes", "rate", "from", "to", "sourceUrl", "status", "note"];
|
|
4326
|
+
function canonical(row, fields) {
|
|
4327
|
+
return JSON.stringify(fields.map((field) => row[field] ?? null));
|
|
4328
|
+
}
|
|
4329
|
+
var sortedCanonical = (rows, fields) => rows.map((row) => canonical(row, fields)).sort();
|
|
4330
|
+
function automaticTaxTableVersion(table) {
|
|
4331
|
+
return sha1Hex(
|
|
4332
|
+
JSON.stringify([
|
|
4333
|
+
sortedCanonical(table.types, TYPE_FIELDS),
|
|
4334
|
+
sortedCanonical(table.rates, RATE_FIELDS),
|
|
4335
|
+
sortedCanonical(table.rules, RULE_FIELDS)
|
|
4336
|
+
])
|
|
4337
|
+
);
|
|
4338
|
+
}
|
|
4339
|
+
var toTypeRow = ({ key, name, description, sortOrder, active }) => ({
|
|
4340
|
+
key,
|
|
4341
|
+
name,
|
|
4342
|
+
description,
|
|
4343
|
+
sortOrder,
|
|
4344
|
+
active
|
|
4345
|
+
});
|
|
4346
|
+
var toRateRow = (rate) => ({
|
|
4347
|
+
code: rate.code,
|
|
4348
|
+
name: rate.name,
|
|
4349
|
+
kind: rate.kind,
|
|
4350
|
+
places: rate.places,
|
|
4351
|
+
rate: rate.rate,
|
|
4352
|
+
from: rate.from,
|
|
4353
|
+
to: rate.to,
|
|
4354
|
+
order: rate.order,
|
|
4355
|
+
compound: rate.compound,
|
|
4356
|
+
registrationPlace: rate.registrationPlace,
|
|
4357
|
+
harmonized: rate.harmonized,
|
|
4358
|
+
parts: rate.parts?.map(({ code, name, rate: partRate, level }) => ({ code, name, rate: partRate, level })),
|
|
4359
|
+
sourceUrl: rate.sourceUrl,
|
|
4360
|
+
status: rate.status
|
|
4361
|
+
});
|
|
4362
|
+
var toRuleRow = ({
|
|
4363
|
+
taxType,
|
|
4364
|
+
codes: codes2,
|
|
4365
|
+
rate,
|
|
4366
|
+
from,
|
|
4367
|
+
to,
|
|
4368
|
+
sourceUrl,
|
|
4369
|
+
status,
|
|
4370
|
+
note
|
|
4371
|
+
}) => ({
|
|
4372
|
+
taxType,
|
|
4373
|
+
codes: codes2,
|
|
4374
|
+
rate,
|
|
4375
|
+
from,
|
|
4376
|
+
to,
|
|
4377
|
+
sourceUrl,
|
|
4378
|
+
status,
|
|
4379
|
+
note
|
|
4380
|
+
});
|
|
4381
|
+
function buildAutomaticTaxTable(rows) {
|
|
4382
|
+
const table = {
|
|
4383
|
+
types: [...rows.types].sort((a, b) => a.sortOrder - b.sortOrder).map(toTypeRow),
|
|
4384
|
+
rates: rows.rates.map(toRateRow),
|
|
4385
|
+
rules: rows.rules.map(toRuleRow)
|
|
4386
|
+
};
|
|
4387
|
+
return { version: automaticTaxTableVersion(table), ...table };
|
|
4388
|
+
}
|
|
4389
|
+
function registrationPlacesByKind(rates) {
|
|
4390
|
+
const places = /* @__PURE__ */ new Map();
|
|
4391
|
+
for (const rate of rates) {
|
|
4392
|
+
const list = places.get(rate.kind) ?? [];
|
|
4393
|
+
if (!list.includes(rate.registrationPlace)) list.push(rate.registrationPlace);
|
|
4394
|
+
places.set(rate.kind, list);
|
|
4395
|
+
}
|
|
4396
|
+
return places;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4225
4399
|
// constants/adyen.constants.ts
|
|
4226
4400
|
var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
4227
4401
|
function isAdyenRolloutCountry(alpha2) {
|
|
@@ -4374,6 +4548,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4374
4548
|
ORDER_STATE_TOPIC,
|
|
4375
4549
|
OrderPlatform,
|
|
4376
4550
|
OtherFixedRates,
|
|
4551
|
+
OutOfProvinceTaxes,
|
|
4377
4552
|
OwnerType,
|
|
4378
4553
|
PATH_MODES,
|
|
4379
4554
|
PAYMENT_CHANNELS,
|
|
@@ -4399,6 +4574,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4399
4574
|
ResidualPaymentMethod,
|
|
4400
4575
|
ResidualStatus,
|
|
4401
4576
|
ResourceAvailabilityState,
|
|
4577
|
+
STANDARD_TAX_TYPE,
|
|
4402
4578
|
STATE_SCHEMA,
|
|
4403
4579
|
STRIPE_SUPPORTED_COUNTRIES,
|
|
4404
4580
|
SYSTEM_FAMILIES,
|
|
@@ -4414,6 +4590,9 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4414
4590
|
StationStatus,
|
|
4415
4591
|
StripeCurrencyCode,
|
|
4416
4592
|
StripeStatus,
|
|
4593
|
+
TaxRegistrationKind,
|
|
4594
|
+
TaxSource,
|
|
4595
|
+
TaxWarningCode,
|
|
4417
4596
|
TimePeriod,
|
|
4418
4597
|
TopMetericsSort,
|
|
4419
4598
|
UserTypes,
|
|
@@ -4427,11 +4606,13 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4427
4606
|
amountToString,
|
|
4428
4607
|
ancestorChain,
|
|
4429
4608
|
assertUnitSane,
|
|
4609
|
+
automaticTaxTableVersion,
|
|
4430
4610
|
availableIn,
|
|
4431
4611
|
baseFor,
|
|
4432
4612
|
baseFulfillmentDefinitions,
|
|
4433
4613
|
baseOf,
|
|
4434
4614
|
basePaymentDefinitions,
|
|
4615
|
+
buildAutomaticTaxTable,
|
|
4435
4616
|
buildAvailability,
|
|
4436
4617
|
buildGrid,
|
|
4437
4618
|
buildOrderContext,
|
|
@@ -4525,6 +4706,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4525
4706
|
presentAt,
|
|
4526
4707
|
priceForTotal,
|
|
4527
4708
|
provincesForPostCode,
|
|
4709
|
+
registrationPlacesByKind,
|
|
4528
4710
|
removeFragment,
|
|
4529
4711
|
resolveFamily,
|
|
4530
4712
|
resolveModifiersForProduct,
|
|
@@ -4534,6 +4716,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4534
4716
|
roundToPrecision,
|
|
4535
4717
|
sameFamily,
|
|
4536
4718
|
setOrderState,
|
|
4719
|
+
sha1Hex,
|
|
4537
4720
|
shopDayKey,
|
|
4538
4721
|
shopDayRange,
|
|
4539
4722
|
signReportForDisplay,
|