shuttlepro-shared 1.5.21 → 1.5.23
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/models/Order.js +12 -0
- package/models/Workspace.js +2 -0
- package/package.json +1 -1
package/models/Order.js
CHANGED
|
@@ -18,6 +18,9 @@ const getPhoneRegex = (phone) => {
|
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
const _ = require("lodash");
|
|
21
|
+
const {
|
|
22
|
+
findWorkspaceById,
|
|
23
|
+
} = require("../common/repositories/workspace.repository");
|
|
21
24
|
|
|
22
25
|
const ShipperInformation = new Schema({
|
|
23
26
|
_id: false,
|
|
@@ -227,6 +230,15 @@ OrderSchema.post("findOneAndUpdate", async function (doc) {
|
|
|
227
230
|
|
|
228
231
|
const markOrUnMarkOrderAsDuplicate = async (doc) => {
|
|
229
232
|
try {
|
|
233
|
+
if (!doc?.workspaceId) {
|
|
234
|
+
return { code: 200 };
|
|
235
|
+
}
|
|
236
|
+
const workspace = await findWorkspaceById(doc.workspaceId.toString(), [
|
|
237
|
+
"allowedModules",
|
|
238
|
+
]);
|
|
239
|
+
if (!workspace?.allowedModules?.includes("oms")) {
|
|
240
|
+
return { code: 200 };
|
|
241
|
+
}
|
|
230
242
|
if (["pending", "cancelled", "published"].includes(doc?.statusType)) {
|
|
231
243
|
if (["cancelled"].includes(doc?.statusType)) {
|
|
232
244
|
await Order.updateOne(
|
package/models/Workspace.js
CHANGED
|
@@ -236,6 +236,8 @@ const workspaceSchema = new mongoose.Schema(
|
|
|
236
236
|
isDeleted: { type: Boolean, default: false },
|
|
237
237
|
isPaymentDue: { type: Boolean, default: false },
|
|
238
238
|
isPaymentClosable: { type: Boolean, default: false },
|
|
239
|
+
/** True when a WhatsApp template send failed due to a WhatsApp Business payment/eligibility issue (e.g. error code 131042). Cleared automatically on the next successful template send. */
|
|
240
|
+
whatsappPaymentDue: { type: Boolean, default: false },
|
|
239
241
|
ticketsByConversation: { type: Boolean, default: false },
|
|
240
242
|
businessHours: {
|
|
241
243
|
startTime: { type: String, default: "" },
|