@unchainedshop/plugins 4.8.18 → 4.8.19
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/lib/files/gridfs/api.js
CHANGED
|
@@ -87,7 +87,7 @@ export const gridfsRouteHandler = async (request, context) => {
|
|
|
87
87
|
const signature = url.searchParams.get('s');
|
|
88
88
|
const expiryTimestamp = url.searchParams.get('e');
|
|
89
89
|
const fileDocument = await modules.files.findFile({
|
|
90
|
-
url: `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${fileName}`,
|
|
90
|
+
url: `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${encodeURIComponent(fileName)}`,
|
|
91
91
|
});
|
|
92
92
|
if (!fileDocument) {
|
|
93
93
|
logger.error('File not found', { fileName });
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProductPricingDirector, ProductPricingAdapter, } from '@unchainedshop/core';
|
|
2
|
+
export const ProductQuotationPrice = {
|
|
3
|
+
...ProductPricingAdapter,
|
|
4
|
+
key: 'shop.unchained.pricing.quotation-price',
|
|
5
|
+
version: '1.0.0',
|
|
6
|
+
label: 'Apply negotiated quotation price',
|
|
7
|
+
orderIndex: 20,
|
|
8
|
+
isActivatedFor: (context) => {
|
|
9
|
+
return Boolean(context.quotationId);
|
|
10
|
+
},
|
|
11
|
+
actions: (params) => {
|
|
12
|
+
const pricingAdapter = ProductPricingAdapter.actions(params);
|
|
13
|
+
return {
|
|
14
|
+
...pricingAdapter,
|
|
15
|
+
calculate: async () => {
|
|
16
|
+
const { quotationId, currencyCode, quantity, modules } = params.context;
|
|
17
|
+
const quotation = await modules.quotations.findQuotation({ quotationId: quotationId });
|
|
18
|
+
const isApplicable = quotation &&
|
|
19
|
+
quotation.price != null &&
|
|
20
|
+
quotation.currencyCode === currencyCode &&
|
|
21
|
+
(modules.quotations.isProposalValid(quotation) ||
|
|
22
|
+
modules.quotations.normalizedStatus(quotation) === 'FULFILLED');
|
|
23
|
+
if (isApplicable) {
|
|
24
|
+
const negotiatedTotal = Math.round(quotation.price) * quantity;
|
|
25
|
+
const correction = negotiatedTotal - params.calculationSheet.sum();
|
|
26
|
+
if (correction !== 0) {
|
|
27
|
+
pricingAdapter.resultSheet().addItem({
|
|
28
|
+
amount: correction,
|
|
29
|
+
isTaxable: false,
|
|
30
|
+
isNetPrice: false,
|
|
31
|
+
meta: { adapter: ProductQuotationPrice.key, quotationId: quotation._id },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return pricingAdapter.calculate();
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
ProductPricingDirector.registerAdapter(ProductQuotationPrice);
|
package/lib/quotations/manual.js
CHANGED
|
@@ -10,8 +10,13 @@ const ManualOffering = {
|
|
|
10
10
|
return {
|
|
11
11
|
...QuotationAdapter.actions(params),
|
|
12
12
|
quote: async () => {
|
|
13
|
+
const { quotation } = params;
|
|
14
|
+
const price = Number(quotation?.context?.price);
|
|
13
15
|
return {
|
|
14
|
-
expires:
|
|
16
|
+
expires: quotation?.context?.expires
|
|
17
|
+
? new Date(quotation.context.expires)
|
|
18
|
+
: new Date(new Date().getTime() + 3600 * 1000),
|
|
19
|
+
price: Number.isFinite(price) && price > 0 ? Math.round(price) : undefined,
|
|
15
20
|
};
|
|
16
21
|
},
|
|
17
22
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/plugins",
|
|
3
3
|
"description": "Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.19",
|
|
5
5
|
"main": "lib/plugins-index.js",
|
|
6
6
|
"types": "lib/plugins-index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@scure/bip32": "^2.0.0",
|
|
119
119
|
"@scure/btc-signer": "^2.0.0",
|
|
120
120
|
"@types/express": "^5.0.3",
|
|
121
|
-
"@types/node": "^
|
|
121
|
+
"@types/node": "^26.2.0",
|
|
122
122
|
"expiry-map": "^2.0.0",
|
|
123
123
|
"express": "^5.1.0",
|
|
124
124
|
"fastify": "^5.4.0",
|