Tests passing
This commit is contained in:
1 parent
21bc096b2e
commit
ee93256e69
17 files changed
+311
-245
No files matched your search
@@ -1,8 +1,22 @@
|
||||
const inventorySync = container => {
|
||||
const inventorySync = async (container) => {
|
||||
const brightpearlService = container.resolve("brightpearlService")
|
||||
const eventBus = container.resolve("eventBusService")
|
||||
const pattern = "43 4,10,14,20 * * *" // nice for tests "*/10 * * * * *"
|
||||
eventBus.createCronJob("inventory-sync", {}, pattern, brightpearlService.syncInventory())
|
||||
|
||||
try {
|
||||
const client = await brightpearlService.getClient()
|
||||
const pattern = "43 4,10,14,20 * * *" // nice for tests "*/10 * * * * *"
|
||||
eventBus.createCronJob(
|
||||
"inventory-sync",
|
||||
{},
|
||||
pattern,
|
||||
brightpearlService.syncInventory()
|
||||
)
|
||||
} catch (err) {
|
||||
if (err.name === "not_allowed") {
|
||||
return
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export default inventorySync
|
||||
@@ -1,6 +1,14 @@
|
||||
const webhookLoader = async (container) => {
|
||||
const brightpearlService = container.resolve("brightpearlService")
|
||||
await brightpearlService.verifyWebhooks()
|
||||
try {
|
||||
const client = await brightpearlService.getClient()
|
||||
await brightpearlService.verifyWebhooks()
|
||||
} catch (err) {
|
||||
if (err.name === "not_allowed") {
|
||||
return
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export default webhookLoader
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { BaseService } from "medusa-interfaces"
|
||||
import Brightpearl from "../utils/brightpearl"
|
||||
|
||||
|
||||
Reference in new issue
Block a user