@managesome/eposmatic-toolkit 0.2.577 → 0.2.578

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.
@@ -1012,10 +1012,15 @@ export declare enum POS_SHIFT_STATUS_ENUM {
1012
1012
  export declare const ALL_POS_SHIFT_STATUS: POS_SHIFT_STATUS_ENUM[];
1013
1013
  export declare enum CASH_IN_OUT_TYPE_ENUM {
1014
1014
  CASH_IN = "CASH_IN",
1015
- CASH_OUT = "CASH_OUT",
1016
- EXPENSE = "EXPENSE"
1015
+ CASH_OUT = "CASH_OUT"
1017
1016
  }
1018
1017
  export declare const ALL_CASH_IN_OUT_TYPES: CASH_IN_OUT_TYPE_ENUM[];
1018
+ export declare enum CASH_IN_OUT_REF_ENUM {
1019
+ NONE = "NONE",
1020
+ ORDER = "ORDER",
1021
+ EXPENSE = "EXPENSE"
1022
+ }
1023
+ export declare const ALL_CASH_IN_OUT_REFS: CASH_IN_OUT_REF_ENUM[];
1019
1024
  export declare enum CASH_IN_HAND_TRANSACTION_TYPE_ENUM {
1020
1025
  INBOUND = "INBOUND",
1021
1026
  OUTBOUND = "OUTBOUND"
@@ -4,8 +4,8 @@ exports.COUNTRY_NAME_ENUM = exports.ALL_COUNTRY_ALPHA_3_TYPES = exports.COUNTRY_
4
4
  exports.EMAIL_STATUS_ENUM = exports.ALL_COMMUNICATION_CHANNELS = exports.COMMUNICATION_CHANNEL_ENUM = exports.ALL_EMAIL_DOCUMENT_KINDS = exports.EMAIL_DOCUMENT_KIND_ENUM = exports.ALL_EMAIL_PROCESSING_PROVIDERS = exports.EMAIL_PROCESSING_PROVIDERS_ENUM = exports.ALL_SMS_PROCESSING_PROVIDERS = exports.SMS_PROCESSING_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_CUSTOMER_REDEMPTION_SOURCE_TYPES = exports.CUSTOMER_REDEMPTION_SOURCE_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 = exports.ALL_CATEGORY_DISPLAY_TYPES = exports.CATEGORY_DISPLAY_TYPE_ENUM = exports.ALL_PAYMENT_METHOD_EXPECTED = exports.PAYMENT_METHOD_EXPECTED_ENUM = exports.ALL_WEB_UNPAID_PAYMENT_TYPES = exports.WEB_UNPAID_PAYMENT_TYPE_ENUM = exports.ALL_COUNTRY_FLAG_TYPES = exports.COUNTRY_FLAG_ENUM = exports.ALL_COUNTRY_NAME_TYPES = void 0;
5
5
  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.WHITELISTED_API_SMS_COUNTRY_CODES = 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 = 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_STATUS = void 0;
6
6
  exports.MODIFIER_OPTION_REF_TYPE_ENUM = 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_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_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 = 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 = void 0;
7
- exports.HR_SHIFT_TYPE_ENUM = exports.ALL_HR_BIOMETRIC_ENROLLMENT_TYPE_NAMES = exports.HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM = exports.ALL_HR_CHECK_IN_METHOD_NAMES = exports.HR_CHECK_IN_METHOD_ENUM = exports.ALL_HR_ATTENDANCE_STATUS_NAMES = exports.HR_ATTENDANCE_STATUS_ENUM = exports.ALL_HR_EMPLOYMENT_STATUS_NAMES = exports.HR_EMPLOYMENT_STATUS_ENUM = exports.ALL_INTERNAL_CUSTOMER_PAYMENT_METHOD_NAMES = exports.INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM = exports.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES = exports.INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM = exports.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_NAMES = exports.INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM = exports.ALL_INTERNAL_CUSTOMER_BILLING_CYCLE_NAMES = exports.INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM = exports.ALL_INTERNAL_CUSTOMER_TYPE_NAMES = exports.INTERNAL_CUSTOMER_TYPE_ENUM = exports.ALL_INTERNAL_INVOICE_TYPE_NAMES = exports.INTERNAL_INVOICE_TYPE_ENUM = exports.ALL_INTERNAL_INVOICE_STATUS_NAMES = exports.INTERNAL_INVOICE_STATUS_ENUM = exports.ALL_SUBSCRIPTION_HARDWARE_NAMES = exports.SUBSCRIPTION_HARDWARE_ENUM = 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 = void 0;
8
- exports.ALL_HR_EMPLOYEE_DOCUMENT_TYPES = exports.HR_EMPLOYEE_DOCUMENT_TYPE_ENUM = exports.ALL_HR_SHIFT_STATUS_NAMES = exports.HR_SHIFT_STATUS_ENUM = exports.ALL_HR_SHIFT_TYPE_NAMES = void 0;
7
+ exports.HR_BIOMETRIC_ENROLLMENT_TYPE_ENUM = exports.ALL_HR_CHECK_IN_METHOD_NAMES = exports.HR_CHECK_IN_METHOD_ENUM = exports.ALL_HR_ATTENDANCE_STATUS_NAMES = exports.HR_ATTENDANCE_STATUS_ENUM = exports.ALL_HR_EMPLOYMENT_STATUS_NAMES = exports.HR_EMPLOYMENT_STATUS_ENUM = exports.ALL_INTERNAL_CUSTOMER_PAYMENT_METHOD_NAMES = exports.INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM = exports.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES = exports.INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM = exports.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_NAMES = exports.INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM = exports.ALL_INTERNAL_CUSTOMER_BILLING_CYCLE_NAMES = exports.INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM = exports.ALL_INTERNAL_CUSTOMER_TYPE_NAMES = exports.INTERNAL_CUSTOMER_TYPE_ENUM = exports.ALL_INTERNAL_INVOICE_TYPE_NAMES = exports.INTERNAL_INVOICE_TYPE_ENUM = exports.ALL_INTERNAL_INVOICE_STATUS_NAMES = exports.INTERNAL_INVOICE_STATUS_ENUM = exports.ALL_SUBSCRIPTION_HARDWARE_NAMES = exports.SUBSCRIPTION_HARDWARE_ENUM = 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_REFS = exports.CASH_IN_OUT_REF_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 = void 0;
8
+ exports.ALL_HR_EMPLOYEE_DOCUMENT_TYPES = exports.HR_EMPLOYEE_DOCUMENT_TYPE_ENUM = exports.ALL_HR_SHIFT_STATUS_NAMES = exports.HR_SHIFT_STATUS_ENUM = exports.ALL_HR_SHIFT_TYPE_NAMES = exports.HR_SHIFT_TYPE_ENUM = exports.ALL_HR_BIOMETRIC_ENROLLMENT_TYPE_NAMES = void 0;
9
9
  var ORDER_FROM_ENUM;
10
10
  (function (ORDER_FROM_ENUM) {
11
11
  ORDER_FROM_ENUM["WEB"] = "WEB";
@@ -1667,10 +1667,17 @@ var CASH_IN_OUT_TYPE_ENUM;
1667
1667
  (function (CASH_IN_OUT_TYPE_ENUM) {
1668
1668
  CASH_IN_OUT_TYPE_ENUM["CASH_IN"] = "CASH_IN";
1669
1669
  CASH_IN_OUT_TYPE_ENUM["CASH_OUT"] = "CASH_OUT";
1670
- CASH_IN_OUT_TYPE_ENUM["EXPENSE"] = "EXPENSE";
1671
1670
  })(CASH_IN_OUT_TYPE_ENUM || (exports.CASH_IN_OUT_TYPE_ENUM = CASH_IN_OUT_TYPE_ENUM = {}));
1672
1671
  exports.ALL_CASH_IN_OUT_TYPES = Object.values(CASH_IN_OUT_TYPE_ENUM);
1673
1672
  // ======================>> <<====================== //
1673
+ var CASH_IN_OUT_REF_ENUM;
1674
+ (function (CASH_IN_OUT_REF_ENUM) {
1675
+ CASH_IN_OUT_REF_ENUM["NONE"] = "NONE";
1676
+ CASH_IN_OUT_REF_ENUM["ORDER"] = "ORDER";
1677
+ CASH_IN_OUT_REF_ENUM["EXPENSE"] = "EXPENSE";
1678
+ })(CASH_IN_OUT_REF_ENUM || (exports.CASH_IN_OUT_REF_ENUM = CASH_IN_OUT_REF_ENUM = {}));
1679
+ exports.ALL_CASH_IN_OUT_REFS = Object.values(CASH_IN_OUT_REF_ENUM);
1680
+ // ======================>> <<====================== //
1674
1681
  var CASH_IN_HAND_TRANSACTION_TYPE_ENUM;
1675
1682
  (function (CASH_IN_HAND_TRANSACTION_TYPE_ENUM) {
1676
1683
  CASH_IN_HAND_TRANSACTION_TYPE_ENUM["INBOUND"] = "INBOUND";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Converts the keys of a denominations map from cents to dollars
3
+ * (e.g. 1 -> "0.01", 100 -> "1"). Keys are monetary denomination values;
4
+ * the values (bill/coin counts) are left unchanged. NaN entries are ignored.
5
+ */
6
+ export declare function getDenominationsFromCents(denominations: Record<string, number>): Record<string, number>;
7
+ /**
8
+ * Converts the values of a denominations array from cents to dollars
9
+ * (e.g. [1, 5, 10, 25, 100] -> [0.01, 0.05, 0.1, 0.25, 1]).
10
+ * NaN entries are ignored.
11
+ */
12
+ export declare function getDenominationsArrayFromCents(denominations: number[]): number[];
13
+ /**
14
+ * Converts the keys of a denominations map from dollars to integer cents
15
+ * (e.g. "0.01" -> 1, "1" -> 100). Keys are monetary denomination values;
16
+ * the values (bill/coin counts) are left unchanged. NaN entries are ignored.
17
+ */
18
+ export declare function getDenominationsWithCents(denominations: Record<string, number>): Record<string, number>;
19
+ /**
20
+ * Converts the values of a denominations array from dollars to integer cents
21
+ * (e.g. [0.01, 0.05, 0.1, 0.25, 1] -> [1, 5, 10, 25, 100]).
22
+ * NaN entries are ignored.
23
+ */
24
+ export declare function getDenominationsArrayWithCents(denominations: number[]): number[];
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDenominationsFromCents = getDenominationsFromCents;
4
+ exports.getDenominationsArrayFromCents = getDenominationsArrayFromCents;
5
+ exports.getDenominationsWithCents = getDenominationsWithCents;
6
+ exports.getDenominationsArrayWithCents = getDenominationsArrayWithCents;
7
+ const price_conversion_1 = require("./price-conversion");
8
+ /**
9
+ * Converts the keys of a denominations map from cents to dollars
10
+ * (e.g. 1 -> "0.01", 100 -> "1"). Keys are monetary denomination values;
11
+ * the values (bill/coin counts) are left unchanged. NaN entries are ignored.
12
+ */
13
+ function getDenominationsFromCents(denominations) {
14
+ return Object.entries(denominations).reduce((acc, [denomination, count]) => {
15
+ const denominationValue = Number(denomination);
16
+ if (Number.isNaN(denominationValue) || Number.isNaN(count)) {
17
+ return acc;
18
+ }
19
+ const dollars = Math.round((denominationValue / 100) * 100) / 100;
20
+ acc[String(dollars)] = count;
21
+ return acc;
22
+ }, {});
23
+ }
24
+ /**
25
+ * Converts the values of a denominations array from cents to dollars
26
+ * (e.g. [1, 5, 10, 25, 100] -> [0.01, 0.05, 0.1, 0.25, 1]).
27
+ * NaN entries are ignored.
28
+ */
29
+ function getDenominationsArrayFromCents(denominations) {
30
+ return denominations
31
+ .map((denomination) => (0, price_conversion_1.convertPriceFromCents)(denomination))
32
+ .filter((denomination) => !Number.isNaN(denomination));
33
+ }
34
+ /**
35
+ * Converts the keys of a denominations map from dollars to integer cents
36
+ * (e.g. "0.01" -> 1, "1" -> 100). Keys are monetary denomination values;
37
+ * the values (bill/coin counts) are left unchanged. NaN entries are ignored.
38
+ */
39
+ function getDenominationsWithCents(denominations) {
40
+ return Object.entries(denominations).reduce((acc, [denomination, count]) => {
41
+ const denominationValue = Number(denomination);
42
+ if (Number.isNaN(denominationValue) || Number.isNaN(count)) {
43
+ return acc;
44
+ }
45
+ const cents = Math.round(denominationValue * 100);
46
+ acc[String(cents)] = count;
47
+ return acc;
48
+ }, {});
49
+ }
50
+ /**
51
+ * Converts the values of a denominations array from dollars to integer cents
52
+ * (e.g. [0.01, 0.05, 0.1, 0.25, 1] -> [1, 5, 10, 25, 100]).
53
+ * NaN entries are ignored.
54
+ */
55
+ function getDenominationsArrayWithCents(denominations) {
56
+ return denominations
57
+ .map((denomination) => (0, price_conversion_1.convertPriceToCents)(denomination))
58
+ .filter((denomination) => !Number.isNaN(denomination));
59
+ }
@@ -7,6 +7,7 @@ export * from './crypt';
7
7
  export * from './customers-helpers';
8
8
  export * from './delivery-area-helpers';
9
9
  export * from './delivery-helpers';
10
+ export * from './denominations-helpers';
10
11
  export * from './dinein';
11
12
  export * from './discount-helpers';
12
13
  export * from './email-helpers';
@@ -56,6 +57,7 @@ export * from './simplified-catalog';
56
57
  export * from './simplified-tenant';
57
58
  export * from './specials-helpers';
58
59
  export * from './tenant-cash-drawer-sessions-helpers';
60
+ export * from './tenant-cash-drawers-helpers';
59
61
  export * from './tenant-cash-in-out-helpers';
60
62
  export * from './tenant-day-sessions-helpers';
61
63
  export * from './tenant-instore-shift-sessions-helpers';
@@ -23,6 +23,7 @@ __exportStar(require("./crypt"), exports);
23
23
  __exportStar(require("./customers-helpers"), exports);
24
24
  __exportStar(require("./delivery-area-helpers"), exports);
25
25
  __exportStar(require("./delivery-helpers"), exports);
26
+ __exportStar(require("./denominations-helpers"), exports);
26
27
  __exportStar(require("./dinein"), exports);
27
28
  __exportStar(require("./discount-helpers"), exports);
28
29
  __exportStar(require("./email-helpers"), exports);
@@ -72,6 +73,7 @@ __exportStar(require("./simplified-catalog"), exports);
72
73
  __exportStar(require("./simplified-tenant"), exports);
73
74
  __exportStar(require("./specials-helpers"), exports);
74
75
  __exportStar(require("./tenant-cash-drawer-sessions-helpers"), exports);
76
+ __exportStar(require("./tenant-cash-drawers-helpers"), exports);
75
77
  __exportStar(require("./tenant-cash-in-out-helpers"), exports);
76
78
  __exportStar(require("./tenant-day-sessions-helpers"), exports);
77
79
  __exportStar(require("./tenant-instore-shift-sessions-helpers"), exports);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTenantCashDrawerSessionFromCents = getTenantCashDrawerSessionFromCents;
4
4
  exports.getTenantCashDrawerSessionWithCents = getTenantCashDrawerSessionWithCents;
5
+ const denominations_helpers_1 = require("./denominations-helpers");
5
6
  const price_conversion_1 = require("./price-conversion");
6
7
  /**
7
8
  * Converts all monetary fields on a cash drawer session from cents to dollars.
@@ -18,6 +19,11 @@ function getTenantCashDrawerSessionFromCents(session) {
18
19
  cash_amount: (0, price_conversion_1.convertPriceFromCents)(session.opening.cash_amount),
19
20
  }
20
21
  : {}),
22
+ ...(session.opening.denominations != null
23
+ ? {
24
+ denominations: (0, denominations_helpers_1.getDenominationsFromCents)(session.opening.denominations),
25
+ }
26
+ : {}),
21
27
  },
22
28
  }
23
29
  : {}),
@@ -40,6 +46,11 @@ function getTenantCashDrawerSessionFromCents(session) {
40
46
  difference: (0, price_conversion_1.convertPriceFromCents)(session.closing.difference),
41
47
  }
42
48
  : {}),
49
+ ...(session.closing.denominations != null
50
+ ? {
51
+ denominations: (0, denominations_helpers_1.getDenominationsFromCents)(session.closing.denominations),
52
+ }
53
+ : {}),
43
54
  },
44
55
  }
45
56
  : {}),
@@ -66,6 +77,11 @@ function getTenantCashDrawerSessionFromCents(session) {
66
77
  cash_amount: (0, price_conversion_1.convertPriceFromCents)(iteration.opening.cash_amount),
67
78
  }
68
79
  : {}),
80
+ ...(iteration.opening.denominations != null
81
+ ? {
82
+ denominations: (0, denominations_helpers_1.getDenominationsFromCents)(iteration.opening.denominations),
83
+ }
84
+ : {}),
69
85
  },
70
86
  }
71
87
  : {}),
@@ -88,6 +104,11 @@ function getTenantCashDrawerSessionFromCents(session) {
88
104
  difference: (0, price_conversion_1.convertPriceFromCents)(iteration.closing.difference),
89
105
  }
90
106
  : {}),
107
+ ...(iteration.closing.denominations != null
108
+ ? {
109
+ denominations: (0, denominations_helpers_1.getDenominationsFromCents)(iteration.closing.denominations),
110
+ }
111
+ : {}),
91
112
  },
92
113
  }
93
114
  : {}),
@@ -121,6 +142,11 @@ function getTenantCashDrawerSessionWithCents(session) {
121
142
  cash_amount: (0, price_conversion_1.convertPriceToCents)(session.opening.cash_amount),
122
143
  }
123
144
  : {}),
145
+ ...(session.opening.denominations != null
146
+ ? {
147
+ denominations: (0, denominations_helpers_1.getDenominationsWithCents)(session.opening.denominations),
148
+ }
149
+ : {}),
124
150
  },
125
151
  }
126
152
  : {}),
@@ -143,6 +169,11 @@ function getTenantCashDrawerSessionWithCents(session) {
143
169
  difference: (0, price_conversion_1.convertPriceToCents)(session.closing.difference),
144
170
  }
145
171
  : {}),
172
+ ...(session.closing.denominations != null
173
+ ? {
174
+ denominations: (0, denominations_helpers_1.getDenominationsWithCents)(session.closing.denominations),
175
+ }
176
+ : {}),
146
177
  },
147
178
  }
148
179
  : {}),
@@ -169,6 +200,11 @@ function getTenantCashDrawerSessionWithCents(session) {
169
200
  cash_amount: (0, price_conversion_1.convertPriceToCents)(iteration.opening.cash_amount),
170
201
  }
171
202
  : {}),
203
+ ...(iteration.opening.denominations != null
204
+ ? {
205
+ denominations: (0, denominations_helpers_1.getDenominationsWithCents)(iteration.opening.denominations),
206
+ }
207
+ : {}),
172
208
  },
173
209
  }
174
210
  : {}),
@@ -191,6 +227,11 @@ function getTenantCashDrawerSessionWithCents(session) {
191
227
  difference: (0, price_conversion_1.convertPriceToCents)(iteration.closing.difference),
192
228
  }
193
229
  : {}),
230
+ ...(iteration.closing.denominations != null
231
+ ? {
232
+ denominations: (0, denominations_helpers_1.getDenominationsWithCents)(iteration.closing.denominations),
233
+ }
234
+ : {}),
194
235
  },
195
236
  }
196
237
  : {}),
@@ -0,0 +1,13 @@
1
+ import { ITenantCashDrawer } from '../../schemas';
2
+ /**
3
+ * Converts all monetary fields on a cash drawer from cents to dollars.
4
+ * `cash_denominations` holds denomination values (e.g. [1, 5, 10, 25, 100]
5
+ * -> [0.01, 0.05, 0.1, 0.25, 1]); NaN entries are ignored.
6
+ */
7
+ export declare function getTenantCashDrawerFromCents<T extends Partial<ITenantCashDrawer> | ITenantCashDrawer>(drawer: T): T;
8
+ /**
9
+ * Converts all monetary fields on a cash drawer from dollars to cents.
10
+ * `cash_denominations` holds denomination values (e.g. [0.01, 0.05, 0.1, 0.25, 1]
11
+ * -> [1, 5, 10, 25, 100]); NaN entries are ignored.
12
+ */
13
+ export declare function getTenantCashDrawerWithCents<T extends Partial<ITenantCashDrawer> | ITenantCashDrawer>(drawer: T): T;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTenantCashDrawerFromCents = getTenantCashDrawerFromCents;
4
+ exports.getTenantCashDrawerWithCents = getTenantCashDrawerWithCents;
5
+ const denominations_helpers_1 = require("./denominations-helpers");
6
+ /**
7
+ * Converts all monetary fields on a cash drawer from cents to dollars.
8
+ * `cash_denominations` holds denomination values (e.g. [1, 5, 10, 25, 100]
9
+ * -> [0.01, 0.05, 0.1, 0.25, 1]); NaN entries are ignored.
10
+ */
11
+ function getTenantCashDrawerFromCents(drawer) {
12
+ return {
13
+ ...drawer,
14
+ ...(Array.isArray(drawer.cash_denominations)
15
+ ? {
16
+ cash_denominations: (0, denominations_helpers_1.getDenominationsArrayFromCents)(drawer.cash_denominations),
17
+ }
18
+ : {}),
19
+ };
20
+ }
21
+ /**
22
+ * Converts all monetary fields on a cash drawer from dollars to cents.
23
+ * `cash_denominations` holds denomination values (e.g. [0.01, 0.05, 0.1, 0.25, 1]
24
+ * -> [1, 5, 10, 25, 100]); NaN entries are ignored.
25
+ */
26
+ function getTenantCashDrawerWithCents(drawer) {
27
+ return {
28
+ ...drawer,
29
+ ...(Array.isArray(drawer.cash_denominations)
30
+ ? {
31
+ cash_denominations: (0, denominations_helpers_1.getDenominationsArrayWithCents)(drawer.cash_denominations),
32
+ }
33
+ : {}),
34
+ };
35
+ }
@@ -34,19 +34,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
34
34
  staff_name: string;
35
35
  note: string;
36
36
  cash_amount: number;
37
+ denominations: Map<string, number>;
37
38
  shift_id: import("mongoose").Types.ObjectId;
38
39
  opened_at: NativeDate;
39
- denominations: Map<string, number>;
40
40
  };
41
41
  closing: {
42
42
  staff_id: string;
43
43
  staff_name: string;
44
44
  note: string;
45
45
  cash_amount: number;
46
+ denominations: Map<string, number>;
46
47
  expected_cash_amount: number;
47
48
  difference: number;
48
49
  shift_id: import("mongoose").Types.ObjectId;
49
- denominations: Map<string, number>;
50
50
  closed_at: NativeDate;
51
51
  };
52
52
  running_balance: number;
@@ -60,19 +60,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
60
60
  staff_name: string;
61
61
  note: string;
62
62
  cash_amount: number;
63
+ denominations: Map<string, number>;
63
64
  shift_id: import("mongoose").Types.ObjectId;
64
65
  opened_at: NativeDate;
65
- denominations: Map<string, number>;
66
66
  };
67
67
  closing: {
68
68
  staff_id: string;
69
69
  staff_name: string;
70
70
  note: string;
71
71
  cash_amount: number;
72
+ denominations: Map<string, number>;
72
73
  expected_cash_amount: number;
73
74
  difference: number;
74
75
  shift_id: import("mongoose").Types.ObjectId;
75
- denominations: Map<string, number>;
76
76
  closed_at: NativeDate;
77
77
  };
78
78
  running_balance: number;
@@ -86,19 +86,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
86
86
  staff_name: string;
87
87
  note: string;
88
88
  cash_amount: number;
89
+ denominations: Map<string, number>;
89
90
  shift_id: import("mongoose").Types.ObjectId;
90
91
  opened_at: NativeDate;
91
- denominations: Map<string, number>;
92
92
  };
93
93
  closing: {
94
94
  staff_id: string;
95
95
  staff_name: string;
96
96
  note: string;
97
97
  cash_amount: number;
98
+ denominations: Map<string, number>;
98
99
  expected_cash_amount: number;
99
100
  difference: number;
100
101
  shift_id: import("mongoose").Types.ObjectId;
101
- denominations: Map<string, number>;
102
102
  closed_at: NativeDate;
103
103
  };
104
104
  running_balance: number;
@@ -112,19 +112,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
112
112
  staff_name: string;
113
113
  note: string;
114
114
  cash_amount: number;
115
+ denominations: Map<string, number>;
115
116
  shift_id: import("mongoose").Types.ObjectId;
116
117
  opened_at: NativeDate;
117
- denominations: Map<string, number>;
118
118
  };
119
119
  closing: {
120
120
  staff_id: string;
121
121
  staff_name: string;
122
122
  note: string;
123
123
  cash_amount: number;
124
+ denominations: Map<string, number>;
124
125
  expected_cash_amount: number;
125
126
  difference: number;
126
127
  shift_id: import("mongoose").Types.ObjectId;
127
- denominations: Map<string, number>;
128
128
  closed_at: NativeDate;
129
129
  };
130
130
  running_balance: number;
@@ -162,19 +162,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
162
162
  staff_name: string;
163
163
  note: string;
164
164
  cash_amount: number;
165
+ denominations: Map<string, number>;
165
166
  shift_id: import("mongoose").Types.ObjectId;
166
167
  opened_at: NativeDate;
167
- denominations: Map<string, number>;
168
168
  };
169
169
  closing: {
170
170
  staff_id: string;
171
171
  staff_name: string;
172
172
  note: string;
173
173
  cash_amount: number;
174
+ denominations: Map<string, number>;
174
175
  expected_cash_amount: number;
175
176
  difference: number;
176
177
  shift_id: import("mongoose").Types.ObjectId;
177
- denominations: Map<string, number>;
178
178
  closed_at: NativeDate;
179
179
  };
180
180
  running_balance: number;
@@ -188,19 +188,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
188
188
  staff_name: string;
189
189
  note: string;
190
190
  cash_amount: number;
191
+ denominations: Map<string, number>;
191
192
  shift_id: import("mongoose").Types.ObjectId;
192
193
  opened_at: NativeDate;
193
- denominations: Map<string, number>;
194
194
  };
195
195
  closing: {
196
196
  staff_id: string;
197
197
  staff_name: string;
198
198
  note: string;
199
199
  cash_amount: number;
200
+ denominations: Map<string, number>;
200
201
  expected_cash_amount: number;
201
202
  difference: number;
202
203
  shift_id: import("mongoose").Types.ObjectId;
203
- denominations: Map<string, number>;
204
204
  closed_at: NativeDate;
205
205
  };
206
206
  running_balance: number;
@@ -214,19 +214,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
214
214
  staff_name: string;
215
215
  note: string;
216
216
  cash_amount: number;
217
+ denominations: Map<string, number>;
217
218
  shift_id: import("mongoose").Types.ObjectId;
218
219
  opened_at: NativeDate;
219
- denominations: Map<string, number>;
220
220
  };
221
221
  closing: {
222
222
  staff_id: string;
223
223
  staff_name: string;
224
224
  note: string;
225
225
  cash_amount: number;
226
+ denominations: Map<string, number>;
226
227
  expected_cash_amount: number;
227
228
  difference: number;
228
229
  shift_id: import("mongoose").Types.ObjectId;
229
- denominations: Map<string, number>;
230
230
  closed_at: NativeDate;
231
231
  };
232
232
  running_balance: number;
@@ -240,19 +240,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
240
240
  staff_name: string;
241
241
  note: string;
242
242
  cash_amount: number;
243
+ denominations: Map<string, number>;
243
244
  shift_id: import("mongoose").Types.ObjectId;
244
245
  opened_at: NativeDate;
245
- denominations: Map<string, number>;
246
246
  };
247
247
  closing: {
248
248
  staff_id: string;
249
249
  staff_name: string;
250
250
  note: string;
251
251
  cash_amount: number;
252
+ denominations: Map<string, number>;
252
253
  expected_cash_amount: number;
253
254
  difference: number;
254
255
  shift_id: import("mongoose").Types.ObjectId;
255
- denominations: Map<string, number>;
256
256
  closed_at: NativeDate;
257
257
  };
258
258
  running_balance: number;
@@ -290,19 +290,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
290
290
  staff_name: string;
291
291
  note: string;
292
292
  cash_amount: number;
293
+ denominations: Map<string, number>;
293
294
  shift_id: import("mongoose").Types.ObjectId;
294
295
  opened_at: NativeDate;
295
- denominations: Map<string, number>;
296
296
  };
297
297
  closing: {
298
298
  staff_id: string;
299
299
  staff_name: string;
300
300
  note: string;
301
301
  cash_amount: number;
302
+ denominations: Map<string, number>;
302
303
  expected_cash_amount: number;
303
304
  difference: number;
304
305
  shift_id: import("mongoose").Types.ObjectId;
305
- denominations: Map<string, number>;
306
306
  closed_at: NativeDate;
307
307
  };
308
308
  running_balance: number;
@@ -316,19 +316,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
316
316
  staff_name: string;
317
317
  note: string;
318
318
  cash_amount: number;
319
+ denominations: Map<string, number>;
319
320
  shift_id: import("mongoose").Types.ObjectId;
320
321
  opened_at: NativeDate;
321
- denominations: Map<string, number>;
322
322
  };
323
323
  closing: {
324
324
  staff_id: string;
325
325
  staff_name: string;
326
326
  note: string;
327
327
  cash_amount: number;
328
+ denominations: Map<string, number>;
328
329
  expected_cash_amount: number;
329
330
  difference: number;
330
331
  shift_id: import("mongoose").Types.ObjectId;
331
- denominations: Map<string, number>;
332
332
  closed_at: NativeDate;
333
333
  };
334
334
  running_balance: number;
@@ -342,19 +342,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
342
342
  staff_name: string;
343
343
  note: string;
344
344
  cash_amount: number;
345
+ denominations: Map<string, number>;
345
346
  shift_id: import("mongoose").Types.ObjectId;
346
347
  opened_at: NativeDate;
347
- denominations: Map<string, number>;
348
348
  };
349
349
  closing: {
350
350
  staff_id: string;
351
351
  staff_name: string;
352
352
  note: string;
353
353
  cash_amount: number;
354
+ denominations: Map<string, number>;
354
355
  expected_cash_amount: number;
355
356
  difference: number;
356
357
  shift_id: import("mongoose").Types.ObjectId;
357
- denominations: Map<string, number>;
358
358
  closed_at: NativeDate;
359
359
  };
360
360
  running_balance: number;
@@ -368,19 +368,19 @@ export declare const TenantCashDrawerSessionsSchema: Schema<any, import("mongoos
368
368
  staff_name: string;
369
369
  note: string;
370
370
  cash_amount: number;
371
+ denominations: Map<string, number>;
371
372
  shift_id: import("mongoose").Types.ObjectId;
372
373
  opened_at: NativeDate;
373
- denominations: Map<string, number>;
374
374
  };
375
375
  closing: {
376
376
  staff_id: string;
377
377
  staff_name: string;
378
378
  note: string;
379
379
  cash_amount: number;
380
+ denominations: Map<string, number>;
380
381
  expected_cash_amount: number;
381
382
  difference: number;
382
383
  shift_id: import("mongoose").Types.ObjectId;
383
- denominations: Map<string, number>;
384
384
  closed_at: NativeDate;
385
385
  };
386
386
  running_balance: number;
@@ -15,6 +15,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
15
15
  createdAt: NativeDate;
16
16
  updatedAt: NativeDate;
17
17
  note: string;
18
+ ref_id: import("mongoose").Types.ObjectId;
18
19
  amount: number;
19
20
  localYear: number;
20
21
  localMonth: number;
@@ -30,6 +31,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
30
31
  localDate: string;
31
32
  localTime: string;
32
33
  localDayOfYear: number;
34
+ ref_type: import("../../constants").CASH_IN_OUT_REF_ENUM;
33
35
  day_id: import("mongoose").Types.ObjectId;
34
36
  drawer_id: import("mongoose").Types.ObjectId;
35
37
  shift_id: import("mongoose").Types.ObjectId;
@@ -48,6 +50,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
48
50
  createdAt: NativeDate;
49
51
  updatedAt: NativeDate;
50
52
  note: string;
53
+ ref_id: import("mongoose").Types.ObjectId;
51
54
  amount: number;
52
55
  localYear: number;
53
56
  localMonth: number;
@@ -63,6 +66,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
63
66
  localDate: string;
64
67
  localTime: string;
65
68
  localDayOfYear: number;
69
+ ref_type: import("../../constants").CASH_IN_OUT_REF_ENUM;
66
70
  day_id: import("mongoose").Types.ObjectId;
67
71
  drawer_id: import("mongoose").Types.ObjectId;
68
72
  shift_id: import("mongoose").Types.ObjectId;
@@ -81,6 +85,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
81
85
  createdAt: NativeDate;
82
86
  updatedAt: NativeDate;
83
87
  note: string;
88
+ ref_id: import("mongoose").Types.ObjectId;
84
89
  amount: number;
85
90
  localYear: number;
86
91
  localMonth: number;
@@ -96,6 +101,7 @@ export declare const TenantCashInOutSchema: Schema<any, import("mongoose").Model
96
101
  localDate: string;
97
102
  localTime: string;
98
103
  localDayOfYear: number;
104
+ ref_type: import("../../constants").CASH_IN_OUT_REF_ENUM;
99
105
  day_id: import("mongoose").Types.ObjectId;
100
106
  drawer_id: import("mongoose").Types.ObjectId;
101
107
  shift_id: import("mongoose").Types.ObjectId;
@@ -28,6 +28,15 @@ exports.TenantCashInOutSchema = new mongoose_1.Schema({
28
28
  type: mongoose_1.Schema.Types.ObjectId,
29
29
  required: true,
30
30
  },
31
+ ref_id: {
32
+ type: mongoose_1.Schema.Types.ObjectId,
33
+ default: null,
34
+ },
35
+ ref_type: {
36
+ type: String,
37
+ enum: constants_1.ALL_CASH_IN_OUT_REFS,
38
+ required: true,
39
+ },
31
40
  shift_number: {
32
41
  type: Number,
33
42
  required: true,
@@ -1,4 +1,4 @@
1
- import { CASH_IN_OUT_TYPE_ENUM } from '../../constants';
1
+ import { CASH_IN_OUT_REF_ENUM, CASH_IN_OUT_TYPE_ENUM } from '../../constants';
2
2
  import { ILocalTimeFields } from '../../helpers';
3
3
  export interface ITenantCashInOut extends ILocalTimeFields {
4
4
  _id: string;
@@ -6,6 +6,8 @@ export interface ITenantCashInOut extends ILocalTimeFields {
6
6
  day_id: string;
7
7
  shift_id: string;
8
8
  drawer_id: string;
9
+ ref_id: string | null;
10
+ ref_type: CASH_IN_OUT_REF_ENUM;
9
11
  shift_number: number;
10
12
  type: CASH_IN_OUT_TYPE_ENUM;
11
13
  amount: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.577",
3
+ "version": "0.2.578",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",