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 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(
@@ -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: "" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.5.21",
3
+ "version": "1.5.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {