@managesome/eposmatic-toolkit 0.2.399 → 0.2.401
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/RFQ.d.ts +36 -0
- package/lib/constants/RFQ.js +86 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +1 -0
- package/lib/helpers/utils/index.d.ts +0 -1
- package/lib/helpers/utils/index.js +0 -1
- package/lib/schemas/models/terminal_devices.d.ts +3 -15
- package/lib/schemas/models/terminal_devices.js +1 -19
- package/lib/schemas/types/terminal_devices.d.ts +1 -5
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare enum RFQ_PUBLIC_RESPOND_ACTION_ENUM {
|
|
2
|
+
CONFIRM = "confirm",
|
|
3
|
+
CANCEL = "cancel"
|
|
4
|
+
}
|
|
5
|
+
export declare const ALL_RFQ_PUBLIC_RESPOND_ACTIONS: RFQ_PUBLIC_RESPOND_ACTION_ENUM[];
|
|
6
|
+
export declare enum RFQ_PUBLIC_RESPOND_CODE_ENUM {
|
|
7
|
+
PROCESSED = "PROCESSED",
|
|
8
|
+
ALREADY_PROCESSED = "ALREADY_PROCESSED",
|
|
9
|
+
EXPIRED = "EXPIRED",
|
|
10
|
+
NOT_FOUND = "NOT_FOUND",
|
|
11
|
+
INVALID_TRANSITION = "INVALID_TRANSITION",
|
|
12
|
+
/** Used by routes when the request body is missing required fields. */
|
|
13
|
+
INVALID_REQUEST = "INVALID_REQUEST"
|
|
14
|
+
}
|
|
15
|
+
export declare const ALL_RFQ_PUBLIC_RESPOND_CODES: RFQ_PUBLIC_RESPOND_CODE_ENUM[];
|
|
16
|
+
export type RfqType = 'purchase' | 'sale';
|
|
17
|
+
export type ActionStatus = 'PENDING' | 'COMPLETED' | 'EXPIRED' | 'INVALID';
|
|
18
|
+
export interface IRfqRespondPageResult {
|
|
19
|
+
status: ActionStatus;
|
|
20
|
+
title: string;
|
|
21
|
+
message: string;
|
|
22
|
+
completedAt?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function getRfqRespondPageResult(code: RFQ_PUBLIC_RESPOND_CODE_ENUM, action: RFQ_PUBLIC_RESPOND_ACTION_ENUM, rfqType: RfqType): IRfqRespondPageResult;
|
|
25
|
+
export interface IPublicRfqRespondRequest {
|
|
26
|
+
rfq_id: string;
|
|
27
|
+
action: RFQ_PUBLIC_RESPOND_ACTION_ENUM;
|
|
28
|
+
}
|
|
29
|
+
export interface IPublicRfqRespondResponse {
|
|
30
|
+
success: boolean;
|
|
31
|
+
code: RFQ_PUBLIC_RESPOND_CODE_ENUM;
|
|
32
|
+
message: string;
|
|
33
|
+
order_status?: string;
|
|
34
|
+
rfq_id?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function getRfqPublicRespondMessage(code: RFQ_PUBLIC_RESPOND_CODE_ENUM, action: RFQ_PUBLIC_RESPOND_ACTION_ENUM): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALL_RFQ_PUBLIC_RESPOND_CODES = exports.RFQ_PUBLIC_RESPOND_CODE_ENUM = exports.ALL_RFQ_PUBLIC_RESPOND_ACTIONS = exports.RFQ_PUBLIC_RESPOND_ACTION_ENUM = void 0;
|
|
4
|
+
exports.getRfqRespondPageResult = getRfqRespondPageResult;
|
|
5
|
+
exports.getRfqPublicRespondMessage = getRfqPublicRespondMessage;
|
|
6
|
+
var RFQ_PUBLIC_RESPOND_ACTION_ENUM;
|
|
7
|
+
(function (RFQ_PUBLIC_RESPOND_ACTION_ENUM) {
|
|
8
|
+
RFQ_PUBLIC_RESPOND_ACTION_ENUM["CONFIRM"] = "confirm";
|
|
9
|
+
RFQ_PUBLIC_RESPOND_ACTION_ENUM["CANCEL"] = "cancel";
|
|
10
|
+
})(RFQ_PUBLIC_RESPOND_ACTION_ENUM || (exports.RFQ_PUBLIC_RESPOND_ACTION_ENUM = RFQ_PUBLIC_RESPOND_ACTION_ENUM = {}));
|
|
11
|
+
exports.ALL_RFQ_PUBLIC_RESPOND_ACTIONS = Object.values(RFQ_PUBLIC_RESPOND_ACTION_ENUM);
|
|
12
|
+
var RFQ_PUBLIC_RESPOND_CODE_ENUM;
|
|
13
|
+
(function (RFQ_PUBLIC_RESPOND_CODE_ENUM) {
|
|
14
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["PROCESSED"] = "PROCESSED";
|
|
15
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["ALREADY_PROCESSED"] = "ALREADY_PROCESSED";
|
|
16
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["EXPIRED"] = "EXPIRED";
|
|
17
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["NOT_FOUND"] = "NOT_FOUND";
|
|
18
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["INVALID_TRANSITION"] = "INVALID_TRANSITION";
|
|
19
|
+
/** Used by routes when the request body is missing required fields. */
|
|
20
|
+
RFQ_PUBLIC_RESPOND_CODE_ENUM["INVALID_REQUEST"] = "INVALID_REQUEST";
|
|
21
|
+
})(RFQ_PUBLIC_RESPOND_CODE_ENUM || (exports.RFQ_PUBLIC_RESPOND_CODE_ENUM = RFQ_PUBLIC_RESPOND_CODE_ENUM = {}));
|
|
22
|
+
exports.ALL_RFQ_PUBLIC_RESPOND_CODES = Object.values(RFQ_PUBLIC_RESPOND_CODE_ENUM);
|
|
23
|
+
function getRfqRespondPageResult(code, action, rfqType) {
|
|
24
|
+
const label = rfqType === 'sale' ? 'Quotation' : 'RFQ';
|
|
25
|
+
switch (code) {
|
|
26
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.PROCESSED:
|
|
27
|
+
return {
|
|
28
|
+
status: 'PENDING',
|
|
29
|
+
title: action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM ? `${label} Approved` : `${label} Cancelled`,
|
|
30
|
+
message: getRfqPublicRespondMessage(code, action),
|
|
31
|
+
};
|
|
32
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.ALREADY_PROCESSED:
|
|
33
|
+
return {
|
|
34
|
+
status: 'COMPLETED',
|
|
35
|
+
title: action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM ? 'Already Approved' : 'Already Cancelled',
|
|
36
|
+
message: getRfqPublicRespondMessage(code, action),
|
|
37
|
+
};
|
|
38
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.EXPIRED:
|
|
39
|
+
return {
|
|
40
|
+
status: 'EXPIRED',
|
|
41
|
+
title: `${label} Expired`,
|
|
42
|
+
message: getRfqPublicRespondMessage(code, action),
|
|
43
|
+
};
|
|
44
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.NOT_FOUND:
|
|
45
|
+
return {
|
|
46
|
+
status: 'INVALID',
|
|
47
|
+
title: `${label} Not Found`,
|
|
48
|
+
message: getRfqPublicRespondMessage(code, action),
|
|
49
|
+
};
|
|
50
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.INVALID_TRANSITION:
|
|
51
|
+
return {
|
|
52
|
+
status: 'INVALID',
|
|
53
|
+
title: 'Action Not Allowed',
|
|
54
|
+
message: getRfqPublicRespondMessage(code, action),
|
|
55
|
+
};
|
|
56
|
+
default:
|
|
57
|
+
return {
|
|
58
|
+
status: 'INVALID',
|
|
59
|
+
title: 'Unexpected Error',
|
|
60
|
+
message: 'An unexpected response was received. Please try again or contact support.',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// ─── Message helpers ───────────────────────────────────────────────
|
|
65
|
+
function getRfqPublicRespondMessage(code, action) {
|
|
66
|
+
switch (code) {
|
|
67
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.PROCESSED:
|
|
68
|
+
return action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM
|
|
69
|
+
? 'The RFQ has been approved successfully.'
|
|
70
|
+
: 'The RFQ has been cancelled successfully.';
|
|
71
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.ALREADY_PROCESSED:
|
|
72
|
+
return action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM
|
|
73
|
+
? 'This RFQ has already been approved.'
|
|
74
|
+
: 'This RFQ has already been cancelled.';
|
|
75
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.EXPIRED:
|
|
76
|
+
return 'This RFQ has expired and can no longer be responded to.';
|
|
77
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.NOT_FOUND:
|
|
78
|
+
return 'This RFQ could not be found. It may have been deleted or the link is invalid.';
|
|
79
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.INVALID_TRANSITION:
|
|
80
|
+
return action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM
|
|
81
|
+
? 'This RFQ has already been cancelled and cannot be approved.'
|
|
82
|
+
: 'This RFQ has already been approved and cannot be cancelled via this link.';
|
|
83
|
+
default:
|
|
84
|
+
return 'An unknown error occurred.';
|
|
85
|
+
}
|
|
86
|
+
}
|
package/lib/constants/index.d.ts
CHANGED
package/lib/constants/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./ORDER"), exports);
|
|
|
25
25
|
__exportStar(require("./PRA_ENUMS"), exports);
|
|
26
26
|
__exportStar(require("./PURCHASE_ORDER"), exports);
|
|
27
27
|
__exportStar(require("./REPORT_WEBVIEW"), exports);
|
|
28
|
+
__exportStar(require("./RFQ"), exports);
|
|
28
29
|
__exportStar(require("./SMARTPAY_ENUMS"), exports);
|
|
29
30
|
__exportStar(require("./SOCKET"), exports);
|
|
30
31
|
__exportStar(require("./SRB_ENUMS"), exports);
|
|
@@ -61,7 +61,6 @@ export * from './simplified-catalog';
|
|
|
61
61
|
export * from './simplified-tenant';
|
|
62
62
|
export * from './specials-helpers';
|
|
63
63
|
export * from './tenant-staff-helpers';
|
|
64
|
-
export * from './terminal-devices-helpers';
|
|
65
64
|
export * from './time-helpers';
|
|
66
65
|
export * from './void-items-report-helpers';
|
|
67
66
|
export * from './void-order-items-helpers';
|
|
@@ -80,7 +80,6 @@ __exportStar(require("./simplified-catalog"), exports);
|
|
|
80
80
|
__exportStar(require("./simplified-tenant"), exports);
|
|
81
81
|
__exportStar(require("./specials-helpers"), exports);
|
|
82
82
|
__exportStar(require("./tenant-staff-helpers"), exports);
|
|
83
|
-
__exportStar(require("./terminal-devices-helpers"), exports);
|
|
84
83
|
__exportStar(require("./time-helpers"), exports);
|
|
85
84
|
__exportStar(require("./void-items-report-helpers"), exports);
|
|
86
85
|
__exportStar(require("./void-order-items-helpers"), exports);
|
|
@@ -12,14 +12,10 @@ export declare const TerminalDevicesSchema: Schema<any, import("mongoose").Model
|
|
|
12
12
|
createdAt: NativeDate;
|
|
13
13
|
updatedAt: NativeDate;
|
|
14
14
|
active: boolean;
|
|
15
|
-
total_orders: number;
|
|
16
|
-
device_id: string;
|
|
17
15
|
device_brand: import("../../constants").TERMINAL_TYPE_ENUM;
|
|
18
|
-
|
|
19
|
-
pairing_code: string;
|
|
16
|
+
_pairing_code: string;
|
|
20
17
|
register_id: string;
|
|
21
18
|
register_name: string;
|
|
22
|
-
total_orders_amount: number;
|
|
23
19
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
24
20
|
createdAt: NativeDate;
|
|
25
21
|
updatedAt: NativeDate;
|
|
@@ -29,14 +25,10 @@ export declare const TerminalDevicesSchema: Schema<any, import("mongoose").Model
|
|
|
29
25
|
createdAt: NativeDate;
|
|
30
26
|
updatedAt: NativeDate;
|
|
31
27
|
active: boolean;
|
|
32
|
-
total_orders: number;
|
|
33
|
-
device_id: string;
|
|
34
28
|
device_brand: import("../../constants").TERMINAL_TYPE_ENUM;
|
|
35
|
-
|
|
36
|
-
pairing_code: string;
|
|
29
|
+
_pairing_code: string;
|
|
37
30
|
register_id: string;
|
|
38
31
|
register_name: string;
|
|
39
|
-
total_orders_amount: number;
|
|
40
32
|
}>> & import("mongoose").FlatRecord<{
|
|
41
33
|
createdAt: NativeDate;
|
|
42
34
|
updatedAt: NativeDate;
|
|
@@ -46,14 +38,10 @@ export declare const TerminalDevicesSchema: Schema<any, import("mongoose").Model
|
|
|
46
38
|
createdAt: NativeDate;
|
|
47
39
|
updatedAt: NativeDate;
|
|
48
40
|
active: boolean;
|
|
49
|
-
total_orders: number;
|
|
50
|
-
device_id: string;
|
|
51
41
|
device_brand: import("../../constants").TERMINAL_TYPE_ENUM;
|
|
52
|
-
|
|
53
|
-
pairing_code: string;
|
|
42
|
+
_pairing_code: string;
|
|
54
43
|
register_id: string;
|
|
55
44
|
register_name: string;
|
|
56
|
-
total_orders_amount: number;
|
|
57
45
|
}> & Required<{
|
|
58
46
|
_id: import("mongoose").Types.ObjectId;
|
|
59
47
|
}> & {
|
|
@@ -15,23 +15,13 @@ exports.TerminalDevicesSchema = new mongoose_1.Schema({
|
|
|
15
15
|
immutable: true,
|
|
16
16
|
ref: 'tenants',
|
|
17
17
|
},
|
|
18
|
-
device_id: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
immutable: true,
|
|
22
|
-
},
|
|
23
18
|
device_brand: {
|
|
24
19
|
type: String,
|
|
25
20
|
enum: constants_1.ALL_TERMINAL_TYPES,
|
|
26
21
|
required: true,
|
|
27
22
|
immutable: true,
|
|
28
23
|
},
|
|
29
|
-
|
|
30
|
-
type: String,
|
|
31
|
-
required: true,
|
|
32
|
-
immutable: true,
|
|
33
|
-
},
|
|
34
|
-
pairing_code: {
|
|
24
|
+
_pairing_code: {
|
|
35
25
|
type: String,
|
|
36
26
|
default: null,
|
|
37
27
|
},
|
|
@@ -47,14 +37,6 @@ exports.TerminalDevicesSchema = new mongoose_1.Schema({
|
|
|
47
37
|
type: Boolean,
|
|
48
38
|
default: false,
|
|
49
39
|
},
|
|
50
|
-
total_orders: {
|
|
51
|
-
type: Number,
|
|
52
|
-
default: 0,
|
|
53
|
-
},
|
|
54
|
-
total_orders_amount: {
|
|
55
|
-
type: Number,
|
|
56
|
-
default: 0,
|
|
57
|
-
},
|
|
58
40
|
createdAt: {
|
|
59
41
|
type: mongoose_1.Schema.Types.Date,
|
|
60
42
|
required: true,
|
|
@@ -2,15 +2,11 @@ import { TERMINAL_TYPE_ENUM } from '../../constants';
|
|
|
2
2
|
export interface ITerminalDevice {
|
|
3
3
|
_id: string;
|
|
4
4
|
tenant_id: string;
|
|
5
|
-
device_id: string;
|
|
6
5
|
device_brand: TERMINAL_TYPE_ENUM;
|
|
7
|
-
merchant_id: string;
|
|
8
|
-
pairing_code: string | null;
|
|
9
6
|
register_id: string | null;
|
|
10
7
|
register_name: string | null;
|
|
8
|
+
_pairing_code: string | null;
|
|
11
9
|
active: boolean;
|
|
12
|
-
total_orders: number;
|
|
13
|
-
total_orders_amount: number;
|
|
14
10
|
createdAt: Date;
|
|
15
11
|
updatedAt: Date;
|
|
16
12
|
}
|