@reactionary/medusa 0.10.21 → 0.10.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.
|
@@ -131,8 +131,24 @@ class MedusaCheckoutCapability extends CheckoutCapability {
|
|
|
131
131
|
shippingMethodResponse.shipping_options
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
|
+
const calculatedPricesPromises = shippingMethodResponse.shipping_options.filter((x) => x.price_type === "calculated" && !x.calculated_price).map(async (sm) => {
|
|
135
|
+
const updatedSM = await client.store.fulfillment.calculate(sm.id, {
|
|
136
|
+
cart_id: payload.checkout.key
|
|
137
|
+
});
|
|
138
|
+
sm.calculated_price = updatedSM.shipping_option.calculated_price;
|
|
139
|
+
});
|
|
140
|
+
if (calculatedPricesPromises.length > 0) {
|
|
141
|
+
if (debug.enabled) {
|
|
142
|
+
debug("Calculating prices for {0} shipping methods for checkout with key: {1}", [calculatedPricesPromises.length, payload.checkout.key]);
|
|
143
|
+
}
|
|
144
|
+
await Promise.all(calculatedPricesPromises);
|
|
145
|
+
if (debug.enabled) {
|
|
146
|
+
debug("Finished calculating prices for {0} shipping methods for checkout with key: {1}", [calculatedPricesPromises.length, payload.checkout.key]);
|
|
147
|
+
debug(`Updated shipping methods for checkout with key: ${payload.checkout.key}`, shippingMethodResponse.shipping_options);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
134
150
|
for (const sm of shippingMethodResponse.shipping_options) {
|
|
135
|
-
if (!sm.calculated_price) {
|
|
151
|
+
if (!sm.calculated_price || !sm.calculated_price.calculated_amount && !sm.calculated_price.original_amount) {
|
|
136
152
|
console.warn(`Skipping shipping method ${sm.name}/${sm.provider.id} because it has no calculated price for checkout ${payload.checkout.key}`);
|
|
137
153
|
continue;
|
|
138
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@medusajs/js-sdk": "^2.13.3",
|
|
13
|
-
"@reactionary/core": "0.10.
|
|
13
|
+
"@reactionary/core": "0.10.23",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|