@unchainedshop/plugins 4.6.1 → 4.7.2
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/README.md +0 -2
- package/lib/delivery/post/adapter.d.ts +2 -0
- package/lib/delivery/{post.js → post/adapter.js} +2 -3
- package/lib/delivery/post/index.d.ts +4 -0
- package/lib/delivery/post/index.js +10 -0
- package/lib/delivery/send-message/adapter.d.ts +2 -0
- package/lib/delivery/{send-message.js → send-message/adapter.js} +2 -3
- package/lib/delivery/send-message/index.d.ts +4 -0
- package/lib/delivery/send-message/index.js +10 -0
- package/lib/delivery/stores/adapter.d.ts +2 -0
- package/lib/delivery/{stores.js → stores/adapter.js} +2 -3
- package/lib/delivery/stores/index.d.ts +4 -0
- package/lib/delivery/stores/index.js +10 -0
- package/lib/enrollments/licensed/adapter.d.ts +6 -0
- package/lib/enrollments/{licensed.js → licensed/adapter.js} +2 -3
- package/lib/enrollments/licensed/index.d.ts +4 -0
- package/lib/enrollments/licensed/index.js +10 -0
- package/lib/events/node-event-emitter.d.ts +3 -1
- package/lib/events/node-event-emitter.js +3 -3
- package/lib/files/gridfs/adapter.d.ts +2 -2
- package/lib/files/gridfs/adapter.js +2 -5
- package/lib/files/gridfs/api.d.ts +7 -0
- package/lib/files/gridfs/api.js +163 -0
- package/lib/files/gridfs/index.d.ts +5 -4
- package/lib/files/gridfs/index.js +30 -3
- package/lib/files/minio/adapter.d.ts +4 -0
- package/lib/files/minio/adapter.js +160 -0
- package/lib/files/minio/api.d.ts +2 -0
- package/lib/files/minio/api.js +41 -0
- package/lib/files/minio/index.d.ts +4 -5
- package/lib/files/minio/index.js +18 -157
- package/lib/files/temp-upload/api.d.ts +6 -0
- package/lib/files/temp-upload/api.js +49 -0
- package/lib/files/temp-upload/index.d.ts +3 -0
- package/lib/files/temp-upload/index.js +15 -0
- package/lib/filters/local-search/adapter.d.ts +2 -0
- package/lib/filters/{local-search.js → local-search/adapter.js} +2 -12
- package/lib/filters/local-search/index.d.ts +4 -0
- package/lib/filters/local-search/index.js +16 -0
- package/lib/filters/strict-equal/adapter.d.ts +2 -0
- package/lib/filters/{strict-equal.js → strict-equal/adapter.js} +2 -3
- package/lib/filters/strict-equal/index.d.ts +4 -0
- package/lib/filters/strict-equal/index.js +10 -0
- package/lib/payment/apple-iap/adapter.d.ts +2 -1
- package/lib/payment/apple-iap/adapter.js +2 -3
- package/lib/payment/apple-iap/api.d.ts +2 -0
- package/lib/payment/apple-iap/{handler-fastify.js → api.js} +47 -30
- package/lib/payment/apple-iap/index.d.ts +6 -4
- package/lib/payment/apple-iap/index.js +28 -3
- package/lib/payment/cryptopay/adapter.d.ts +2 -0
- package/lib/payment/cryptopay/{plugin.js → adapter.js} +2 -4
- package/lib/payment/cryptopay/api.d.ts +2 -0
- package/lib/payment/cryptopay/api.js +23 -0
- package/lib/payment/cryptopay/index.d.ts +5 -4
- package/lib/payment/cryptopay/index.js +31 -3
- package/lib/payment/datatrans-v2/adapter.d.ts +2 -0
- package/lib/payment/datatrans-v2/adapter.js +406 -0
- package/lib/payment/datatrans-v2/api.d.ts +2 -0
- package/lib/payment/datatrans-v2/api.js +108 -0
- package/lib/payment/datatrans-v2/index.d.ts +4 -1
- package/lib/payment/datatrans-v2/index.js +17 -400
- package/lib/payment/invoice/adapter.d.ts +2 -0
- package/lib/payment/{invoice.js → invoice/adapter.js} +2 -3
- package/lib/payment/invoice/index.d.ts +4 -0
- package/lib/payment/invoice/index.js +10 -0
- package/lib/payment/invoice-prepaid/adapter.d.ts +2 -0
- package/lib/payment/{invoice-prepaid.js → invoice-prepaid/adapter.js} +2 -3
- package/lib/payment/invoice-prepaid/index.d.ts +4 -0
- package/lib/payment/invoice-prepaid/index.js +10 -0
- package/lib/payment/payrexx/adapter.d.ts +2 -0
- package/lib/payment/payrexx/adapter.js +161 -0
- package/lib/payment/payrexx/api.d.ts +2 -0
- package/lib/payment/payrexx/api.js +97 -0
- package/lib/payment/payrexx/index.d.ts +4 -1
- package/lib/payment/payrexx/index.js +19 -158
- package/lib/payment/postfinance-checkout/adapter.d.ts +2 -0
- package/lib/payment/postfinance-checkout/adapter.js +189 -0
- package/lib/payment/postfinance-checkout/index.d.ts +5 -0
- package/lib/payment/postfinance-checkout/index.js +25 -186
- package/lib/payment/postfinance-checkout/webhook.d.ts +2 -0
- package/lib/payment/postfinance-checkout/webhook.js +48 -0
- package/lib/payment/saferpay/adapter.js +1 -2
- package/lib/payment/saferpay/index.d.ts +5 -4
- package/lib/payment/saferpay/index.js +29 -3
- package/lib/payment/saferpay/webhook.d.ts +2 -0
- package/lib/payment/saferpay/webhook.js +64 -0
- package/lib/payment/stripe/adapter.d.ts +2 -0
- package/lib/payment/stripe/adapter.js +121 -0
- package/lib/payment/stripe/api.d.ts +6 -0
- package/lib/payment/stripe/api.js +165 -0
- package/lib/payment/stripe/index.d.ts +4 -1
- package/lib/payment/stripe/index.js +22 -116
- package/lib/payment/stripe/stripe.js +2 -5
- package/lib/presets/all.d.ts +1 -70
- package/lib/presets/all.js +41 -27
- package/lib/presets/base.d.ts +1 -25
- package/lib/presets/base.js +56 -25
- package/lib/presets/countries/ch.d.ts +1 -2
- package/lib/presets/countries/ch.js +7 -2
- package/lib/presets/crypto.d.ts +3 -7
- package/lib/presets/crypto.js +18 -7
- package/lib/pricing/{delivery-swiss-tax.d.ts → delivery-swiss-tax/adapter.d.ts} +1 -0
- package/lib/pricing/{delivery-swiss-tax.js → delivery-swiss-tax/adapter.js} +4 -4
- package/lib/pricing/delivery-swiss-tax/index.d.ts +4 -0
- package/lib/pricing/delivery-swiss-tax/index.js +10 -0
- package/lib/pricing/{discount-100-off.d.ts → discount-100-off/adapter.d.ts} +1 -0
- package/lib/pricing/{discount-100-off.js → discount-100-off/adapter.js} +2 -2
- package/lib/pricing/discount-100-off/index.d.ts +4 -0
- package/lib/pricing/discount-100-off/index.js +10 -0
- package/lib/pricing/{discount-half-price-manual.d.ts → discount-half-price-manual/adapter.d.ts} +1 -0
- package/lib/pricing/{discount-half-price-manual.js → discount-half-price-manual/adapter.js} +2 -2
- package/lib/pricing/discount-half-price-manual/index.d.ts +4 -0
- package/lib/pricing/discount-half-price-manual/index.js +10 -0
- package/lib/pricing/{free-delivery.d.ts → free-delivery/adapter.d.ts} +1 -0
- package/lib/pricing/{free-delivery.js → free-delivery/adapter.js} +2 -2
- package/lib/pricing/free-delivery/index.d.ts +4 -0
- package/lib/pricing/free-delivery/index.js +10 -0
- package/lib/pricing/{free-payment.d.ts → free-payment/adapter.d.ts} +1 -0
- package/lib/pricing/{free-payment.js → free-payment/adapter.js} +2 -2
- package/lib/pricing/free-payment/index.d.ts +4 -0
- package/lib/pricing/free-payment/index.js +10 -0
- package/lib/pricing/{order-delivery.d.ts → order-delivery/adapter.d.ts} +1 -0
- package/lib/pricing/{order-delivery.js → order-delivery/adapter.js} +2 -2
- package/lib/pricing/order-delivery/index.d.ts +4 -0
- package/lib/pricing/order-delivery/index.js +10 -0
- package/lib/pricing/{order-discount.d.ts → order-discount/adapter.d.ts} +1 -0
- package/lib/pricing/{order-discount.js → order-discount/adapter.js} +2 -2
- package/lib/pricing/order-discount/index.d.ts +4 -0
- package/lib/pricing/order-discount/index.js +10 -0
- package/lib/pricing/{order-items.d.ts → order-items/adapter.d.ts} +1 -0
- package/lib/pricing/{order-items.js → order-items/adapter.js} +2 -2
- package/lib/pricing/order-items/index.d.ts +4 -0
- package/lib/pricing/order-items/index.js +10 -0
- package/lib/pricing/{order-payment.d.ts → order-payment/adapter.d.ts} +1 -0
- package/lib/pricing/{order-payment.js → order-payment/adapter.js} +2 -2
- package/lib/pricing/order-payment/index.d.ts +4 -0
- package/lib/pricing/order-payment/index.js +10 -0
- package/lib/pricing/{product-catalog-price.d.ts → product-catalog-price/adapter.d.ts} +1 -0
- package/lib/pricing/{product-catalog-price.js → product-catalog-price/adapter.js} +2 -2
- package/lib/pricing/product-catalog-price/index.d.ts +4 -0
- package/lib/pricing/product-catalog-price/index.js +10 -0
- package/lib/pricing/{product-discount.d.ts → product-discount/adapter.d.ts} +1 -0
- package/lib/pricing/{product-discount.js → product-discount/adapter.js} +2 -2
- package/lib/pricing/product-discount/index.d.ts +4 -0
- package/lib/pricing/product-discount/index.js +10 -0
- package/lib/pricing/{product-price-rateconversion.d.ts → product-price-rateconversion/adapter.d.ts} +1 -0
- package/lib/pricing/{product-price-rateconversion.js → product-price-rateconversion/adapter.js} +2 -2
- package/lib/pricing/product-price-rateconversion/index.d.ts +4 -0
- package/lib/pricing/product-price-rateconversion/index.js +10 -0
- package/lib/pricing/{product-swiss-tax.d.ts → product-swiss-tax/adapter.d.ts} +1 -0
- package/lib/pricing/{product-swiss-tax.js → product-swiss-tax/adapter.js} +4 -4
- package/lib/pricing/product-swiss-tax/index.d.ts +4 -0
- package/lib/pricing/product-swiss-tax/index.js +10 -0
- package/lib/quotations/manual/adapter.d.ts +2 -0
- package/lib/quotations/{manual.js → manual/adapter.js} +2 -3
- package/lib/quotations/manual/index.d.ts +4 -0
- package/lib/quotations/manual/index.js +10 -0
- package/lib/warehousing/erc-metadata/api.d.ts +12 -0
- package/lib/warehousing/erc-metadata/api.js +43 -0
- package/lib/warehousing/erc-metadata/index.d.ts +3 -0
- package/lib/warehousing/erc-metadata/index.js +15 -0
- package/lib/warehousing/eth-minter/adapter.d.ts +2 -0
- package/lib/warehousing/{eth-minter.js → eth-minter/adapter.js} +3 -4
- package/lib/warehousing/eth-minter/index.d.ts +4 -0
- package/lib/warehousing/eth-minter/index.js +10 -0
- package/lib/warehousing/store/adapter.d.ts +2 -0
- package/lib/warehousing/{store.js → store/adapter.js} +2 -3
- package/lib/warehousing/store/index.d.ts +4 -0
- package/lib/warehousing/store/index.js +10 -0
- package/lib/worker/budgetsms/adapter.d.ts +22 -0
- package/lib/worker/{budgetsms.js → budgetsms/adapter.js} +3 -3
- package/lib/worker/budgetsms/index.d.ts +4 -0
- package/lib/worker/budgetsms/index.js +10 -0
- package/lib/worker/bulk-export/adapter.d.ts +3 -0
- package/lib/worker/{bulk-export.js → bulk-export/adapter.js} +3 -3
- package/lib/worker/bulk-export/index.d.ts +4 -0
- package/lib/worker/bulk-export/index.js +10 -0
- package/lib/worker/{bulk-import.d.ts → bulk-import/adapter.d.ts} +1 -0
- package/lib/worker/{bulk-import.js → bulk-import/adapter.js} +2 -2
- package/lib/worker/bulk-import/api.d.ts +7 -0
- package/lib/worker/bulk-import/api.js +53 -0
- package/lib/worker/bulk-import/index.d.ts +4 -0
- package/lib/worker/bulk-import/index.js +18 -0
- package/lib/worker/bulkgate/adapter.d.ts +12 -0
- package/lib/worker/{bulkgate.js → bulkgate/adapter.js} +3 -3
- package/lib/worker/bulkgate/index.d.ts +4 -0
- package/lib/worker/bulkgate/index.js +10 -0
- package/lib/worker/email/adapter.d.ts +9 -0
- package/lib/worker/{email.js → email/adapter.js} +27 -13
- package/lib/worker/email/index.d.ts +4 -0
- package/lib/worker/email/index.js +10 -0
- package/lib/worker/enrollment-order-generator/adapter.d.ts +4 -0
- package/lib/worker/{enrollment-order-generator.js → enrollment-order-generator/adapter.js} +2 -2
- package/lib/worker/enrollment-order-generator/index.d.ts +4 -0
- package/lib/worker/enrollment-order-generator/index.js +13 -0
- package/lib/worker/{error-notifications.d.ts → error-notifications/adapter.d.ts} +1 -0
- package/lib/worker/{error-notifications.js → error-notifications/adapter.js} +9 -8
- package/lib/worker/error-notifications/index.d.ts +4 -0
- package/lib/worker/error-notifications/index.js +13 -0
- package/lib/worker/{export-token.d.ts → export-token/adapter.d.ts} +1 -1
- package/lib/worker/{export-token.js → export-token/adapter.js} +2 -3
- package/lib/worker/export-token/index.d.ts +4 -0
- package/lib/worker/export-token/index.js +13 -0
- package/lib/worker/{external.d.ts → external/adapter.d.ts} +1 -0
- package/lib/worker/{external.js → external/adapter.js} +2 -2
- package/lib/worker/external/index.d.ts +4 -0
- package/lib/worker/external/index.js +10 -0
- package/lib/worker/heartbeat/adapter.d.ts +8 -0
- package/lib/worker/{heartbeat.js → heartbeat/adapter.js} +3 -3
- package/lib/worker/heartbeat/index.d.ts +4 -0
- package/lib/worker/heartbeat/index.js +10 -0
- package/lib/worker/{http-request.d.ts → http-request/adapter.d.ts} +1 -1
- package/lib/worker/{http-request.js → http-request/adapter.js} +2 -3
- package/lib/worker/http-request/index.d.ts +4 -0
- package/lib/worker/http-request/index.js +10 -0
- package/lib/worker/{message.d.ts → message/adapter.d.ts} +1 -0
- package/lib/worker/{message.js → message/adapter.js} +2 -2
- package/lib/worker/message/index.d.ts +4 -0
- package/lib/worker/message/index.js +10 -0
- package/lib/worker/push-notification/adapter.d.ts +9 -0
- package/lib/worker/{push-notification.js → push-notification/adapter.js} +3 -3
- package/lib/worker/push-notification/index.d.ts +4 -0
- package/lib/worker/push-notification/index.js +10 -0
- package/lib/worker/twilio/adapter.d.ts +8 -0
- package/lib/worker/{twilio.js → twilio/adapter.js} +3 -3
- package/lib/worker/twilio/index.d.ts +4 -0
- package/lib/worker/twilio/index.js +10 -0
- package/lib/worker/update-coinbase-rates/adapter.d.ts +4 -0
- package/lib/worker/{update-coinbase-rates.js → update-coinbase-rates/adapter.js} +8 -6
- package/lib/worker/update-coinbase-rates/index.d.ts +4 -0
- package/lib/worker/update-coinbase-rates/index.js +13 -0
- package/lib/worker/update-ecb-rates/adapter.d.ts +4 -0
- package/lib/worker/{update-ecb-rates.js → update-ecb-rates/adapter.js} +11 -9
- package/lib/worker/update-ecb-rates/index.d.ts +4 -0
- package/lib/worker/update-ecb-rates/index.js +13 -0
- package/lib/worker/{update-token-ownership.d.ts → update-token-ownership/adapter.d.ts} +2 -0
- package/lib/worker/{update-token-ownership.js → update-token-ownership/adapter.js} +8 -7
- package/lib/worker/update-token-ownership/index.d.ts +4 -0
- package/lib/worker/update-token-ownership/index.js +13 -0
- package/lib/worker/{zombie-killer.js → zombie-killer/adapter.js} +1 -2
- package/lib/worker/zombie-killer/index.d.ts +4 -0
- package/lib/worker/zombie-killer/index.js +10 -0
- package/package.json +15 -10
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/enrollments/licensed.d.ts +0 -4
- package/lib/files/gridfs/handler-express.d.ts +0 -9
- package/lib/files/gridfs/handler-express.js +0 -110
- package/lib/files/gridfs/handler-fastify.d.ts +0 -3
- package/lib/files/gridfs/handler-fastify.js +0 -138
- package/lib/files/minio/handler-express.d.ts +0 -2
- package/lib/files/minio/handler-express.js +0 -36
- package/lib/files/minio/handler-fastify.d.ts +0 -3
- package/lib/files/minio/handler-fastify.js +0 -40
- package/lib/filters/local-search.d.ts +0 -3
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/payment/apple-iap/handler-express.d.ts +0 -2
- package/lib/payment/apple-iap/handler-express.js +0 -103
- package/lib/payment/apple-iap/handler-fastify.d.ts +0 -3
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -138
- package/lib/payment/cryptopay/handler-express.d.ts +0 -2
- package/lib/payment/cryptopay/handler-express.js +0 -19
- package/lib/payment/cryptopay/handler-fastify.d.ts +0 -3
- package/lib/payment/cryptopay/handler-fastify.js +0 -17
- package/lib/payment/cryptopay/plugin.d.ts +0 -3
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +0 -71
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +0 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +0 -71
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -87
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -85
- package/lib/payment/payrexx/handler-fastify.d.ts +0 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -91
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +0 -37
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +0 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +0 -40
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +0 -59
- package/lib/payment/saferpay/handler-fastify.d.ts +0 -2
- package/lib/payment/saferpay/handler-fastify.js +0 -62
- package/lib/payment/stripe/handler-express.d.ts +0 -5
- package/lib/payment/stripe/handler-express.js +0 -121
- package/lib/payment/stripe/handler-fastify.d.ts +0 -6
- package/lib/payment/stripe/handler-fastify.js +0 -131
- package/lib/presets/all-express.d.ts +0 -6
- package/lib/presets/all-express.js +0 -26
- package/lib/presets/all-fastify.d.ts +0 -6
- package/lib/presets/all-fastify.js +0 -49
- package/lib/presets/base-express.d.ts +0 -2
- package/lib/presets/base-express.js +0 -5
- package/lib/presets/base-fastify.d.ts +0 -3
- package/lib/presets/base-fastify.js +0 -16
- package/lib/presets/crypto-express.d.ts +0 -3
- package/lib/presets/crypto-express.js +0 -8
- package/lib/presets/crypto-fastify.d.ts +0 -3
- package/lib/presets/crypto-fastify.js +0 -11
- package/lib/pricing/discount-half-price.d.ts +0 -2
- package/lib/pricing/discount-half-price.js +0 -33
- package/lib/pricing/order-items-discount.d.ts +0 -2
- package/lib/pricing/order-items-discount.js +0 -50
- package/lib/pricing/order-round.d.ts +0 -10
- package/lib/pricing/order-round.js +0 -135
- package/lib/pricing/product-catalog-price-options.d.ts +0 -2
- package/lib/pricing/product-catalog-price-options.js +0 -51
- package/lib/pricing/product-round.d.ts +0 -10
- package/lib/pricing/product-round.js +0 -44
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/worker/budgetsms.d.ts +0 -9
- package/lib/worker/bulk-export.d.ts +0 -2
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- /package/lib/worker/{zombie-killer.d.ts → zombie-killer/adapter.d.ts} +0 -0
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ProductPricingDirector, ProductPricingAdapter, } from '@unchainedshop/core';
|
|
2
|
-
export const ProductPriceOptions = {
|
|
3
|
-
...ProductPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.product-price-options',
|
|
5
|
-
version: '1.0',
|
|
6
|
-
label: 'Add Gross Price of Options',
|
|
7
|
-
orderIndex: 1,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = ProductPricingAdapter.actions(params);
|
|
13
|
-
const { countryCode, currencyCode, quantity, modules } = params.context;
|
|
14
|
-
return {
|
|
15
|
-
...pricingAdapter,
|
|
16
|
-
async calculatePriceForProduct(product) {
|
|
17
|
-
const price = await modules.products.prices.price(product, {
|
|
18
|
-
countryCode,
|
|
19
|
-
currencyCode,
|
|
20
|
-
quantity,
|
|
21
|
-
});
|
|
22
|
-
if (price) {
|
|
23
|
-
const itemTotal = price.amount * quantity;
|
|
24
|
-
pricingAdapter.resultSheet().addItem({
|
|
25
|
-
amount: itemTotal,
|
|
26
|
-
isTaxable: Boolean(price.isTaxable),
|
|
27
|
-
isNetPrice: Boolean(price.isNetPrice),
|
|
28
|
-
meta: { adapter: ProductPriceOptions.key },
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
async calculate() {
|
|
33
|
-
const { configuration } = params.context;
|
|
34
|
-
const productIds = configuration?.flatMap(({ key, value }) => {
|
|
35
|
-
if (key === 'option')
|
|
36
|
-
return [value];
|
|
37
|
-
return [];
|
|
38
|
-
});
|
|
39
|
-
if (!productIds?.length) {
|
|
40
|
-
return pricingAdapter.calculate();
|
|
41
|
-
}
|
|
42
|
-
const options = await modules.products.findProducts({
|
|
43
|
-
productIds,
|
|
44
|
-
});
|
|
45
|
-
await Promise.all(options.map(this.calculatePriceForProduct));
|
|
46
|
-
return pricingAdapter.calculate();
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
ProductPricingDirector.registerAdapter(ProductPriceOptions);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type IProductPricingAdapter } from '@unchainedshop/core';
|
|
2
|
-
interface PriceRoundSettings {
|
|
3
|
-
defaultPrecision: number;
|
|
4
|
-
roundTo: (value: number, precision: number, currencyCode: string) => number;
|
|
5
|
-
}
|
|
6
|
-
export declare const ProductRound: IProductPricingAdapter & {
|
|
7
|
-
configure: (params: PriceRoundSettings) => void;
|
|
8
|
-
settings: PriceRoundSettings;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ProductPricingAdapter, ProductPricingDirector, } from '@unchainedshop/core';
|
|
2
|
-
export const ProductRound = {
|
|
3
|
-
...ProductPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.product-round',
|
|
5
|
-
version: '1.0.0',
|
|
6
|
-
label: 'Round product price',
|
|
7
|
-
orderIndex: 90,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
settings: {
|
|
12
|
-
defaultPrecision: 5,
|
|
13
|
-
roundTo: (value, precision) => Math.round(value / precision) * precision,
|
|
14
|
-
},
|
|
15
|
-
configure({ defaultPrecision, roundTo }) {
|
|
16
|
-
if (defaultPrecision)
|
|
17
|
-
this.settings.defaultPrecision = defaultPrecision;
|
|
18
|
-
if (roundTo)
|
|
19
|
-
this.settings.roundTo = roundTo;
|
|
20
|
-
},
|
|
21
|
-
actions: (params) => {
|
|
22
|
-
const pricingAdapter = ProductPricingAdapter.actions(params);
|
|
23
|
-
return {
|
|
24
|
-
...pricingAdapter,
|
|
25
|
-
calculate: async () => {
|
|
26
|
-
const { currencyCode } = params.context;
|
|
27
|
-
const { defaultPrecision, roundTo } = ProductRound.settings;
|
|
28
|
-
const { calculation = [] } = params.calculationSheet;
|
|
29
|
-
if (calculation?.length) {
|
|
30
|
-
pricingAdapter.resultSheet().resetCalculation(params.calculationSheet);
|
|
31
|
-
calculation.forEach((item) => {
|
|
32
|
-
const newAmount = roundTo(item.amount, defaultPrecision, currencyCode);
|
|
33
|
-
pricingAdapter.resultSheet().calculation.push({
|
|
34
|
-
...item,
|
|
35
|
-
amount: newAmount,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return pricingAdapter.calculate();
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
ProductPricingDirector.registerAdapter(ProductRound);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/worker/bulkgate.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/worker/email.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const checkEmailInterceptionEnabled: () => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const configureGenerateOrderAutoscheduling: () => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/worker/twilio.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|