@managesome/eposmatic-toolkit 0.2.501 → 0.2.503

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.
@@ -10,3 +10,9 @@ export declare function getWarehouseInternalMovementItemsWithPrice(items: IWareh
10
10
  * - `writeable = false` → cents → decimal (after receiving from backend)
11
11
  */
12
12
  export declare function getWarehouseInternalMovementWithPrice<T extends Partial<IWarehouseInternalMovement> | IWarehouseInternalMovement>(order: T, writeable?: boolean): T;
13
+ /**
14
+ * Recalculate financial totals for an internal movement — mirrors
15
+ * `calculateCartWarehousePurchaseOrderInfoAndSyncData` but for the flat
16
+ * `items` array instead of nested `categories`.
17
+ */
18
+ export declare function calculateCartInternalMovementInfoAndSyncData<T extends Partial<IWarehouseInternalMovement> | IWarehouseInternalMovement>(data: T): T;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWarehouseInternalMovementItemsWithPrice = getWarehouseInternalMovementItemsWithPrice;
4
4
  exports.getWarehouseInternalMovementWithPrice = getWarehouseInternalMovementWithPrice;
5
+ exports.calculateCartInternalMovementInfoAndSyncData = calculateCartInternalMovementInfoAndSyncData;
5
6
  const utils_1 = require("../utils");
6
7
  const common_order_actions_1 = require("./common-order-actions");
7
8
  /**
@@ -56,3 +57,31 @@ function getWarehouseInternalMovementWithPrice(order, writeable) {
56
57
  : {}),
57
58
  };
58
59
  }
60
+ /**
61
+ * Recalculate financial totals for an internal movement — mirrors
62
+ * `calculateCartWarehousePurchaseOrderInfoAndSyncData` but for the flat
63
+ * `items` array instead of nested `categories`.
64
+ */
65
+ function calculateCartInternalMovementInfoAndSyncData(data) {
66
+ const subtotal = (data.items ?? []).reduce((sum, item) => sum + (0, utils_1.parseNum)((item.unit_price ?? 0) * (item.quantity ?? 0)), 0);
67
+ let grand_total = subtotal;
68
+ let gst_amount = 0;
69
+ const gst = data.gst ?? 0;
70
+ if (gst > 0 && data.is_gst_inclusive) {
71
+ gst_amount = (0, utils_1.parseFloatCeil)((grand_total * gst) / (100 + gst));
72
+ }
73
+ else if (gst > 0) {
74
+ gst_amount = (0, utils_1.getPercentageAmount)(grand_total, gst);
75
+ grand_total += gst_amount;
76
+ }
77
+ const { cardCharges, amountCollected } = (0, utils_1.getCardChargesAndAmountCollected)(data.payments);
78
+ grand_total += cardCharges;
79
+ grand_total = (0, utils_1.parseNum)(grand_total);
80
+ return {
81
+ ...data,
82
+ grand_total,
83
+ gst_amount,
84
+ amount_collected: (0, utils_1.parseNum)(amountCollected),
85
+ amount_earned: (0, utils_1.parseNum)(grand_total - cardCharges),
86
+ };
87
+ }
@@ -26,5 +26,15 @@ function getWarehouseSettingsWithPrice(settings, writeable) {
26
26
  cash_gst: convertToPrice(settings.invoice_cash_gst),
27
27
  }
28
28
  : {}),
29
+ ...(settings.im_card_gst != null
30
+ ? {
31
+ im_card_gst: convertToPrice(settings.im_card_gst),
32
+ }
33
+ : {}),
34
+ ...(settings.im_cash_gst != null
35
+ ? {
36
+ im_cash_gst: convertToPrice(settings.im_cash_gst),
37
+ }
38
+ : {}),
29
39
  };
30
40
  }
@@ -101,6 +101,12 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
101
101
  card_gst: number;
102
102
  cash_gst: number;
103
103
  default_gst_type: GST_TYPE_ENUM;
104
+ im_card_gst: number;
105
+ im_cash_gst: number;
106
+ default_im_gst_type: GST_TYPE_ENUM;
107
+ po_card_gst: number;
108
+ po_cash_gst: number;
109
+ default_po_gst_type: GST_TYPE_ENUM;
104
110
  web_cover_image: string;
105
111
  web_favicon: string;
106
112
  web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
@@ -118,6 +124,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
118
124
  auto_accept_order_for_platforms: PLATFORMS_ENUM[];
119
125
  custom_payment_types: string[];
120
126
  expense_payment_types: string[];
127
+ im_custom_payment_types: string[];
128
+ po_custom_payment_types: string[];
121
129
  reservation_enabled: boolean;
122
130
  integrations: string[];
123
131
  exempt_gst_for_platforms: PLATFORMS_ENUM[];
@@ -273,6 +281,12 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
273
281
  card_gst: number;
274
282
  cash_gst: number;
275
283
  default_gst_type: GST_TYPE_ENUM;
284
+ im_card_gst: number;
285
+ im_cash_gst: number;
286
+ default_im_gst_type: GST_TYPE_ENUM;
287
+ po_card_gst: number;
288
+ po_cash_gst: number;
289
+ default_po_gst_type: GST_TYPE_ENUM;
276
290
  web_cover_image: string;
277
291
  web_favicon: string;
278
292
  web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
@@ -290,6 +304,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
290
304
  auto_accept_order_for_platforms: PLATFORMS_ENUM[];
291
305
  custom_payment_types: string[];
292
306
  expense_payment_types: string[];
307
+ im_custom_payment_types: string[];
308
+ po_custom_payment_types: string[];
293
309
  reservation_enabled: boolean;
294
310
  integrations: string[];
295
311
  exempt_gst_for_platforms: PLATFORMS_ENUM[];
@@ -445,6 +461,12 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
445
461
  card_gst: number;
446
462
  cash_gst: number;
447
463
  default_gst_type: GST_TYPE_ENUM;
464
+ im_card_gst: number;
465
+ im_cash_gst: number;
466
+ default_im_gst_type: GST_TYPE_ENUM;
467
+ po_card_gst: number;
468
+ po_cash_gst: number;
469
+ default_po_gst_type: GST_TYPE_ENUM;
448
470
  web_cover_image: string;
449
471
  web_favicon: string;
450
472
  web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
@@ -462,6 +484,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
462
484
  auto_accept_order_for_platforms: PLATFORMS_ENUM[];
463
485
  custom_payment_types: string[];
464
486
  expense_payment_types: string[];
487
+ im_custom_payment_types: string[];
488
+ po_custom_payment_types: string[];
465
489
  reservation_enabled: boolean;
466
490
  integrations: string[];
467
491
  exempt_gst_for_platforms: PLATFORMS_ENUM[];
@@ -446,6 +446,32 @@ exports.TenantSchema = new mongoose_1.Schema({
446
446
  enum: constants_1.ALL_GST_TYPES,
447
447
  default: constants_1.GST_TYPE_ENUM.CARD,
448
448
  },
449
+ im_card_gst: {
450
+ type: Number,
451
+ default: 10,
452
+ },
453
+ im_cash_gst: {
454
+ type: Number,
455
+ default: 5,
456
+ },
457
+ default_im_gst_type: {
458
+ type: String,
459
+ enum: constants_1.ALL_GST_TYPES,
460
+ default: constants_1.GST_TYPE_ENUM.CARD,
461
+ },
462
+ po_card_gst: {
463
+ type: Number,
464
+ default: 10,
465
+ },
466
+ po_cash_gst: {
467
+ type: Number,
468
+ default: 5,
469
+ },
470
+ default_po_gst_type: {
471
+ type: String,
472
+ enum: constants_1.ALL_GST_TYPES,
473
+ default: constants_1.GST_TYPE_ENUM.CARD,
474
+ },
449
475
  web_design_type: {
450
476
  type: String,
451
477
  enum: constants_1.ALL_ONLINE_ORDERING_DESIGN_TYPES,
@@ -565,6 +591,14 @@ exports.TenantSchema = new mongoose_1.Schema({
565
591
  type: [String],
566
592
  default: [],
567
593
  },
594
+ im_custom_payment_types: {
595
+ type: [String],
596
+ default: [],
597
+ },
598
+ po_custom_payment_types: {
599
+ type: [String],
600
+ default: [],
601
+ },
568
602
  takeaway_is_pickup: {
569
603
  type: Boolean,
570
604
  required: false,
@@ -1,5 +1,5 @@
1
1
  import { Schema } from 'mongoose';
2
- import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
2
+ import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, TRACK_ORDER_NUMBER_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM } from '../../constants';
3
3
  export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
4
4
  timestamps: true;
5
5
  versionKey: false;
@@ -29,24 +29,28 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
29
29
  coordinates: number[];
30
30
  brand_color: string;
31
31
  public_business_name: string;
32
+ im_card_gst: number;
33
+ im_cash_gst: number;
34
+ default_im_gst_type: GST_TYPE_ENUM;
35
+ po_card_gst: number;
36
+ po_cash_gst: number;
37
+ default_po_gst_type: GST_TYPE_ENUM;
32
38
  operational_time_zone_offset_gmt: number;
33
39
  operational_start_time: number;
34
40
  operational_end_time: number;
35
41
  alert_phone_numbers: string[];
36
42
  alert_email_addresses: string[];
37
43
  alert_when: string[];
44
+ im_custom_payment_types: string[];
45
+ po_custom_payment_types: string[];
38
46
  warehouse_address: string;
39
- po_card_gst: number;
40
- po_cash_gst: number;
41
47
  invoice_card_gst: number;
42
48
  invoice_cash_gst: number;
43
- default_po_gst_type: GST_TYPE_ENUM;
44
49
  default_invoice_gst_type: GST_TYPE_ENUM;
45
50
  track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
46
51
  track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
47
52
  enable_lot_serial_tracking: boolean;
48
53
  default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
49
- po_custom_payment_types: string[];
50
54
  invoice_custom_payment_types: string[];
51
55
  tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
52
56
  is_gst_inclusive?: boolean | null | undefined;
@@ -79,24 +83,28 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
79
83
  coordinates: number[];
80
84
  brand_color: string;
81
85
  public_business_name: string;
86
+ im_card_gst: number;
87
+ im_cash_gst: number;
88
+ default_im_gst_type: GST_TYPE_ENUM;
89
+ po_card_gst: number;
90
+ po_cash_gst: number;
91
+ default_po_gst_type: GST_TYPE_ENUM;
82
92
  operational_time_zone_offset_gmt: number;
83
93
  operational_start_time: number;
84
94
  operational_end_time: number;
85
95
  alert_phone_numbers: string[];
86
96
  alert_email_addresses: string[];
87
97
  alert_when: string[];
98
+ im_custom_payment_types: string[];
99
+ po_custom_payment_types: string[];
88
100
  warehouse_address: string;
89
- po_card_gst: number;
90
- po_cash_gst: number;
91
101
  invoice_card_gst: number;
92
102
  invoice_cash_gst: number;
93
- default_po_gst_type: GST_TYPE_ENUM;
94
103
  default_invoice_gst_type: GST_TYPE_ENUM;
95
104
  track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
96
105
  track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
97
106
  enable_lot_serial_tracking: boolean;
98
107
  default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
99
- po_custom_payment_types: string[];
100
108
  invoice_custom_payment_types: string[];
101
109
  tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
102
110
  is_gst_inclusive?: boolean | null | undefined;
@@ -129,24 +137,28 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
129
137
  coordinates: number[];
130
138
  brand_color: string;
131
139
  public_business_name: string;
140
+ im_card_gst: number;
141
+ im_cash_gst: number;
142
+ default_im_gst_type: GST_TYPE_ENUM;
143
+ po_card_gst: number;
144
+ po_cash_gst: number;
145
+ default_po_gst_type: GST_TYPE_ENUM;
132
146
  operational_time_zone_offset_gmt: number;
133
147
  operational_start_time: number;
134
148
  operational_end_time: number;
135
149
  alert_phone_numbers: string[];
136
150
  alert_email_addresses: string[];
137
151
  alert_when: string[];
152
+ im_custom_payment_types: string[];
153
+ po_custom_payment_types: string[];
138
154
  warehouse_address: string;
139
- po_card_gst: number;
140
- po_cash_gst: number;
141
155
  invoice_card_gst: number;
142
156
  invoice_cash_gst: number;
143
- default_po_gst_type: GST_TYPE_ENUM;
144
157
  default_invoice_gst_type: GST_TYPE_ENUM;
145
158
  track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
146
159
  track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
147
160
  enable_lot_serial_tracking: boolean;
148
161
  default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
149
- po_custom_payment_types: string[];
150
162
  invoice_custom_payment_types: string[];
151
163
  tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
152
164
  is_gst_inclusive?: boolean | null | undefined;
@@ -121,6 +121,19 @@ exports.WarehouseSchema = new mongoose_1.Schema({
121
121
  enum: constants_1.ALL_GST_TYPES,
122
122
  default: constants_1.GST_TYPE_ENUM.CARD,
123
123
  },
124
+ im_card_gst: {
125
+ type: Number,
126
+ default: 0,
127
+ },
128
+ im_cash_gst: {
129
+ type: Number,
130
+ default: 0,
131
+ },
132
+ default_im_gst_type: {
133
+ type: String,
134
+ enum: constants_1.ALL_GST_TYPES,
135
+ default: constants_1.GST_TYPE_ENUM.CARD,
136
+ },
124
137
  tax_business_number: {
125
138
  type: String,
126
139
  default: '',
@@ -203,6 +216,10 @@ exports.WarehouseSchema = new mongoose_1.Schema({
203
216
  type: [String],
204
217
  default: [],
205
218
  },
219
+ im_custom_payment_types: {
220
+ type: [String],
221
+ default: [],
222
+ },
206
223
  createdAt: {
207
224
  type: mongoose_1.Schema.Types.Date,
208
225
  required: true,
@@ -104,6 +104,12 @@ export interface ITenant {
104
104
  card_gst: number;
105
105
  cash_gst: number;
106
106
  default_gst_type: GST_TYPE_ENUM;
107
+ im_card_gst: number;
108
+ im_cash_gst: number;
109
+ default_im_gst_type: GST_TYPE_ENUM;
110
+ po_card_gst: number;
111
+ po_cash_gst: number;
112
+ default_po_gst_type: GST_TYPE_ENUM;
107
113
  web_cover_image: string;
108
114
  web_favicon: string;
109
115
  web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
@@ -128,6 +134,8 @@ export interface ITenant {
128
134
  auto_accept_order_for_platforms: PLATFORMS_ENUM[];
129
135
  custom_payment_types: string[];
130
136
  expense_payment_types: string[];
137
+ im_custom_payment_types: string[];
138
+ po_custom_payment_types: string[];
131
139
  takeaway_is_pickup?: boolean;
132
140
  reservation_enabled: boolean;
133
141
  ms_clarity_id?: string | null;
@@ -1,4 +1,4 @@
1
- import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, TAX_INVOICE_PROVIDER_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
1
+ import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, TAX_INVOICE_PROVIDER_ENUM, TRACK_ORDER_NUMBER_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM } from '../../constants';
2
2
  export interface IWarehouse {
3
3
  _id: string;
4
4
  brand_id: string;
@@ -25,6 +25,9 @@ export interface IWarehouse {
25
25
  invoice_cash_gst: number;
26
26
  default_po_gst_type: GST_TYPE_ENUM;
27
27
  default_invoice_gst_type: GST_TYPE_ENUM;
28
+ im_card_gst: number;
29
+ im_cash_gst: number;
30
+ default_im_gst_type: GST_TYPE_ENUM;
28
31
  tax_business_number: string;
29
32
  tax_invoice_provider?: TAX_INVOICE_PROVIDER_ENUM;
30
33
  tax_invoice_generation_id?: string | null;
@@ -43,6 +46,7 @@ export interface IWarehouse {
43
46
  default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
44
47
  po_custom_payment_types: string[];
45
48
  invoice_custom_payment_types: string[];
49
+ im_custom_payment_types: string[];
46
50
  active: boolean;
47
51
  createdAt: Date;
48
52
  updatedAt: Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.501",
3
+ "version": "0.2.503",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",