@managesome/eposmatic-toolkit 0.2.304 → 0.2.306
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/lib/constants/ENUMS.d.ts +20 -0
- package/lib/constants/ENUMS.js +25 -1
- package/lib/helpers/order/generate-order.js +11 -0
- package/lib/helpers/store/cart-actions.d.ts +1 -0
- package/lib/helpers/store/cart-actions.js +24 -0
- package/lib/helpers/types/customer_wallet_assignments.d.ts +45 -0
- package/lib/helpers/types/customer_wallet_assignments.js +2 -0
- package/lib/helpers/types/index.d.ts +1 -0
- package/lib/helpers/types/index.js +1 -0
- package/lib/schemas/models/order.d.ts +3 -0
- package/lib/schemas/models/order.js +5 -0
- package/lib/schemas/types/index.d.ts +1 -1
- package/lib/schemas/types/index.js +1 -1
- package/lib/schemas/types/order.d.ts +1 -0
- package/package.json +1 -1
package/lib/constants/ENUMS.d.ts
CHANGED
|
@@ -1086,3 +1086,23 @@ export declare enum RECEIPT_QR_CODE_TYPE_ENUM {
|
|
|
1086
1086
|
TWITTER_FOLLOW = "TWITTER_FOLLOW"
|
|
1087
1087
|
}
|
|
1088
1088
|
export declare const ALL_RECEIPT_QR_CODE_TYPES: RECEIPT_QR_CODE_TYPE_ENUM[];
|
|
1089
|
+
export declare enum WALLET_ASSET_TYPE_ENUM {
|
|
1090
|
+
VOUCHER = "VOUCHER",
|
|
1091
|
+
GIFT_CARD = "GIFT_CARD"
|
|
1092
|
+
}
|
|
1093
|
+
export declare const ALL_WALLET_ASSET_TYPES: WALLET_ASSET_TYPE_ENUM[];
|
|
1094
|
+
export declare enum WALLET_ASSIGNMENT_BEHAVIOR_ENUM {
|
|
1095
|
+
INCREMENT = "INCREMENT",
|
|
1096
|
+
DECREMENT = "DECREMENT",
|
|
1097
|
+
ABSOLUTE = "ABSOLUTE"
|
|
1098
|
+
}
|
|
1099
|
+
export declare const ALL_WALLET_ASSIGNMENT_BEHAVIORS: WALLET_ASSIGNMENT_BEHAVIOR_ENUM[];
|
|
1100
|
+
export declare enum CUSTOMER_TARGET_MODE_ENUM {
|
|
1101
|
+
EXISTING_CUSTOMERS = "EXISTING_CUSTOMERS",
|
|
1102
|
+
MANUAL_NUMBERS = "MANUAL_NUMBERS",
|
|
1103
|
+
TOP_CUSTOMERS_BY_REVENUE = "TOP_CUSTOMERS_BY_REVENUE",
|
|
1104
|
+
TOP_CUSTOMERS_BY_ORDERS = "TOP_CUSTOMERS_BY_ORDERS",
|
|
1105
|
+
TOP_DELIVERY_CUSTOMERS_BY_REVENUE = "TOP_DELIVERY_CUSTOMERS_BY_REVENUE",
|
|
1106
|
+
TOP_DELIVERY_CUSTOMERS_BY_ORDERS = "TOP_DELIVERY_CUSTOMERS_BY_ORDERS"
|
|
1107
|
+
}
|
|
1108
|
+
export declare const ALL_CUSTOMER_TARGET_MODES: CUSTOMER_TARGET_MODE_ENUM[];
|
package/lib/constants/ENUMS.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.ALL_CATEGORY_DISPLAY_TYPES = exports.CATEGORY_DISPLAY_TYPE_ENUM = export
|
|
|
4
4
|
exports.PLATFORM_PROVIDER_IDS_ENUM = exports.ALL_MARKETING_RECEIPIENT_TYPES = exports.MARKETING_RECEIPIENT_ENUM = exports.ALL_MARKETING_TYPES = exports.MARKETING_TYPE_ENUM = exports.ALL_TOKEN_TYPES = exports.TOKEN_TYPE_ENUM = exports.ALL_EMAIL_PROCESSING_PROVIDERS = exports.EMAIL_PROCESSING_PROVIDERS_ENUM = exports.ALL_SMS_PROCESSING_PROVIDERS = exports.SMS_PROCESSING_PROVIDERS_ENUM = exports.ALL_TERMINAL_TYPES = exports.TERMINAL_TYPE_ENUM = exports.ALL_TERMINAL_PROCESSING_PROVIDERS = exports.TERMINAL_PROCESSING_PROVIDERS_ENUM = exports.TRANSACTION_TYPE_ENUM = exports.ALL_CARD_PROCESSING_PROVIDERS = exports.CARD_PROCESSING_PROVIDERS_ENUM = exports.ALL_PAYMENT_PROVIDERS = exports.PAYMENT_PROVIDERS_ENUM = exports.ALL_SUPPORT_SPECIALIST_PERMISSIONS = exports.ALL_MODERATOR_PERMISSIONS = exports.ALL_USER_PERMISSIONS = exports.USER_PERMISSIONS_ENUM = exports.ALL_REWARDS_USAGE_REF_TYPES = exports.REWARDS_USAGE_REF_TYPE_ENUM = exports.ALL_PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPES = exports.PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM = exports.ALL_PATHWAY_TO_UNLOCK_TYPES = exports.PATHWAY_TO_UNLOCK_TYPE_ENUM = exports.ALL_MYSTERY_GIFT_POPUP_TYPES = exports.MYSTERY_GIFT_POPUP_TYPE_ENUM = exports.ALL_MYSTERY_GIFT_TYPES = exports.MYSTERY_GIFT_TYPE_ENUM = exports.ALL_GIFT_CARD_REWARD_TYPES = exports.GIFT_CARD_REWARD_TYPE_ENUM = exports.ALL_CUSTOMER_REDEMPTION_TYPES = exports.CUSTOMER_REDEMPTION_TYPE_ENUM = exports.ALL_OFFER_REWARD_TYPES = exports.OFFER_REWARD_TYPE_ENUM = exports.ALL_USER_ROLES = exports.USER_ROLES_ENUM = exports.ALL_PLATFORM_TYPES = exports.PLATFORM_TYPE_ENUM = exports.ALL_ORDER_NUMBER_GROUPING_TYPES = exports.ORDER_NUMBER_GROUPING_TYPE_ENUM = exports.ALL_TRACK_ORDER_NUMBER_TYPES = exports.TRACK_ORDER_NUMBER_ENUM = exports.ALL_TABLE_TYPES = exports.TABLE_TYPE_ENUM = void 0;
|
|
5
5
|
exports.INVENTORY_OUTBOUND_TRANSACTIONS = exports.INVENTORY_INBOUND_TRANSACTIONS = exports.ALL_INVENTORY_TRANSACTION_CATEGORIES = exports.INVENTORY_TRANSACTION_CATEGORY_ENUM = exports.ALL_INVENTORY_TRANSACTION_TYPES = exports.INVENTORY_TRANSACTION_TYPE_ENUM = exports.ALL_GST_TYPES = exports.GST_TYPE_ENUM = exports.ALL_EXPENSE_REACCURING_TYPES = exports.EXPENSE_REACCURING_TYPE_ENUM = exports.PAYMENT_EXTENSION_ENUM = exports.ALL_PRINTER_INTERFACES = exports.PRINTER_INTERFACE_ENUM = exports.RECEIPT_WIDTHS = exports.ALL_NUM_OF_COLUMNS = exports.NUM_OF_COLUMNS_ENUM = exports.SPLIT_SYNC_SOURCE_ENUM = exports.ALL_SPLIT_BILL_TYPES = exports.SPLIT_BILL_TYPE_ENUM = exports.ALL_RIDER_FEE_TYPES = exports.RIDER_FEE_TYPE_ENUM = exports.ALL_DELIVERY_AREAS_SEARCH_TYPES = exports.DELIVERY_AREAS_SEARCH_TYPE_ENUM = exports.ALL_WEB_AUTH_TYPES = exports.WEB_AUTH_TYPE_ENUM = exports.KITCHEN_RECEIPT_TYPE_ENUM = exports.PRINTER_EVENT_TYPE_ENUM = exports.SORT_TYPE_ENUM = exports.BLACKLISTED_SMS_COUNTRY_CODES = exports.ALL_OTP_TYPES = exports.OTP_TYPE_ENUM = exports.ALL_TAX_INVOICE_PROVIDERS = exports.TAX_INVOICE_PROVIDER_ENUM = exports.ALL_RESERVATION_STATUS_TYPES = exports.RESERVATION_STATUS_ENUM = exports.TENANT_AMOUNT_DUE_TYPE_ENUM = exports.ALL_KITCHEN_DOCKET_FONT_TYPES = exports.KITCHEN_DOCKET_FONT_TYPE_ENUM = exports.ALL_SORT_ORDER_BY_TYPES = exports.SORT_ORDER_BY_ENUM = exports.RECEIPT_IMAGE_TYPE_ENUM = exports.ALL_RECEIPT_TYPES = exports.RECEIPT_TYPE_ENUM = exports.ALL_PRINTING_PREFERENCES = exports.PRINTING_PREFERENCE_ENUM = exports.ALL_PRINTER_BRAND_TYPES = exports.PRINTER_BRAND_TYPE_ENUM = exports.ALL_ORDER_ITEM_TYPES = exports.ORDER_ITEM_TYPE_ENUM = exports.ALL_PLATFORM_PROVIDER_IDS = void 0;
|
|
6
6
|
exports.ALL_ONLINE_ORDERING_DESIGN_TYPES = exports.ONLINE_ORDERING_DESIGN_TYPE_ENUM = exports.ALL_NOTIFICATION_PROVIDERS = exports.NOTIFICATION_PROVIDER_ENUM = exports.ALL_ORDER_COMPLETION_TYPES = exports.ORDER_COMPLETION_TYPE_ENUM = exports.ITEM_COMPARISON_FIELD_ENUM = exports.VOID_ITEM_STAFF_REPORT_ENUM = exports.ALL_DISCOUNT_APPLICABILITY_TYPES = exports.DISCOUNT_APPLICABILITY_ENUM = exports.ALL_DISCOUNT_TYPES = exports.DISCOUNT_TYPE_ENUM = exports.EMAIL_TEMPLATES_TYPE_ENUM = exports.ALL_ALERT_NOTIFICATIONS_TYPES = exports.ALERT_NOTIFICATIONS_TYPE_ENUM = exports.ALL_WALLET_TRANSACTION_STATUS = exports.WALLET_TRANSACTION_STATUS_ENUM = exports.ALL_WALLET_TRANSACTION_CATEGORIES = exports.WALLET_TRANSACTION_CATEGORY_ENUM = exports.ALL_WALLET_TRANSACTION_TYPES = exports.WALLET_TRANSACTION_TYPE_ENUM = exports.ALL_WAREHOUSE_SUPPORT_SPECIALIST_PERMISSIONS = exports.ALL_WAREHOUSE_MODERATOR_PERMISSIONS = exports.ALL_WAREHOUSE_USER_PERMISSIONS = exports.WAREHOUSE_USER_PERMISSIONS_ENUM = exports.ALL_WAREHOUSE_INVOICE_STATUS_NAMES = exports.WAREHOUSE_INVOICE_STATUS_ENUM = exports.ALL_PURCHASE_ORDER_STATUS_NAMES = exports.PURCHASE_ORDER_STATUS_ENUM = exports.ALL_DELIVERY_STATUS = exports.DELIVERY_STATUS_ENUM = exports.ALL_INVENTORY_ITEM_TYPES = exports.INVENTORY_ITEM_TYPE_ENUM = exports.ALL_RATING_TYPES = exports.RATING_TYPE_ENUM = exports.ALL_SUBSCRIPTION_STATUS = exports.SUBSCRIPTION_STATUS_ENUM = exports.ALL_VOID_WAREHOUSE_INVOICE_ITEM_TYPES = exports.VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM = exports.ALL_VOID_PURCHASE_ORDER_ITEM_TYPES = exports.VOID_PURCHASE_ORDER_ITEM_TYPE_ENUM = exports.ALL_VOID_ORDER_ITEM_TYPES = exports.VOID_ORDER_ITEM_TYPE_ENUM = exports.COMPARISON_REPORT_TYPE_ENUM = exports.ALL_MULTI_TENANT_WEBSITE_TYPES = exports.MULTI_TENANT_WEBSITE_TYPE_ENUM = exports.ALL_TIME_RANGE_ENUMS = exports.TIME_RANGE_ENUM = exports.ALL_ITEM_TRANSACTION_TYPES = exports.ITEM_TRANSACTION_TYPE_ENUM = void 0;
|
|
7
|
-
exports.ALL_RECEIPT_QR_CODE_TYPES = exports.RECEIPT_QR_CODE_TYPE_ENUM = exports.ALL_INTERNAL_LEAD_STATUS = exports.INTERNAL_LEAD_STATUS_ENUM = exports.ALL_INTERNAL_LEAD_SOURCES = exports.INTERNAL_LEAD_SOURCE_ENUM = exports.ALL_CASH_DRAWER_STATUS = exports.CASH_DRAWER_STATUS_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_CATEGORIES = exports.CASH_IN_HAND_TRANSACTION_CATEGORY_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_TYPES = exports.CASH_IN_HAND_TRANSACTION_TYPE_ENUM = exports.ALL_CASH_IN_OUT_TYPES = exports.CASH_IN_OUT_TYPE_ENUM = exports.ALL_POS_SHIFT_STATUS = exports.POS_SHIFT_STATUS_ENUM = exports.ALL_POS_DAY_STATUS = exports.POS_DAY_STATUS_ENUM = exports.ALL_MODIFIER_OPTION_REF_TYPES = exports.MODIFIER_OPTION_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_CLIENT_TYPES = exports.WAREHOUSE_CLIENT_TYPE_ENUM = void 0;
|
|
7
|
+
exports.ALL_CUSTOMER_TARGET_MODES = exports.CUSTOMER_TARGET_MODE_ENUM = exports.ALL_WALLET_ASSIGNMENT_BEHAVIORS = exports.WALLET_ASSIGNMENT_BEHAVIOR_ENUM = exports.ALL_WALLET_ASSET_TYPES = exports.WALLET_ASSET_TYPE_ENUM = exports.ALL_RECEIPT_QR_CODE_TYPES = exports.RECEIPT_QR_CODE_TYPE_ENUM = exports.ALL_INTERNAL_LEAD_STATUS = exports.INTERNAL_LEAD_STATUS_ENUM = exports.ALL_INTERNAL_LEAD_SOURCES = exports.INTERNAL_LEAD_SOURCE_ENUM = exports.ALL_CASH_DRAWER_STATUS = exports.CASH_DRAWER_STATUS_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_CATEGORIES = exports.CASH_IN_HAND_TRANSACTION_CATEGORY_ENUM = exports.ALL_CASH_IN_HAND_TRANSACTION_TYPES = exports.CASH_IN_HAND_TRANSACTION_TYPE_ENUM = exports.ALL_CASH_IN_OUT_TYPES = exports.CASH_IN_OUT_TYPE_ENUM = exports.ALL_POS_SHIFT_STATUS = exports.POS_SHIFT_STATUS_ENUM = exports.ALL_POS_DAY_STATUS = exports.POS_DAY_STATUS_ENUM = exports.ALL_MODIFIER_OPTION_REF_TYPES = exports.MODIFIER_OPTION_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_CLIENT_TYPES = exports.WAREHOUSE_CLIENT_TYPE_ENUM = void 0;
|
|
8
8
|
var ORDER_FROM_ENUM;
|
|
9
9
|
(function (ORDER_FROM_ENUM) {
|
|
10
10
|
ORDER_FROM_ENUM["WEB"] = "WEB";
|
|
@@ -1792,3 +1792,27 @@ var RECEIPT_QR_CODE_TYPE_ENUM;
|
|
|
1792
1792
|
RECEIPT_QR_CODE_TYPE_ENUM["TWITTER_FOLLOW"] = "TWITTER_FOLLOW";
|
|
1793
1793
|
})(RECEIPT_QR_CODE_TYPE_ENUM || (exports.RECEIPT_QR_CODE_TYPE_ENUM = RECEIPT_QR_CODE_TYPE_ENUM = {}));
|
|
1794
1794
|
exports.ALL_RECEIPT_QR_CODE_TYPES = Object.values(RECEIPT_QR_CODE_TYPE_ENUM);
|
|
1795
|
+
// ====================>> <<====================== //
|
|
1796
|
+
var WALLET_ASSET_TYPE_ENUM;
|
|
1797
|
+
(function (WALLET_ASSET_TYPE_ENUM) {
|
|
1798
|
+
WALLET_ASSET_TYPE_ENUM["VOUCHER"] = "VOUCHER";
|
|
1799
|
+
WALLET_ASSET_TYPE_ENUM["GIFT_CARD"] = "GIFT_CARD";
|
|
1800
|
+
})(WALLET_ASSET_TYPE_ENUM || (exports.WALLET_ASSET_TYPE_ENUM = WALLET_ASSET_TYPE_ENUM = {}));
|
|
1801
|
+
exports.ALL_WALLET_ASSET_TYPES = Object.values(WALLET_ASSET_TYPE_ENUM);
|
|
1802
|
+
var WALLET_ASSIGNMENT_BEHAVIOR_ENUM;
|
|
1803
|
+
(function (WALLET_ASSIGNMENT_BEHAVIOR_ENUM) {
|
|
1804
|
+
WALLET_ASSIGNMENT_BEHAVIOR_ENUM["INCREMENT"] = "INCREMENT";
|
|
1805
|
+
WALLET_ASSIGNMENT_BEHAVIOR_ENUM["DECREMENT"] = "DECREMENT";
|
|
1806
|
+
WALLET_ASSIGNMENT_BEHAVIOR_ENUM["ABSOLUTE"] = "ABSOLUTE";
|
|
1807
|
+
})(WALLET_ASSIGNMENT_BEHAVIOR_ENUM || (exports.WALLET_ASSIGNMENT_BEHAVIOR_ENUM = WALLET_ASSIGNMENT_BEHAVIOR_ENUM = {}));
|
|
1808
|
+
exports.ALL_WALLET_ASSIGNMENT_BEHAVIORS = Object.values(WALLET_ASSIGNMENT_BEHAVIOR_ENUM);
|
|
1809
|
+
var CUSTOMER_TARGET_MODE_ENUM;
|
|
1810
|
+
(function (CUSTOMER_TARGET_MODE_ENUM) {
|
|
1811
|
+
CUSTOMER_TARGET_MODE_ENUM["EXISTING_CUSTOMERS"] = "EXISTING_CUSTOMERS";
|
|
1812
|
+
CUSTOMER_TARGET_MODE_ENUM["MANUAL_NUMBERS"] = "MANUAL_NUMBERS";
|
|
1813
|
+
CUSTOMER_TARGET_MODE_ENUM["TOP_CUSTOMERS_BY_REVENUE"] = "TOP_CUSTOMERS_BY_REVENUE";
|
|
1814
|
+
CUSTOMER_TARGET_MODE_ENUM["TOP_CUSTOMERS_BY_ORDERS"] = "TOP_CUSTOMERS_BY_ORDERS";
|
|
1815
|
+
CUSTOMER_TARGET_MODE_ENUM["TOP_DELIVERY_CUSTOMERS_BY_REVENUE"] = "TOP_DELIVERY_CUSTOMERS_BY_REVENUE";
|
|
1816
|
+
CUSTOMER_TARGET_MODE_ENUM["TOP_DELIVERY_CUSTOMERS_BY_ORDERS"] = "TOP_DELIVERY_CUSTOMERS_BY_ORDERS";
|
|
1817
|
+
})(CUSTOMER_TARGET_MODE_ENUM || (exports.CUSTOMER_TARGET_MODE_ENUM = CUSTOMER_TARGET_MODE_ENUM = {}));
|
|
1818
|
+
exports.ALL_CUSTOMER_TARGET_MODES = Object.values(CUSTOMER_TARGET_MODE_ENUM);
|
|
@@ -143,6 +143,9 @@ function generateOrderOnCreate(order, withIterations) {
|
|
|
143
143
|
if (!newOrder.redeemed_offers || Object.keys(newOrder.redeemed_offers).length === 0) {
|
|
144
144
|
delete newOrder.redeemed_offers;
|
|
145
145
|
}
|
|
146
|
+
if (!newOrder.wallet_redemptions || Object.keys(newOrder.wallet_redemptions).length === 0) {
|
|
147
|
+
delete newOrder.wallet_redemptions;
|
|
148
|
+
}
|
|
146
149
|
if (!newOrder.surcharge) {
|
|
147
150
|
delete newOrder.surcharge;
|
|
148
151
|
delete newOrder.surcharge_amount;
|
|
@@ -326,6 +329,14 @@ function generateOrderOnUpdate(partialUpdatedOrder) {
|
|
|
326
329
|
delete set.redeemed_offers;
|
|
327
330
|
unset['redeemed_offers'] = '';
|
|
328
331
|
}
|
|
332
|
+
if (set.wallet_redemptions === null) {
|
|
333
|
+
delete set.wallet_redemptions;
|
|
334
|
+
unset['wallet_redemptions'] = '';
|
|
335
|
+
}
|
|
336
|
+
else if (set.wallet_redemptions != null && Object.keys(set.wallet_redemptions).length === 0) {
|
|
337
|
+
delete set.wallet_redemptions;
|
|
338
|
+
unset['wallet_redemptions'] = '';
|
|
339
|
+
}
|
|
329
340
|
if (set.surcharge === 0) {
|
|
330
341
|
delete set.surcharge;
|
|
331
342
|
delete set.surcharge_amount;
|
|
@@ -109,6 +109,7 @@ export declare function getChangeCourseStatusData(data: Partial<IOrder>, course_
|
|
|
109
109
|
payment_method_expected?: import("../../constants").PAYMENT_METHOD_EXPECTED_ENUM | undefined;
|
|
110
110
|
order_taker_details?: (import("../../schemas").IStaffDetails | null) | undefined;
|
|
111
111
|
redeemed_offers?: (Record<string, number> | null) | undefined;
|
|
112
|
+
wallet_redemptions?: (Record<string, number> | null) | undefined;
|
|
112
113
|
order_settled_at?: Date | undefined;
|
|
113
114
|
order_settled_at_mins?: number | undefined;
|
|
114
115
|
createdAt_mins?: number | undefined;
|
|
@@ -479,6 +479,26 @@ function getReconciledRedeemedOffersMap({ existingRedeemedOffers, categories, of
|
|
|
479
479
|
function getRedeemedOffersMap(existingRedeemedOffers) {
|
|
480
480
|
return getNormalizedRedeemedOffersMap(existingRedeemedOffers);
|
|
481
481
|
}
|
|
482
|
+
function getNormalizedWalletRedemptionsMap(walletRedemptions) {
|
|
483
|
+
if (walletRedemptions == null)
|
|
484
|
+
return null;
|
|
485
|
+
const normalized = {};
|
|
486
|
+
const walletIds = Object.keys(walletRedemptions);
|
|
487
|
+
for (let i = 0; i < walletIds.length; i++) {
|
|
488
|
+
const walletId = walletIds[i];
|
|
489
|
+
const trimmedId = walletId?.toString().trim();
|
|
490
|
+
if (!trimmedId)
|
|
491
|
+
continue;
|
|
492
|
+
const amount = Number(walletRedemptions[walletId]);
|
|
493
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
494
|
+
continue;
|
|
495
|
+
normalized[trimmedId] = amount;
|
|
496
|
+
}
|
|
497
|
+
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
498
|
+
}
|
|
499
|
+
function getWalletRedemptionsMap(existingWalletRedemptions) {
|
|
500
|
+
return getNormalizedWalletRedemptionsMap(existingWalletRedemptions);
|
|
501
|
+
}
|
|
482
502
|
function calculateCartOrderInfoAndSyncData(data, courses, listnerSettings, calculateItemMetadata) {
|
|
483
503
|
const isCompleted = data.order_status === constants_1.ORDER_STATUS_ENUM.COMPLETED;
|
|
484
504
|
/* ===============================><=============================== */
|
|
@@ -748,6 +768,7 @@ function calculateCartOrderInfoAndSyncData(data, courses, listnerSettings, calcu
|
|
|
748
768
|
categories,
|
|
749
769
|
order_discount_details,
|
|
750
770
|
redeemed_offers: getRedeemedOffersMap(data.redeemed_offers),
|
|
771
|
+
wallet_redemptions: getWalletRedemptionsMap(data.wallet_redemptions),
|
|
751
772
|
total_discount_applied,
|
|
752
773
|
delivery_details,
|
|
753
774
|
tax_amount,
|
|
@@ -1986,6 +2007,7 @@ function getRemoveOfferFromCartData(data, offer_id, courses, listnerSettings) {
|
|
|
1986
2007
|
categories: newCategories,
|
|
1987
2008
|
order_discount_details,
|
|
1988
2009
|
redeemed_offers,
|
|
2010
|
+
wallet_redemptions: getWalletRedemptionsMap(data.wallet_redemptions),
|
|
1989
2011
|
};
|
|
1990
2012
|
const newData = calculateCartOrderInfoAndSyncData(order, courses, listnerSettings);
|
|
1991
2013
|
return newData;
|
|
@@ -2066,6 +2088,7 @@ function getRemoveAllOffersFromCartData(data, courses, listnerSettings, offerIds
|
|
|
2066
2088
|
categories: newCategories,
|
|
2067
2089
|
order_discount_details,
|
|
2068
2090
|
redeemed_offers,
|
|
2091
|
+
wallet_redemptions: getWalletRedemptionsMap(data.wallet_redemptions),
|
|
2069
2092
|
};
|
|
2070
2093
|
const newData = calculateCartOrderInfoAndSyncData(order, courses, listnerSettings);
|
|
2071
2094
|
return newData;
|
|
@@ -2354,6 +2377,7 @@ offers) {
|
|
|
2354
2377
|
categories: newCategories,
|
|
2355
2378
|
order_discount_details,
|
|
2356
2379
|
redeemed_offers,
|
|
2380
|
+
wallet_redemptions: getWalletRedemptionsMap(data.wallet_redemptions),
|
|
2357
2381
|
};
|
|
2358
2382
|
const newData = calculateCartOrderInfoAndSyncData(order, courses, listnerSettings);
|
|
2359
2383
|
return newData;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CUSTOMER_TARGET_MODE_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM } from '../../constants';
|
|
2
|
+
export interface IPreviewTargetCustomersBody {
|
|
3
|
+
mode: CUSTOMER_TARGET_MODE_ENUM;
|
|
4
|
+
search?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
phone_numbers?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ICustomerWalletPreview {
|
|
9
|
+
phone_number: string;
|
|
10
|
+
display_name: string | null;
|
|
11
|
+
total_orders: number;
|
|
12
|
+
total_spent: number;
|
|
13
|
+
delivery_orders: number;
|
|
14
|
+
delivery_spent: number;
|
|
15
|
+
voucher_total_count: number;
|
|
16
|
+
gift_card_total_count: number;
|
|
17
|
+
voucher_distinct_count: number;
|
|
18
|
+
gift_card_distinct_count: number;
|
|
19
|
+
exists: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface IPreviewTargetCustomersResponse {
|
|
22
|
+
mode: CUSTOMER_TARGET_MODE_ENUM;
|
|
23
|
+
total: number;
|
|
24
|
+
customers: ICustomerWalletPreview[];
|
|
25
|
+
}
|
|
26
|
+
export interface IAssignWalletAssetsBody {
|
|
27
|
+
behavior: WALLET_ASSIGNMENT_BEHAVIOR_ENUM;
|
|
28
|
+
code_quantities: Record<string, number>;
|
|
29
|
+
phone_numbers: string[];
|
|
30
|
+
auto_create_missing?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface IWalletAssignmentFailure {
|
|
33
|
+
phone_number: string;
|
|
34
|
+
reason: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IWalletAssignmentResponse {
|
|
37
|
+
asset_type: WALLET_ASSET_TYPE_ENUM;
|
|
38
|
+
behavior: WALLET_ASSIGNMENT_BEHAVIOR_ENUM;
|
|
39
|
+
code_quantities: Record<string, number>;
|
|
40
|
+
requested_count: number;
|
|
41
|
+
updated_count: number;
|
|
42
|
+
failed_count: number;
|
|
43
|
+
updated_phone_numbers: string[];
|
|
44
|
+
failures: IWalletAssignmentFailure[];
|
|
45
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './cart-actions';
|
|
|
2
2
|
export * from './cart-helpers';
|
|
3
3
|
export * from './catalog';
|
|
4
4
|
export * from './common';
|
|
5
|
+
export * from './customer_wallet_assignments';
|
|
5
6
|
export * from './email-templates';
|
|
6
7
|
export * from './fbr-generate-invoice';
|
|
7
8
|
export * from './hubrise_catalog';
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./cart-actions"), exports);
|
|
|
18
18
|
__exportStar(require("./cart-helpers"), exports);
|
|
19
19
|
__exportStar(require("./catalog"), exports);
|
|
20
20
|
__exportStar(require("./common"), exports);
|
|
21
|
+
__exportStar(require("./customer_wallet_assignments"), exports);
|
|
21
22
|
__exportStar(require("./email-templates"), exports);
|
|
22
23
|
__exportStar(require("./fbr-generate-invoice"), exports);
|
|
23
24
|
__exportStar(require("./hubrise_catalog"), exports);
|
|
@@ -5185,6 +5185,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
5185
5185
|
is_gst_inclusive?: boolean | null | undefined;
|
|
5186
5186
|
tax_invoice_provider_charges?: number | null | undefined;
|
|
5187
5187
|
redeemed_offers?: Map<string, number> | null | undefined;
|
|
5188
|
+
wallet_redemptions?: Map<string, number> | null | undefined;
|
|
5188
5189
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
5189
5190
|
createdAt: NativeDate;
|
|
5190
5191
|
updatedAt: NativeDate;
|
|
@@ -10283,6 +10284,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
10283
10284
|
is_gst_inclusive?: boolean | null | undefined;
|
|
10284
10285
|
tax_invoice_provider_charges?: number | null | undefined;
|
|
10285
10286
|
redeemed_offers?: Map<string, number> | null | undefined;
|
|
10287
|
+
wallet_redemptions?: Map<string, number> | null | undefined;
|
|
10286
10288
|
}>> & import("mongoose").FlatRecord<{
|
|
10287
10289
|
createdAt: NativeDate;
|
|
10288
10290
|
updatedAt: NativeDate;
|
|
@@ -15381,6 +15383,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
15381
15383
|
is_gst_inclusive?: boolean | null | undefined;
|
|
15382
15384
|
tax_invoice_provider_charges?: number | null | undefined;
|
|
15383
15385
|
redeemed_offers?: Map<string, number> | null | undefined;
|
|
15386
|
+
wallet_redemptions?: Map<string, number> | null | undefined;
|
|
15384
15387
|
}> & Required<{
|
|
15385
15388
|
_id: import("mongoose").Types.ObjectId;
|
|
15386
15389
|
}> & {
|
|
@@ -813,6 +813,11 @@ exports.OrderSchema = new mongoose_1.Schema({
|
|
|
813
813
|
of: Number,
|
|
814
814
|
required: false,
|
|
815
815
|
},
|
|
816
|
+
wallet_redemptions: {
|
|
817
|
+
type: Map,
|
|
818
|
+
of: Number,
|
|
819
|
+
required: false,
|
|
820
|
+
},
|
|
816
821
|
order_settled_at: {
|
|
817
822
|
type: mongoose_1.Schema.Types.Date,
|
|
818
823
|
required: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '../../helpers/types/customer_wallet_assignments';
|
|
1
2
|
export * from './app_configs';
|
|
2
3
|
export * from './applied-order-discounts';
|
|
3
4
|
export * from './brand';
|
|
@@ -10,7 +11,6 @@ export * from './close_dates';
|
|
|
10
11
|
export * from './common';
|
|
11
12
|
export * from './courses';
|
|
12
13
|
export * from './customer_redemptions';
|
|
13
|
-
export * from './customer_wallet_assignments';
|
|
14
14
|
export * from './customers';
|
|
15
15
|
export * from './deliveries';
|
|
16
16
|
export * from './delivery_areas';
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../../helpers/types/customer_wallet_assignments"), exports);
|
|
17
18
|
__exportStar(require("./app_configs"), exports);
|
|
18
19
|
__exportStar(require("./applied-order-discounts"), exports);
|
|
19
20
|
__exportStar(require("./brand"), exports);
|
|
@@ -26,7 +27,6 @@ __exportStar(require("./close_dates"), exports);
|
|
|
26
27
|
__exportStar(require("./common"), exports);
|
|
27
28
|
__exportStar(require("./courses"), exports);
|
|
28
29
|
__exportStar(require("./customer_redemptions"), exports);
|
|
29
|
-
__exportStar(require("./customer_wallet_assignments"), exports);
|
|
30
30
|
__exportStar(require("./customers"), exports);
|
|
31
31
|
__exportStar(require("./deliveries"), exports);
|
|
32
32
|
__exportStar(require("./delivery_areas"), exports);
|
|
@@ -223,6 +223,7 @@ export interface IOrder extends CommonOptionalFields {
|
|
|
223
223
|
payment_method_expected?: PAYMENT_METHOD_EXPECTED_ENUM;
|
|
224
224
|
order_taker_details?: IStaffDetails | null;
|
|
225
225
|
redeemed_offers?: Record<string, number> | null;
|
|
226
|
+
wallet_redemptions?: Record<string, number> | null;
|
|
226
227
|
order_settled_at: Date;
|
|
227
228
|
order_settled_at_mins: number;
|
|
228
229
|
createdAt_mins: number;
|