@managesome/eposmatic-toolkit 0.2.704 → 0.2.706
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.
|
@@ -989,10 +989,26 @@ function getAutoApplyOfferCandidates({ offersWithStats, suppressedOfferIds, }) {
|
|
|
989
989
|
if (!stats.claimable || stats.invalid_offer || !shouldAutoApplyOffer) {
|
|
990
990
|
continue;
|
|
991
991
|
}
|
|
992
|
+
// ITEMS / DISCOUNT_ITEMS rewards are claimed manually through the reward
|
|
993
|
+
// drawers and their claimability tracks selected cart items rather than
|
|
994
|
+
// redeemed_offers. No app implements auto-apply for them, and applying via
|
|
995
|
+
// a redeemed_offers patch would leave them permanently claimable, causing
|
|
996
|
+
// the auto-apply effect to loop.
|
|
997
|
+
if (offer.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.ITEMS ||
|
|
998
|
+
offer.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT_ITEMS) {
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
992
1001
|
if (suppressedOfferIds?.[normalizedOfferId]) {
|
|
993
1002
|
continue;
|
|
994
1003
|
}
|
|
995
|
-
|
|
1004
|
+
// For repeatable POINTS and flat CASHBACK, claimsIncrement covers ALL
|
|
1005
|
+
// remaining claims in a single patch so the next stats snapshot flips
|
|
1006
|
+
// claimable to false. Callers MUST forward claimsIncrement into
|
|
1007
|
+
// buildRedeemedOffersClaimPatch; otherwise redeemed_times advances by 1
|
|
1008
|
+
// per cycle and the auto-apply effect loops until React throws
|
|
1009
|
+
// "Maximum update depth exceeded".
|
|
1010
|
+
const claimsIncrement = offer.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.POINTS ||
|
|
1011
|
+
(offer.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.CASHBACK && offer.reward_cashback?.is_cashback_percentage !== true)
|
|
996
1012
|
? getOfferClaimIncrementFromStats({
|
|
997
1013
|
stats,
|
|
998
1014
|
})
|
|
@@ -1744,15 +1760,6 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
1744
1760
|
return true;
|
|
1745
1761
|
return getCustomerUsedRedemptionCount(customerOfferRedemptionCounts, offerToCheck._id) >= maxUsesPerCustomer;
|
|
1746
1762
|
};
|
|
1747
|
-
const getRemainingOfferUsesForCustomer = (offerToCheck) => {
|
|
1748
|
-
const maxUsesPerCustomer = getOfferMaxUsesPerCustomer(offerToCheck);
|
|
1749
|
-
if (maxUsesPerCustomer == null)
|
|
1750
|
-
return Infinity;
|
|
1751
|
-
if (customerOfferRedemptionCounts == null)
|
|
1752
|
-
return 0;
|
|
1753
|
-
const redeemedByCustomer = getCustomerUsedRedemptionCount(customerOfferRedemptionCounts, offerToCheck._id);
|
|
1754
|
-
return Math.max(0, maxUsesPerCustomer - redeemedByCustomer);
|
|
1755
|
-
};
|
|
1756
1763
|
const getOrderValueClaimTimes = (orderValue, minAmount) => {
|
|
1757
1764
|
const safeRequiredAmount = Math.max(1, minAmount || 1);
|
|
1758
1765
|
return Math.max(1, Math.floor(orderValue / safeRequiredAmount));
|
|
@@ -1788,14 +1795,20 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
1788
1795
|
if (normalizedUnlockableClaims === 0) {
|
|
1789
1796
|
return 0;
|
|
1790
1797
|
}
|
|
1791
|
-
|
|
1798
|
+
// max_uses_per_customer is a lifetime gate checked separately against
|
|
1799
|
+
// the customer's settled-claim history (wallet USED counter,
|
|
1800
|
+
// isOfferUsesPerCustomerExhausted); it must not shrink the per-order
|
|
1801
|
+
// claim count — max_claims governs the ongoing session only.
|
|
1802
|
+
return normalizedUnlockableClaims;
|
|
1792
1803
|
};
|
|
1793
|
-
const getPathwayMaxRedeemableClaims = (
|
|
1804
|
+
const getPathwayMaxRedeemableClaims = (pathwayUnlockableClaims) => {
|
|
1794
1805
|
const normalizedUnlockableClaims = Math.max(0, pathwayUnlockableClaims);
|
|
1795
1806
|
if (normalizedUnlockableClaims === 0) {
|
|
1796
1807
|
return 0;
|
|
1797
1808
|
}
|
|
1798
|
-
|
|
1809
|
+
// Same lifetime-vs-session separation as getPointsMaxRedeemableClaims:
|
|
1810
|
+
// max_uses_per_customer only gates on settled-claim history.
|
|
1811
|
+
return normalizedUnlockableClaims;
|
|
1799
1812
|
};
|
|
1800
1813
|
const isDiscountSlotOccupiedForOffer = (offerToCheck) => {
|
|
1801
1814
|
if (order_discount_details == null) {
|
|
@@ -1986,11 +1999,15 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
1986
1999
|
totalOfferItemsSelected,
|
|
1987
2000
|
applicableQuantity,
|
|
1988
2001
|
});
|
|
1989
|
-
const
|
|
2002
|
+
const maxClaimsPerOrder = offer.pathway_to_unlock_type_orders?.max_claims == null
|
|
2003
|
+
? Infinity
|
|
2004
|
+
: Math.max(1, offer.pathway_to_unlock_type_orders.max_claims);
|
|
2005
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, offer.pathway_to_unlock_type_orders?.total_amount);
|
|
2006
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder);
|
|
1990
2007
|
const discountSlotOccupied = isDiscountSlotOccupiedForOffer(offer);
|
|
1991
|
-
const isClaimable = redeemedTimes <
|
|
2008
|
+
const isClaimable = redeemedTimes < totalUnlockableClaims && !discountSlotOccupied;
|
|
1992
2009
|
stats.redeemed_times = redeemedTimes;
|
|
1993
|
-
stats.applicable_quantity = applicableQuantity *
|
|
2010
|
+
stats.applicable_quantity = applicableQuantity * Math.max(1, totalUnlockableClaims);
|
|
1994
2011
|
if (isClaimable) {
|
|
1995
2012
|
totalClaimableOffers.push(offer._id);
|
|
1996
2013
|
stats.claimable = true;
|
|
@@ -1999,7 +2016,7 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
1999
2016
|
else {
|
|
2000
2017
|
stats.claimable = false;
|
|
2001
2018
|
stats.message =
|
|
2002
|
-
redeemedTimes
|
|
2019
|
+
redeemedTimes >= totalUnlockableClaims
|
|
2003
2020
|
? `This offer is redeemed ✅`
|
|
2004
2021
|
: discountSlotOccupied
|
|
2005
2022
|
? 'You already have an offer applied to your order.'
|
|
@@ -2072,25 +2089,41 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2072
2089
|
continue;
|
|
2073
2090
|
}
|
|
2074
2091
|
const redeemedTimes = getOfferRedeemedTimes(offer._id);
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
stats.message = 'This offer is redeemed ✅';
|
|
2092
|
+
if (offer.reward_cashback.is_cashback_percentage === true) {
|
|
2093
|
+
// Percentage cashback scales with the order total and is claimed
|
|
2094
|
+
// once per order; total_amount / max_claims do not apply.
|
|
2095
|
+
const isRedeemed = redeemedTimes > 0;
|
|
2096
|
+
stats.redeemed_times = redeemedTimes;
|
|
2097
|
+
stats.applicable_quantity = 1;
|
|
2098
|
+
stats.claimable = !isRedeemed;
|
|
2099
|
+
if (isRedeemed) {
|
|
2100
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2101
|
+
}
|
|
2102
|
+
else {
|
|
2103
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2104
|
+
totalClaimableOffers.push(offer._id);
|
|
2105
|
+
}
|
|
2090
2106
|
}
|
|
2091
2107
|
else {
|
|
2092
|
-
|
|
2093
|
-
|
|
2108
|
+
// Flat cashback repeats per qualifying spend chunk
|
|
2109
|
+
// (every total_amount unlocks one claim), capped by max_claims.
|
|
2110
|
+
const maxClaimsPerOrder = offer.pathway_to_unlock_type_orders?.max_claims == null
|
|
2111
|
+
? Infinity
|
|
2112
|
+
: Math.max(1, offer.pathway_to_unlock_type_orders.max_claims);
|
|
2113
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, offer.pathway_to_unlock_type_orders?.total_amount);
|
|
2114
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder);
|
|
2115
|
+
const maxRedeemableClaims = getPathwayMaxRedeemableClaims(totalUnlockableClaims);
|
|
2116
|
+
const isClaimable = redeemedTimes < maxRedeemableClaims;
|
|
2117
|
+
stats.redeemed_times = redeemedTimes;
|
|
2118
|
+
stats.applicable_quantity = maxRedeemableClaims;
|
|
2119
|
+
stats.claimable = isClaimable;
|
|
2120
|
+
if (!isClaimable) {
|
|
2121
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2122
|
+
}
|
|
2123
|
+
else {
|
|
2124
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2125
|
+
totalClaimableOffers.push(offer._id);
|
|
2126
|
+
}
|
|
2094
2127
|
}
|
|
2095
2128
|
unlockedOffersApplicableTimes[offer._id] = stats.applicable_quantity;
|
|
2096
2129
|
}
|
|
@@ -2130,9 +2163,14 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2130
2163
|
totalOfferItemsSelected,
|
|
2131
2164
|
applicableQuantity,
|
|
2132
2165
|
});
|
|
2133
|
-
const
|
|
2166
|
+
const maxClaimsPerOrder = offer.pathway_to_unlock_type_orders?.max_claims == null
|
|
2167
|
+
? Infinity
|
|
2168
|
+
: Math.max(1, offer.pathway_to_unlock_type_orders.max_claims);
|
|
2169
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, offer.pathway_to_unlock_type_orders?.total_amount);
|
|
2170
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder);
|
|
2171
|
+
const isClaimable = redeemedTimes < totalUnlockableClaims;
|
|
2134
2172
|
stats.redeemed_times = redeemedTimes;
|
|
2135
|
-
stats.applicable_quantity = applicableQuantity;
|
|
2173
|
+
stats.applicable_quantity = applicableQuantity * Math.max(1, totalUnlockableClaims);
|
|
2136
2174
|
if (isClaimable) {
|
|
2137
2175
|
totalClaimableOffers.push(offer._id);
|
|
2138
2176
|
stats.claimable = true;
|
|
@@ -2339,20 +2377,36 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2339
2377
|
continue;
|
|
2340
2378
|
}
|
|
2341
2379
|
const redeemedTimes = getOfferRedeemedTimes(offer._id);
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2380
|
+
if (offer.reward_cashback.is_cashback_percentage === true) {
|
|
2381
|
+
// Percentage cashback scales with the order total and is claimed
|
|
2382
|
+
// once per order; total_amount / max_claims do not apply.
|
|
2383
|
+
const isRedeemed = redeemedTimes > 0;
|
|
2384
|
+
stats.redeemed_times = redeemedTimes;
|
|
2385
|
+
stats.applicable_quantity = 1;
|
|
2386
|
+
stats.claimable = !isRedeemed;
|
|
2387
|
+
if (isRedeemed) {
|
|
2388
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2389
|
+
}
|
|
2390
|
+
else {
|
|
2391
|
+
totalClaimableOffers.push(offer._id);
|
|
2392
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2393
|
+
}
|
|
2352
2394
|
}
|
|
2353
2395
|
else {
|
|
2354
|
-
|
|
2355
|
-
|
|
2396
|
+
// Flat cashback repeats per qualifying spend chunk
|
|
2397
|
+
// (every total_amount unlocks one claim), capped by max_claims.
|
|
2398
|
+
const maxRedeemableClaims = getPathwayMaxRedeemableClaims(totalUnlockableClaims);
|
|
2399
|
+
const isClaimable = redeemedTimes < maxRedeemableClaims;
|
|
2400
|
+
stats.redeemed_times = redeemedTimes;
|
|
2401
|
+
stats.applicable_quantity = maxRedeemableClaims;
|
|
2402
|
+
stats.claimable = isClaimable;
|
|
2403
|
+
if (!isClaimable) {
|
|
2404
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2405
|
+
}
|
|
2406
|
+
else {
|
|
2407
|
+
totalClaimableOffers.push(offer._id);
|
|
2408
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2409
|
+
}
|
|
2356
2410
|
}
|
|
2357
2411
|
unlockedOffersApplicableTimes[offer._id] = stats.applicable_quantity;
|
|
2358
2412
|
}
|
|
@@ -2596,20 +2650,36 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2596
2650
|
continue;
|
|
2597
2651
|
}
|
|
2598
2652
|
const redeemedTimes = getOfferRedeemedTimes(offer._id);
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2653
|
+
if (offer.reward_cashback.is_cashback_percentage === true) {
|
|
2654
|
+
// Percentage cashback scales with the order total and is claimed
|
|
2655
|
+
// once per order; total_amount / max_claims do not apply.
|
|
2656
|
+
const isRedeemed = redeemedTimes > 0;
|
|
2657
|
+
stats.redeemed_times = redeemedTimes;
|
|
2658
|
+
stats.applicable_quantity = 1;
|
|
2659
|
+
stats.claimable = !isRedeemed;
|
|
2660
|
+
if (isRedeemed) {
|
|
2661
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2662
|
+
}
|
|
2663
|
+
else {
|
|
2664
|
+
totalClaimableOffers.push(offer._id);
|
|
2665
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2666
|
+
}
|
|
2609
2667
|
}
|
|
2610
2668
|
else {
|
|
2611
|
-
|
|
2612
|
-
|
|
2669
|
+
// Flat cashback repeats per qualifying spend chunk
|
|
2670
|
+
// (every total_amount unlocks one claim), capped by max_claims.
|
|
2671
|
+
const maxRedeemableClaims = getPathwayMaxRedeemableClaims(totalUnlockableClaims);
|
|
2672
|
+
const isClaimable = redeemedTimes < maxRedeemableClaims;
|
|
2673
|
+
stats.redeemed_times = redeemedTimes;
|
|
2674
|
+
stats.applicable_quantity = maxRedeemableClaims;
|
|
2675
|
+
stats.claimable = isClaimable;
|
|
2676
|
+
if (!isClaimable) {
|
|
2677
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2678
|
+
}
|
|
2679
|
+
else {
|
|
2680
|
+
totalClaimableOffers.push(offer._id);
|
|
2681
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2682
|
+
}
|
|
2613
2683
|
}
|
|
2614
2684
|
unlockedOffersApplicableTimes[offer._id] = stats.applicable_quantity;
|
|
2615
2685
|
}
|
|
@@ -2814,10 +2884,13 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2814
2884
|
totalOfferItemsSelected,
|
|
2815
2885
|
applicableQuantity,
|
|
2816
2886
|
});
|
|
2817
|
-
const
|
|
2818
|
-
const
|
|
2887
|
+
const maxClaimsPerOrder = max_claims == null ? Infinity : Math.max(1, max_claims);
|
|
2888
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, total_amount);
|
|
2889
|
+
const voucherInventoryClaimCap = matchingVoucherContext != null ? Math.max(0, spendableVoucherCount + redeemedTimesForOffer) : Infinity;
|
|
2890
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder, voucherInventoryClaimCap);
|
|
2891
|
+
const isClaimable = redeemedTimes < totalUnlockableClaims;
|
|
2819
2892
|
stats.redeemed_times = redeemedTimes;
|
|
2820
|
-
stats.applicable_quantity = applicableQuantity *
|
|
2893
|
+
stats.applicable_quantity = applicableQuantity * Math.max(1, totalUnlockableClaims);
|
|
2821
2894
|
stats.claimable = isClaimable;
|
|
2822
2895
|
if (isClaimable) {
|
|
2823
2896
|
totalClaimableOffers.push(offer._id);
|
|
@@ -2889,24 +2962,41 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2889
2962
|
continue;
|
|
2890
2963
|
}
|
|
2891
2964
|
const redeemedTimes = getOfferRedeemedTimes(offer._id);
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2965
|
+
if (offer.reward_cashback.is_cashback_percentage === true) {
|
|
2966
|
+
// Percentage cashback scales with the order total and is claimed
|
|
2967
|
+
// once per order; total_amount / max_claims do not apply.
|
|
2968
|
+
const isRedeemed = redeemedTimes > 0;
|
|
2969
|
+
stats.redeemed_times = redeemedTimes;
|
|
2970
|
+
stats.applicable_quantity = 1;
|
|
2971
|
+
stats.claimable = !isRedeemed;
|
|
2972
|
+
if (isRedeemed) {
|
|
2973
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2974
|
+
}
|
|
2975
|
+
else {
|
|
2976
|
+
totalClaimableOffers.push(offer._id);
|
|
2977
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2978
|
+
}
|
|
2906
2979
|
}
|
|
2907
2980
|
else {
|
|
2908
|
-
|
|
2909
|
-
|
|
2981
|
+
// Flat cashback repeats per qualifying spend chunk
|
|
2982
|
+
// (every total_amount unlocks one claim), capped by max_claims
|
|
2983
|
+
// and the voucher inventory available for this order.
|
|
2984
|
+
const maxClaimsPerOrder = max_claims == null ? Infinity : Math.max(1, max_claims);
|
|
2985
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, total_amount);
|
|
2986
|
+
const voucherInventoryClaimCap = matchingVoucherContext != null ? Math.max(0, spendableVoucherCount + redeemedTimesForOffer) : Infinity;
|
|
2987
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder, voucherInventoryClaimCap);
|
|
2988
|
+
const maxRedeemableClaims = getPathwayMaxRedeemableClaims(totalUnlockableClaims);
|
|
2989
|
+
const isClaimable = redeemedTimes < maxRedeemableClaims;
|
|
2990
|
+
stats.redeemed_times = redeemedTimes;
|
|
2991
|
+
stats.applicable_quantity = maxRedeemableClaims;
|
|
2992
|
+
stats.claimable = isClaimable;
|
|
2993
|
+
if (!isClaimable) {
|
|
2994
|
+
stats.message = 'This offer is redeemed ✅';
|
|
2995
|
+
}
|
|
2996
|
+
else {
|
|
2997
|
+
totalClaimableOffers.push(offer._id);
|
|
2998
|
+
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
2999
|
+
}
|
|
2910
3000
|
}
|
|
2911
3001
|
unlockedOffersApplicableTimes[offer._id] = stats.applicable_quantity;
|
|
2912
3002
|
}
|
|
@@ -2943,9 +3033,13 @@ function getOffersWithStats({ offers, customer, vouchers, giftCards, customerOff
|
|
|
2943
3033
|
totalOfferItemsSelected,
|
|
2944
3034
|
applicableQuantity,
|
|
2945
3035
|
});
|
|
2946
|
-
const
|
|
3036
|
+
const maxClaimsPerOrder = max_claims == null ? Infinity : Math.max(1, max_claims);
|
|
3037
|
+
const unlockTimesForAmount = getOrderValueClaimTimes(orderValue, total_amount);
|
|
3038
|
+
const voucherInventoryClaimCap = matchingVoucherContext != null ? Math.max(0, spendableVoucherCount + redeemedTimesForOffer) : Infinity;
|
|
3039
|
+
const totalUnlockableClaims = Math.min(unlockTimesForAmount, maxClaimsPerOrder, voucherInventoryClaimCap);
|
|
3040
|
+
const isClaimable = redeemedTimes < totalUnlockableClaims;
|
|
2947
3041
|
stats.redeemed_times = redeemedTimes;
|
|
2948
|
-
stats.applicable_quantity = applicableQuantity;
|
|
3042
|
+
stats.applicable_quantity = applicableQuantity * Math.max(1, totalUnlockableClaims);
|
|
2949
3043
|
stats.claimable = isClaimable;
|
|
2950
3044
|
if (isClaimable) {
|
|
2951
3045
|
totalClaimableOffers.push(offer._id);
|
|
@@ -15753,6 +15753,9 @@ export declare const ORDERS_COLLECTION_NAME = "orders";
|
|
|
15753
15753
|
* lookups filtered by is_deleted, newest first.
|
|
15754
15754
|
* - `tenant_id__is_deleted__consumer.phone__createdAt`: per-tenant order
|
|
15755
15755
|
* lookups by consumer phone, filtered by is_deleted, newest first.
|
|
15756
|
+
* - `tenant_id__is_deleted__deferred_settlement__consumer.phone__createdAt`:
|
|
15757
|
+
* per-tenant credit-bill (deferred settlement) order lookups by consumer
|
|
15758
|
+
* phone, filtered by is_deleted, newest first.
|
|
15756
15759
|
*/
|
|
15757
15760
|
export declare const ORDERS_COLLECTION_INDEXES: {
|
|
15758
15761
|
_id: {
|
|
@@ -15781,4 +15784,11 @@ export declare const ORDERS_COLLECTION_INDEXES: {
|
|
|
15781
15784
|
'consumer.phone': number;
|
|
15782
15785
|
createdAt: number;
|
|
15783
15786
|
};
|
|
15787
|
+
tenant_id__is_deleted__deferred_settlement__consumer_phone__createdAt: {
|
|
15788
|
+
tenant_id: number;
|
|
15789
|
+
is_deleted: number;
|
|
15790
|
+
deferred_settlement: number;
|
|
15791
|
+
'consumer.phone': number;
|
|
15792
|
+
createdAt: number;
|
|
15793
|
+
};
|
|
15784
15794
|
};
|
|
@@ -1002,6 +1002,9 @@ exports.ORDERS_COLLECTION_NAME = 'orders';
|
|
|
1002
1002
|
* lookups filtered by is_deleted, newest first.
|
|
1003
1003
|
* - `tenant_id__is_deleted__consumer.phone__createdAt`: per-tenant order
|
|
1004
1004
|
* lookups by consumer phone, filtered by is_deleted, newest first.
|
|
1005
|
+
* - `tenant_id__is_deleted__deferred_settlement__consumer.phone__createdAt`:
|
|
1006
|
+
* per-tenant credit-bill (deferred settlement) order lookups by consumer
|
|
1007
|
+
* phone, filtered by is_deleted, newest first.
|
|
1005
1008
|
*/
|
|
1006
1009
|
exports.ORDERS_COLLECTION_INDEXES = {
|
|
1007
1010
|
_id: { _id: 1 }, // Unique Index
|
|
@@ -1028,4 +1031,11 @@ exports.ORDERS_COLLECTION_INDEXES = {
|
|
|
1028
1031
|
'consumer.phone': 1,
|
|
1029
1032
|
createdAt: -1,
|
|
1030
1033
|
}, // per-tenant order lookups by consumer phone, filtered by is_deleted, newest first
|
|
1034
|
+
tenant_id__is_deleted__deferred_settlement__consumer_phone__createdAt: {
|
|
1035
|
+
tenant_id: 1,
|
|
1036
|
+
is_deleted: 1,
|
|
1037
|
+
deferred_settlement: 1,
|
|
1038
|
+
'consumer.phone': 1,
|
|
1039
|
+
createdAt: -1,
|
|
1040
|
+
}, // per-tenant credit-bill (deferred settlement) order lookups by consumer phone, filtered by is_deleted, newest first
|
|
1031
1041
|
};
|