**What** - calculate the shipping option price when creating a shipping method - calculate the shipping option price when refreshing cart - add testing for calculated SO flow - fix validation on calculated SO creation - add manual fulfillment provider for testing - add `from_location` to calculation context --- RESOLVES CMRC-778 RESOLVES CMRC-602 RESOLVES SUP-136
75 lines
1.8 KiB
JavaScript
75 lines
1.8 KiB
JavaScript
const { defineConfig, Modules } = require("@medusajs/utils")
|
|
const os = require("os")
|
|
const path = require("path")
|
|
|
|
const DB_HOST = process.env.DB_HOST
|
|
const DB_USERNAME = process.env.DB_USERNAME
|
|
const DB_PASSWORD = process.env.DB_PASSWORD
|
|
const DB_NAME = process.env.DB_TEMP_NAME
|
|
const DB_URL = `postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}`
|
|
process.env.DATABASE_URL = DB_URL
|
|
process.env.LOG_LEVEL = "error"
|
|
|
|
const customFulfillmentProvider = {
|
|
resolve: "@medusajs/fulfillment-manual",
|
|
id: "test-provider",
|
|
}
|
|
|
|
const customFulfillmentProviderCalculated = {
|
|
resolve: require("./dist/utils/providers/fulfillment-manual-calculated")
|
|
.default,
|
|
id: "test-provider-calculated",
|
|
}
|
|
|
|
module.exports = defineConfig({
|
|
admin: {
|
|
disable: true,
|
|
},
|
|
projectConfig: {
|
|
http: {
|
|
jwtSecret: "test",
|
|
},
|
|
},
|
|
modules: {
|
|
[Modules.FULFILLMENT]: {
|
|
/** @type {import('@medusajs/fulfillment').FulfillmentModuleOptions} */
|
|
options: {
|
|
providers: [
|
|
customFulfillmentProvider,
|
|
customFulfillmentProviderCalculated,
|
|
],
|
|
},
|
|
},
|
|
[Modules.NOTIFICATION]: {
|
|
resolve: "@medusajs/notification",
|
|
options: {
|
|
providers: [
|
|
{
|
|
resolve: "@medusajs/notification-local",
|
|
id: "local",
|
|
options: {
|
|
name: "Local Notification Provider",
|
|
channels: ["feed"],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
[Modules.FILE]: {
|
|
resolve: "@medusajs/file",
|
|
options: {
|
|
providers: [
|
|
{
|
|
resolve: "@medusajs/file-local",
|
|
id: "local",
|
|
options: {
|
|
// This is the directory where we can reliably write in CI environments
|
|
upload_dir: path.join(os.tmpdir(), "uploads"),
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
})
|