@managesome/eposmatic-toolkit 0.2.474 → 0.2.476

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.
@@ -21,7 +21,7 @@ export interface IRfqRespondPageResult {
21
21
  message: string;
22
22
  completedAt?: string;
23
23
  }
24
- export declare function getRfqRespondPageResult(code: RFQ_PUBLIC_RESPOND_CODE_ENUM, action: RFQ_PUBLIC_RESPOND_ACTION_ENUM, rfqType: RfqType): IRfqRespondPageResult;
24
+ export declare function getRfqRespondPageResult(response: IPublicRfqRespondResponse, action: RFQ_PUBLIC_RESPOND_ACTION_ENUM, rfqType: RfqType): IRfqRespondPageResult;
25
25
  export interface IPublicRfqRespondRequest {
26
26
  rfq_id: string;
27
27
  vendor_id: string;
@@ -21,44 +21,45 @@ var RFQ_PUBLIC_RESPOND_CODE_ENUM;
21
21
  RFQ_PUBLIC_RESPOND_CODE_ENUM["INVALID_REQUEST"] = "INVALID_REQUEST";
22
22
  })(RFQ_PUBLIC_RESPOND_CODE_ENUM || (exports.RFQ_PUBLIC_RESPOND_CODE_ENUM = RFQ_PUBLIC_RESPOND_CODE_ENUM = {}));
23
23
  exports.ALL_RFQ_PUBLIC_RESPOND_CODES = Object.values(RFQ_PUBLIC_RESPOND_CODE_ENUM);
24
- function getRfqRespondPageResult(code, action, rfqType) {
24
+ function getRfqRespondPageResult(response, action, rfqType) {
25
+ const { code, message: responseMessage } = response;
25
26
  const label = rfqType === 'sale' ? 'Quotation' : 'RFQ';
26
27
  switch (code) {
27
28
  case RFQ_PUBLIC_RESPOND_CODE_ENUM.PROCESSED:
28
29
  return {
29
30
  status: 'PENDING',
30
31
  title: action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM ? `${label} Accepted` : `${label} Declined`,
31
- message: getRfqPublicRespondMessage(code, action),
32
+ message: responseMessage || getRfqPublicRespondMessage(code, action),
32
33
  };
33
34
  case RFQ_PUBLIC_RESPOND_CODE_ENUM.ALREADY_PROCESSED:
34
35
  return {
35
36
  status: 'COMPLETED',
36
37
  title: action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM ? 'Already Accepted' : 'Already Declined',
37
- message: getRfqPublicRespondMessage(code, action),
38
+ message: responseMessage || getRfqPublicRespondMessage(code, action),
38
39
  };
39
40
  case RFQ_PUBLIC_RESPOND_CODE_ENUM.EXPIRED:
40
41
  return {
41
42
  status: 'EXPIRED',
42
43
  title: `${label} Expired`,
43
- message: getRfqPublicRespondMessage(code, action),
44
+ message: responseMessage || getRfqPublicRespondMessage(code, action),
44
45
  };
45
46
  case RFQ_PUBLIC_RESPOND_CODE_ENUM.NOT_FOUND:
46
47
  return {
47
48
  status: 'INVALID',
48
49
  title: `${label} Not Found`,
49
- message: getRfqPublicRespondMessage(code, action),
50
+ message: responseMessage || getRfqPublicRespondMessage(code, action),
50
51
  };
51
52
  case RFQ_PUBLIC_RESPOND_CODE_ENUM.INVALID_TRANSITION:
52
53
  return {
53
54
  status: 'INVALID',
54
55
  title: 'Action Not Allowed',
55
- message: getRfqPublicRespondMessage(code, action),
56
+ message: responseMessage || getRfqPublicRespondMessage(code, action),
56
57
  };
57
58
  default:
58
59
  return {
59
60
  status: 'INVALID',
60
61
  title: 'Unexpected Error',
61
- message: 'An unexpected response was received. Please try again or contact support.',
62
+ message: responseMessage || 'An unexpected response was received. Please try again or contact support.',
62
63
  };
63
64
  }
64
65
  }
@@ -178,6 +178,9 @@ function generateOrderOnCreate(order, withIterations) {
178
178
  if (!newOrder.order_taker_details) {
179
179
  delete newOrder.order_taker_details;
180
180
  }
181
+ if (!newOrder.source_tenant_id) {
182
+ delete newOrder.source_tenant_id;
183
+ }
181
184
  if (!newOrder.redeemed_offers || Object.keys(newOrder.redeemed_offers).length === 0) {
182
185
  delete newOrder.redeemed_offers;
183
186
  }
@@ -360,6 +363,10 @@ function generateOrderOnUpdate(partialUpdatedOrder) {
360
363
  delete set.order_taker_details;
361
364
  unset['order_taker_details'] = '';
362
365
  }
366
+ if (set.source_tenant_id === null) {
367
+ delete set.source_tenant_id;
368
+ unset['source_tenant_id'] = '';
369
+ }
363
370
  if (set.redeemed_offers === null) {
364
371
  delete set.redeemed_offers;
365
372
  unset['redeemed_offers'] = '';
@@ -8,6 +8,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
8
8
  createdAt: NativeDate;
9
9
  updatedAt: NativeDate;
10
10
  } & {
11
+ code: string;
11
12
  _id: import("mongoose").Types.ObjectId;
12
13
  name: string;
13
14
  tenants: string[];
@@ -17,7 +18,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
17
18
  brand_id: string;
18
19
  active: boolean;
19
20
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
20
- code: string;
21
21
  used_count: number;
22
22
  assigned_count: number;
23
23
  reward_items?: {
@@ -142,6 +142,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
142
142
  createdAt: NativeDate;
143
143
  updatedAt: NativeDate;
144
144
  } & {
145
+ code: string;
145
146
  _id: import("mongoose").Types.ObjectId;
146
147
  name: string;
147
148
  tenants: string[];
@@ -151,7 +152,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
151
152
  brand_id: string;
152
153
  active: boolean;
153
154
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
154
- code: string;
155
155
  used_count: number;
156
156
  assigned_count: number;
157
157
  reward_items?: {
@@ -276,6 +276,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
276
276
  createdAt: NativeDate;
277
277
  updatedAt: NativeDate;
278
278
  } & {
279
+ code: string;
279
280
  _id: import("mongoose").Types.ObjectId;
280
281
  name: string;
281
282
  tenants: string[];
@@ -285,7 +286,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
285
286
  brand_id: string;
286
287
  active: boolean;
287
288
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
288
- code: string;
289
289
  used_count: number;
290
290
  assigned_count: number;
291
291
  reward_items?: {
@@ -8,6 +8,7 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
8
8
  createdAt: NativeDate;
9
9
  updatedAt: NativeDate;
10
10
  } & {
11
+ code: string;
11
12
  _id: import("mongoose").Types.ObjectId;
12
13
  type: INVENTORY_ITEM_TYPE_ENUM;
13
14
  name: string;
@@ -16,7 +17,6 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
16
17
  updatedAt: NativeDate;
17
18
  image_url: string;
18
19
  active: boolean;
19
- code: string;
20
20
  unit: import("../../constants").INVENTORY_ITEM_UNIT_ENUM;
21
21
  threshold_quantity: number;
22
22
  quantity_left: number;
@@ -37,6 +37,7 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
37
37
  createdAt: NativeDate;
38
38
  updatedAt: NativeDate;
39
39
  } & {
40
+ code: string;
40
41
  _id: import("mongoose").Types.ObjectId;
41
42
  type: INVENTORY_ITEM_TYPE_ENUM;
42
43
  name: string;
@@ -45,7 +46,6 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
45
46
  updatedAt: NativeDate;
46
47
  image_url: string;
47
48
  active: boolean;
48
- code: string;
49
49
  unit: import("../../constants").INVENTORY_ITEM_UNIT_ENUM;
50
50
  threshold_quantity: number;
51
51
  quantity_left: number;
@@ -66,6 +66,7 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
66
66
  createdAt: NativeDate;
67
67
  updatedAt: NativeDate;
68
68
  } & {
69
+ code: string;
69
70
  _id: import("mongoose").Types.ObjectId;
70
71
  type: INVENTORY_ITEM_TYPE_ENUM;
71
72
  name: string;
@@ -74,7 +75,6 @@ export declare const InventorySchema: Schema<any, import("mongoose").Model<any,
74
75
  updatedAt: NativeDate;
75
76
  image_url: string;
76
77
  active: boolean;
77
- code: string;
78
78
  unit: import("../../constants").INVENTORY_ITEM_UNIT_ENUM;
79
79
  threshold_quantity: number;
80
80
  quantity_left: number;
@@ -7,6 +7,7 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
7
7
  createdAt: NativeDate;
8
8
  updatedAt: NativeDate;
9
9
  } & {
10
+ message: string;
10
11
  _id: import("mongoose").Types.ObjectId;
11
12
  type: import("../../constants").MARKETING_TYPE_ENUM;
12
13
  tenant_id: string;
@@ -15,7 +16,6 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
15
16
  createdAt: NativeDate;
16
17
  updatedAt: NativeDate;
17
18
  description: string;
18
- message: string;
19
19
  customer_phone: string;
20
20
  intent: string;
21
21
  cost: number;
@@ -24,6 +24,7 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
24
24
  createdAt: NativeDate;
25
25
  updatedAt: NativeDate;
26
26
  } & {
27
+ message: string;
27
28
  _id: import("mongoose").Types.ObjectId;
28
29
  type: import("../../constants").MARKETING_TYPE_ENUM;
29
30
  tenant_id: string;
@@ -32,7 +33,6 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
32
33
  createdAt: NativeDate;
33
34
  updatedAt: NativeDate;
34
35
  description: string;
35
- message: string;
36
36
  customer_phone: string;
37
37
  intent: string;
38
38
  cost: number;
@@ -41,6 +41,7 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
41
41
  createdAt: NativeDate;
42
42
  updatedAt: NativeDate;
43
43
  } & {
44
+ message: string;
44
45
  _id: import("mongoose").Types.ObjectId;
45
46
  type: import("../../constants").MARKETING_TYPE_ENUM;
46
47
  tenant_id: string;
@@ -49,7 +50,6 @@ export declare const MarketingFingerprintSchema: Schema<any, import("mongoose").
49
50
  createdAt: NativeDate;
50
51
  updatedAt: NativeDate;
51
52
  description: string;
52
- message: string;
53
53
  customer_phone: string;
54
54
  intent: string;
55
55
  cost: number;
@@ -599,7 +599,6 @@ exports.OrderSchema = new mongoose_1.Schema({
599
599
  source_tenant_id: {
600
600
  type: String,
601
601
  required: false,
602
- default: null,
603
602
  },
604
603
  consumer: {
605
604
  type: ConsumerSchema,
@@ -7,6 +7,7 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
7
7
  createdAt: NativeDate;
8
8
  updatedAt: NativeDate;
9
9
  } & {
10
+ code: string;
10
11
  _id: import("mongoose").Types.ObjectId;
11
12
  name: string;
12
13
  tenants: string[];
@@ -15,7 +16,6 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
15
16
  description: string;
16
17
  brand_id: string;
17
18
  active: boolean;
18
- code: string;
19
19
  is_public: boolean;
20
20
  used_count: number;
21
21
  assigned_count: number;
@@ -30,6 +30,7 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
30
30
  createdAt: NativeDate;
31
31
  updatedAt: NativeDate;
32
32
  } & {
33
+ code: string;
33
34
  _id: import("mongoose").Types.ObjectId;
34
35
  name: string;
35
36
  tenants: string[];
@@ -38,7 +39,6 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
38
39
  description: string;
39
40
  brand_id: string;
40
41
  active: boolean;
41
- code: string;
42
42
  is_public: boolean;
43
43
  used_count: number;
44
44
  assigned_count: number;
@@ -53,6 +53,7 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
53
53
  createdAt: NativeDate;
54
54
  updatedAt: NativeDate;
55
55
  } & {
56
+ code: string;
56
57
  _id: import("mongoose").Types.ObjectId;
57
58
  name: string;
58
59
  tenants: string[];
@@ -61,7 +62,6 @@ export declare const VouchersSchema: Schema<any, import("mongoose").Model<any, a
61
62
  description: string;
62
63
  brand_id: string;
63
64
  active: boolean;
64
- code: string;
65
65
  is_public: boolean;
66
66
  used_count: number;
67
67
  assigned_count: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.474",
3
+ "version": "0.2.476",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",