@managesome/eposmatic-toolkit 0.2.442 → 0.2.443
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.
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
vendor_id: string;
|
|
28
|
+
action: RFQ_PUBLIC_RESPOND_ACTION_ENUM;
|
|
29
|
+
}
|
|
30
|
+
export interface IPublicRfqRespondResponse {
|
|
31
|
+
success: boolean;
|
|
32
|
+
code: RFQ_PUBLIC_RESPOND_CODE_ENUM;
|
|
33
|
+
message: string;
|
|
34
|
+
order_status?: string;
|
|
35
|
+
rfq_id?: string;
|
|
36
|
+
}
|
|
37
|
+
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} Accepted` : `${label} Declined`,
|
|
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 Accepted' : 'Already Declined',
|
|
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
|
+
? 'You have accepted this RFQ. The buyer will review your response.'
|
|
70
|
+
: 'You have declined this RFQ.';
|
|
71
|
+
case RFQ_PUBLIC_RESPOND_CODE_ENUM.ALREADY_PROCESSED:
|
|
72
|
+
return action === RFQ_PUBLIC_RESPOND_ACTION_ENUM.CONFIRM
|
|
73
|
+
? 'You have already accepted this RFQ.'
|
|
74
|
+
: 'You have already declined this RFQ.';
|
|
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 declined and cannot be accepted.'
|
|
82
|
+
: 'This RFQ has already been accepted and cannot be declined 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
|
@@ -24,6 +24,7 @@ __exportStar(require("./NOTIFICATIONS"), exports);
|
|
|
24
24
|
__exportStar(require("./ORDER"), exports);
|
|
25
25
|
__exportStar(require("./PRA_ENUMS"), exports);
|
|
26
26
|
__exportStar(require("./REPORT_WEBVIEW"), exports);
|
|
27
|
+
__exportStar(require("./RFQ_GO"), exports);
|
|
27
28
|
__exportStar(require("./SMARTPAY_ENUMS"), exports);
|
|
28
29
|
__exportStar(require("./SOCKET"), exports);
|
|
29
30
|
__exportStar(require("./SRB_ENUMS"), exports);
|