@unchainedshop/plugins 4.8.24 → 4.8.26
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/payment/stripe/stripe.js +1 -1
- package/lib/pricing/tax/ch-tax-rates.json +1 -1
- package/lib/pricing/tax/eraRates.d.ts +3 -2
- package/lib/pricing/tax/eraRates.js +34 -8
- package/lib/pricing/tax/eu-tax-rates.json +33 -1
- package/lib/pricing/tax/eu.js +1 -1
- package/lib/pricing/tax/uk-tax-rates.json +1 -1
- package/lib/pricing/tax/us-tax-rates.json +63 -3
- package/lib/pricing/tax/us.js +1 -1
- package/package.json +1 -1
- package/lib/delivery/post/adapter.d.ts +0 -2
- package/lib/delivery/post/adapter.js +0 -22
- package/lib/delivery/post/index.d.ts +0 -4
- package/lib/delivery/post/index.js +0 -10
- package/lib/delivery/send-message/adapter.d.ts +0 -2
- package/lib/delivery/send-message/adapter.js +0 -39
- package/lib/delivery/send-message/index.d.ts +0 -4
- package/lib/delivery/send-message/index.js +0 -10
- package/lib/delivery/stores/adapter.d.ts +0 -2
- package/lib/delivery/stores/adapter.js +0 -42
- package/lib/delivery/stores/index.d.ts +0 -4
- package/lib/delivery/stores/index.js +0 -10
- package/lib/enrollments/licensed/adapter.d.ts +0 -6
- package/lib/enrollments/licensed/adapter.js +0 -51
- package/lib/enrollments/licensed/index.d.ts +0 -4
- package/lib/enrollments/licensed/index.js +0 -10
- package/lib/files/gridfs/api.d.ts +0 -7
- package/lib/files/gridfs/api.js +0 -163
- package/lib/files/minio/adapter.d.ts +0 -4
- package/lib/files/minio/adapter.js +0 -160
- package/lib/files/minio/api.d.ts +0 -2
- package/lib/files/minio/api.js +0 -40
- package/lib/files/temp-upload/api.d.ts +0 -8
- package/lib/files/temp-upload/api.js +0 -48
- package/lib/files/temp-upload/index.d.ts +0 -3
- package/lib/files/temp-upload/index.js +0 -15
- package/lib/filters/local-search/adapter.d.ts +0 -2
- package/lib/filters/local-search/adapter.js +0 -56
- package/lib/filters/local-search/index.d.ts +0 -4
- package/lib/filters/local-search/index.js +0 -10
- package/lib/filters/strict-equal/adapter.d.ts +0 -2
- package/lib/filters/strict-equal/adapter.js +0 -23
- package/lib/filters/strict-equal/index.d.ts +0 -4
- package/lib/filters/strict-equal/index.js +0 -10
- package/lib/payment/apple-iap/api.d.ts +0 -2
- package/lib/payment/apple-iap/api.js +0 -119
- package/lib/payment/cryptopay/adapter.d.ts +0 -2
- package/lib/payment/cryptopay/adapter.js +0 -157
- package/lib/payment/cryptopay/api.d.ts +0 -2
- package/lib/payment/cryptopay/api.js +0 -23
- package/lib/payment/datatrans-v2/adapter.d.ts +0 -2
- package/lib/payment/datatrans-v2/adapter.js +0 -417
- package/lib/payment/datatrans-v2/api.d.ts +0 -2
- package/lib/payment/datatrans-v2/api.js +0 -108
- package/lib/payment/invoice/adapter.d.ts +0 -2
- package/lib/payment/invoice/adapter.js +0 -26
- package/lib/payment/invoice/index.d.ts +0 -4
- package/lib/payment/invoice/index.js +0 -10
- package/lib/payment/invoice-prepaid/adapter.d.ts +0 -2
- package/lib/payment/invoice-prepaid/adapter.js +0 -29
- package/lib/payment/invoice-prepaid/index.d.ts +0 -4
- package/lib/payment/invoice-prepaid/index.js +0 -10
- package/lib/payment/payrexx/adapter.d.ts +0 -2
- package/lib/payment/payrexx/adapter.js +0 -161
- package/lib/payment/payrexx/api.d.ts +0 -2
- package/lib/payment/payrexx/api.js +0 -97
- package/lib/payment/postfinance-checkout/adapter.d.ts +0 -2
- package/lib/payment/postfinance-checkout/adapter.js +0 -189
- package/lib/payment/postfinance-checkout/webhook.d.ts +0 -2
- package/lib/payment/postfinance-checkout/webhook.js +0 -48
- package/lib/payment/saferpay/webhook.d.ts +0 -2
- package/lib/payment/saferpay/webhook.js +0 -64
- package/lib/payment/stripe/adapter.d.ts +0 -2
- package/lib/payment/stripe/adapter.js +0 -121
- package/lib/payment/stripe/api.d.ts +0 -6
- package/lib/payment/stripe/api.js +0 -165
- package/lib/pricing/delivery-eu-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-eu-tax/adapter.js +0 -55
- package/lib/pricing/delivery-eu-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-eu-tax/index.js +0 -10
- package/lib/pricing/delivery-swiss-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-swiss-tax/adapter.js +0 -43
- package/lib/pricing/delivery-swiss-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-swiss-tax/index.js +0 -10
- package/lib/pricing/delivery-uk-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-uk-tax/adapter.js +0 -43
- package/lib/pricing/delivery-uk-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-uk-tax/index.js +0 -10
- package/lib/pricing/delivery-us-sales-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-us-sales-tax/adapter.js +0 -58
- package/lib/pricing/delivery-us-sales-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-us-sales-tax/index.js +0 -10
- package/lib/pricing/discount-100-off/adapter.d.ts +0 -3
- package/lib/pricing/discount-100-off/adapter.js +0 -30
- package/lib/pricing/discount-100-off/index.d.ts +0 -4
- package/lib/pricing/discount-100-off/index.js +0 -10
- package/lib/pricing/discount-half-price-manual/adapter.d.ts +0 -3
- package/lib/pricing/discount-half-price-manual/adapter.js +0 -30
- package/lib/pricing/discount-half-price-manual/index.d.ts +0 -4
- package/lib/pricing/discount-half-price-manual/index.js +0 -10
- package/lib/pricing/free-delivery/adapter.d.ts +0 -3
- package/lib/pricing/free-delivery/adapter.js +0 -27
- package/lib/pricing/free-delivery/index.d.ts +0 -4
- package/lib/pricing/free-delivery/index.js +0 -10
- package/lib/pricing/free-payment/adapter.d.ts +0 -3
- package/lib/pricing/free-payment/adapter.js +0 -27
- package/lib/pricing/free-payment/index.d.ts +0 -4
- package/lib/pricing/free-payment/index.js +0 -10
- package/lib/pricing/order-delivery/adapter.d.ts +0 -3
- package/lib/pricing/order-delivery/adapter.js +0 -33
- package/lib/pricing/order-delivery/index.d.ts +0 -4
- package/lib/pricing/order-delivery/index.js +0 -10
- package/lib/pricing/order-discount/adapter.d.ts +0 -3
- package/lib/pricing/order-discount/adapter.js +0 -74
- package/lib/pricing/order-discount/index.d.ts +0 -4
- package/lib/pricing/order-discount/index.js +0 -10
- package/lib/pricing/order-items/adapter.d.ts +0 -3
- package/lib/pricing/order-items/adapter.js +0 -43
- package/lib/pricing/order-items/index.d.ts +0 -4
- package/lib/pricing/order-items/index.js +0 -10
- package/lib/pricing/order-payment/adapter.d.ts +0 -3
- package/lib/pricing/order-payment/adapter.js +0 -33
- package/lib/pricing/order-payment/index.d.ts +0 -4
- package/lib/pricing/order-payment/index.js +0 -10
- package/lib/pricing/product-catalog-price/adapter.d.ts +0 -3
- package/lib/pricing/product-catalog-price/adapter.js +0 -60
- package/lib/pricing/product-catalog-price/index.d.ts +0 -4
- package/lib/pricing/product-catalog-price/index.js +0 -10
- package/lib/pricing/product-discount/adapter.d.ts +0 -3
- package/lib/pricing/product-discount/adapter.js +0 -69
- package/lib/pricing/product-discount/index.d.ts +0 -4
- package/lib/pricing/product-discount/index.js +0 -10
- package/lib/pricing/product-eu-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-eu-tax/adapter.js +0 -56
- package/lib/pricing/product-eu-tax/index.d.ts +0 -4
- package/lib/pricing/product-eu-tax/index.js +0 -10
- package/lib/pricing/product-price-rateconversion/adapter.d.ts +0 -3
- package/lib/pricing/product-price-rateconversion/adapter.js +0 -53
- package/lib/pricing/product-price-rateconversion/index.d.ts +0 -4
- package/lib/pricing/product-price-rateconversion/index.js +0 -10
- package/lib/pricing/product-quotation-price.d.ts +0 -2
- package/lib/pricing/product-quotation-price.js +0 -40
- package/lib/pricing/product-swiss-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-swiss-tax/adapter.js +0 -57
- package/lib/pricing/product-swiss-tax/index.d.ts +0 -4
- package/lib/pricing/product-swiss-tax/index.js +0 -10
- package/lib/pricing/product-uk-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-uk-tax/adapter.js +0 -57
- package/lib/pricing/product-uk-tax/index.d.ts +0 -4
- package/lib/pricing/product-uk-tax/index.js +0 -10
- package/lib/pricing/product-us-sales-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-us-sales-tax/adapter.js +0 -52
- package/lib/pricing/product-us-sales-tax/index.d.ts +0 -4
- package/lib/pricing/product-us-sales-tax/index.js +0 -10
- package/lib/quotations/manual/adapter.d.ts +0 -2
- package/lib/quotations/manual/adapter.js +0 -24
- package/lib/quotations/manual/index.d.ts +0 -4
- package/lib/quotations/manual/index.js +0 -10
- package/lib/warehousing/erc-metadata/api.d.ts +0 -12
- package/lib/warehousing/erc-metadata/api.js +0 -43
- package/lib/warehousing/erc-metadata/index.d.ts +0 -3
- package/lib/warehousing/erc-metadata/index.js +0 -15
- package/lib/warehousing/eth-minter/adapter.d.ts +0 -2
- package/lib/warehousing/eth-minter/adapter.js +0 -119
- package/lib/warehousing/eth-minter/index.d.ts +0 -4
- package/lib/warehousing/eth-minter/index.js +0 -10
- package/lib/warehousing/store/adapter.d.ts +0 -2
- package/lib/warehousing/store/adapter.js +0 -33
- package/lib/warehousing/store/index.d.ts +0 -4
- package/lib/warehousing/store/index.js +0 -10
- package/lib/worker/budgetsms/adapter.d.ts +0 -22
- package/lib/worker/budgetsms/adapter.js +0 -169
- package/lib/worker/budgetsms/index.d.ts +0 -4
- package/lib/worker/budgetsms/index.js +0 -10
- package/lib/worker/bulk-export/adapter.d.ts +0 -3
- package/lib/worker/bulk-export/adapter.js +0 -64
- package/lib/worker/bulk-export/index.d.ts +0 -4
- package/lib/worker/bulk-export/index.js +0 -10
- package/lib/worker/bulk-import/adapter.d.ts +0 -3
- package/lib/worker/bulk-import/adapter.js +0 -65
- package/lib/worker/bulk-import/api.d.ts +0 -9
- package/lib/worker/bulk-import/api.js +0 -52
- package/lib/worker/bulk-import/index.d.ts +0 -4
- package/lib/worker/bulk-import/index.js +0 -18
- package/lib/worker/bulkgate/adapter.d.ts +0 -12
- package/lib/worker/bulkgate/adapter.js +0 -91
- package/lib/worker/bulkgate/index.d.ts +0 -4
- package/lib/worker/bulkgate/index.js +0 -10
- package/lib/worker/email/adapter.d.ts +0 -9
- package/lib/worker/email/adapter.js +0 -150
- package/lib/worker/email/index.d.ts +0 -4
- package/lib/worker/email/index.js +0 -10
- package/lib/worker/enrollment-order-generator/adapter.d.ts +0 -4
- package/lib/worker/enrollment-order-generator/adapter.js +0 -77
- package/lib/worker/enrollment-order-generator/index.d.ts +0 -4
- package/lib/worker/enrollment-order-generator/index.js +0 -13
- package/lib/worker/error-notifications/adapter.d.ts +0 -10
- package/lib/worker/error-notifications/adapter.js +0 -62
- package/lib/worker/error-notifications/index.d.ts +0 -4
- package/lib/worker/error-notifications/index.js +0 -13
- package/lib/worker/export-token/adapter.d.ts +0 -4
- package/lib/worker/export-token/adapter.js +0 -25
- package/lib/worker/export-token/index.d.ts +0 -4
- package/lib/worker/export-token/index.js +0 -13
- package/lib/worker/external/adapter.d.ts +0 -3
- package/lib/worker/external/adapter.js +0 -13
- package/lib/worker/external/index.d.ts +0 -4
- package/lib/worker/external/index.js +0 -10
- package/lib/worker/gc-guests/adapter.d.ts +0 -9
- package/lib/worker/gc-guests/adapter.js +0 -56
- package/lib/worker/gc-guests/index.d.ts +0 -4
- package/lib/worker/gc-guests/index.js +0 -13
- package/lib/worker/heartbeat/adapter.d.ts +0 -8
- package/lib/worker/heartbeat/adapter.js +0 -26
- package/lib/worker/heartbeat/index.d.ts +0 -4
- package/lib/worker/heartbeat/index.js +0 -10
- package/lib/worker/http-request/adapter.d.ts +0 -8
- package/lib/worker/http-request/adapter.js +0 -55
- package/lib/worker/http-request/index.d.ts +0 -4
- package/lib/worker/http-request/index.js +0 -10
- package/lib/worker/invalidate-carts/adapter.d.ts +0 -9
- package/lib/worker/invalidate-carts/adapter.js +0 -52
- package/lib/worker/invalidate-carts/index.d.ts +0 -4
- package/lib/worker/invalidate-carts/index.js +0 -13
- package/lib/worker/message/adapter.d.ts +0 -11
- package/lib/worker/message/adapter.js +0 -42
- package/lib/worker/message/index.d.ts +0 -4
- package/lib/worker/message/index.js +0 -10
- package/lib/worker/push-notification/adapter.d.ts +0 -9
- package/lib/worker/push-notification/adapter.js +0 -87
- package/lib/worker/push-notification/index.d.ts +0 -4
- package/lib/worker/push-notification/index.js +0 -10
- package/lib/worker/twilio/adapter.d.ts +0 -8
- package/lib/worker/twilio/adapter.js +0 -59
- package/lib/worker/twilio/index.d.ts +0 -4
- package/lib/worker/twilio/index.js +0 -10
- package/lib/worker/update-coinbase-rates/adapter.d.ts +0 -4
- package/lib/worker/update-coinbase-rates/adapter.js +0 -59
- package/lib/worker/update-coinbase-rates/index.d.ts +0 -4
- package/lib/worker/update-coinbase-rates/index.js +0 -13
- package/lib/worker/update-ecb-rates/adapter.d.ts +0 -4
- package/lib/worker/update-ecb-rates/adapter.js +0 -94
- package/lib/worker/update-ecb-rates/index.d.ts +0 -4
- package/lib/worker/update-ecb-rates/index.js +0 -13
- package/lib/worker/update-token-ownership/adapter.d.ts +0 -5
- package/lib/worker/update-token-ownership/adapter.js +0 -58
- package/lib/worker/update-token-ownership/index.d.ts +0 -4
- package/lib/worker/update-token-ownership/index.js +0 -13
- package/lib/worker/zombie-killer/adapter.d.ts +0 -15
- package/lib/worker/zombie-killer/adapter.js +0 -113
- package/lib/worker/zombie-killer/index.d.ts +0 -4
- package/lib/worker/zombie-killer/index.js +0 -13
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { OrderDiscountAdapter, } from '@unchainedshop/core';
|
|
2
|
-
export const HalfPriceManual = {
|
|
3
|
-
...OrderDiscountAdapter,
|
|
4
|
-
key: 'shop.unchained.discount.half-price-manual',
|
|
5
|
-
label: 'Half Price Manual',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
orderIndex: 10,
|
|
8
|
-
isManualAdditionAllowed: async () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
isManualRemovalAllowed: async () => {
|
|
12
|
-
return true;
|
|
13
|
-
},
|
|
14
|
-
actions: async ({ context }) => ({
|
|
15
|
-
...(await OrderDiscountAdapter.actions({ context })),
|
|
16
|
-
isValidForSystemTriggering: async () => {
|
|
17
|
-
return false;
|
|
18
|
-
},
|
|
19
|
-
isValidForCodeTriggering: async ({ code }) => {
|
|
20
|
-
return code === 'HALFPRICE';
|
|
21
|
-
},
|
|
22
|
-
discountForPricingAdapterKey({ pricingAdapterKey }) {
|
|
23
|
-
if (pricingAdapterKey === 'shop.unchained.pricing.product-discount') {
|
|
24
|
-
return { rate: 0.5 };
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
export default HalfPriceManual;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { HalfPriceManual } from "./adapter.js";
|
|
3
|
-
export const HalfPriceManualPlugin = {
|
|
4
|
-
key: 'shop.unchained.discount.half-price-manual',
|
|
5
|
-
label: 'Half Price Manual Discount Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [HalfPriceManual],
|
|
8
|
-
};
|
|
9
|
-
export default HalfPriceManualPlugin;
|
|
10
|
-
export { HalfPriceManual } from "./adapter.js";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { DeliveryPricingAdapter } from '@unchainedshop/core';
|
|
2
|
-
export const DeliveryFreePrice = {
|
|
3
|
-
...DeliveryPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.delivery-free',
|
|
5
|
-
label: 'Free Delivery',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
orderIndex: 0,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = DeliveryPricingAdapter.actions(params);
|
|
13
|
-
return {
|
|
14
|
-
...pricingAdapter,
|
|
15
|
-
calculate: async () => {
|
|
16
|
-
pricingAdapter.resultSheet().addFee({
|
|
17
|
-
amount: 0,
|
|
18
|
-
isTaxable: false,
|
|
19
|
-
isNetPrice: false,
|
|
20
|
-
meta: { adapter: DeliveryFreePrice.key },
|
|
21
|
-
});
|
|
22
|
-
return pricingAdapter.calculate();
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export default DeliveryFreePrice;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { DeliveryFreePrice } from "./adapter.js";
|
|
3
|
-
export const DeliveryFreePricePlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.delivery-free',
|
|
5
|
-
label: 'Free Delivery Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [DeliveryFreePrice],
|
|
8
|
-
};
|
|
9
|
-
export default DeliveryFreePricePlugin;
|
|
10
|
-
export { DeliveryFreePrice } from "./adapter.js";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PaymentPricingAdapter } from '@unchainedshop/core';
|
|
2
|
-
export const PaymentFreePrice = {
|
|
3
|
-
...PaymentPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.payment-free',
|
|
5
|
-
label: 'Free Payment',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
orderIndex: 0,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = PaymentPricingAdapter.actions(params);
|
|
13
|
-
return {
|
|
14
|
-
...pricingAdapter,
|
|
15
|
-
calculate: async () => {
|
|
16
|
-
pricingAdapter.resultSheet().addFee({
|
|
17
|
-
amount: 0,
|
|
18
|
-
isNetPrice: false,
|
|
19
|
-
isTaxable: false,
|
|
20
|
-
meta: { adapter: PaymentFreePrice.key },
|
|
21
|
-
});
|
|
22
|
-
return pricingAdapter.calculate();
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export default PaymentFreePrice;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { PaymentFreePrice } from "./adapter.js";
|
|
3
|
-
export const PaymentFreePricePlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.payment-free',
|
|
5
|
-
label: 'Free Payment Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [PaymentFreePrice],
|
|
8
|
-
};
|
|
9
|
-
export default PaymentFreePricePlugin;
|
|
10
|
-
export { PaymentFreePrice } from "./adapter.js";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { OrderPricingAdapter, DeliveryPricingSheet, } from '@unchainedshop/core';
|
|
2
|
-
export const OrderDelivery = {
|
|
3
|
-
...OrderPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.order-delivery',
|
|
5
|
-
version: '1.0.0',
|
|
6
|
-
label: 'Add Delivery Fees to Order',
|
|
7
|
-
orderIndex: 10,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = OrderPricingAdapter.actions(params);
|
|
13
|
-
const { order, orderDelivery } = params.context;
|
|
14
|
-
return {
|
|
15
|
-
...pricingAdapter,
|
|
16
|
-
calculate: async () => {
|
|
17
|
-
if (!orderDelivery)
|
|
18
|
-
return null;
|
|
19
|
-
const pricing = DeliveryPricingSheet({
|
|
20
|
-
calculation: orderDelivery.calculation,
|
|
21
|
-
currencyCode: order.currencyCode,
|
|
22
|
-
});
|
|
23
|
-
const tax = pricing.taxSum();
|
|
24
|
-
const shipping = pricing.gross();
|
|
25
|
-
pricingAdapter
|
|
26
|
-
.resultSheet()
|
|
27
|
-
.addDelivery({ amount: shipping, taxAmount: tax, meta: { adapter: OrderDelivery.key } });
|
|
28
|
-
return pricingAdapter.calculate();
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
export default OrderDelivery;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { OrderDelivery } from "./adapter.js";
|
|
3
|
-
export const OrderDeliveryPlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.order-delivery',
|
|
5
|
-
label: 'Order Delivery Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [OrderDelivery],
|
|
8
|
-
};
|
|
9
|
-
export default OrderDeliveryPlugin;
|
|
10
|
-
export { OrderDelivery } from "./adapter.js";
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { OrderPricingRowCategory, OrderPricingAdapter, DeliveryPricingSheet, PaymentPricingSheet, ProductPricingSheet, resolveRatioAndTaxDivisorForPricingSheet, } from '@unchainedshop/core';
|
|
2
|
-
import { calculation as calcUtils } from '@unchainedshop/utils';
|
|
3
|
-
export const OrderDiscount = {
|
|
4
|
-
...OrderPricingAdapter,
|
|
5
|
-
key: 'shop.unchained.pricing.order-discount',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
label: 'Apply Discounts on Total Order Value',
|
|
8
|
-
orderIndex: 40,
|
|
9
|
-
isActivatedFor: () => {
|
|
10
|
-
return true;
|
|
11
|
-
},
|
|
12
|
-
actions: (params) => {
|
|
13
|
-
const pricingAdapter = OrderPricingAdapter.actions(params);
|
|
14
|
-
const { order, orderDelivery, orderPositions, orderPayment } = params.context;
|
|
15
|
-
return {
|
|
16
|
-
...pricingAdapter,
|
|
17
|
-
calculate: async () => {
|
|
18
|
-
if (!order)
|
|
19
|
-
return pricingAdapter.calculate();
|
|
20
|
-
const totalAmountOfItems = params.calculationSheet.total({
|
|
21
|
-
category: OrderPricingRowCategory.Items,
|
|
22
|
-
useNetPrice: false,
|
|
23
|
-
}).amount;
|
|
24
|
-
const totalAmountOfPaymentAndDelivery = params.calculationSheet.total({
|
|
25
|
-
category: OrderPricingRowCategory.Payment,
|
|
26
|
-
useNetPrice: false,
|
|
27
|
-
}).amount +
|
|
28
|
-
params.calculationSheet.total({
|
|
29
|
-
category: OrderPricingRowCategory.Delivery,
|
|
30
|
-
useNetPrice: false,
|
|
31
|
-
}).amount;
|
|
32
|
-
const itemShares = orderPositions.map((orderPosition) => resolveRatioAndTaxDivisorForPricingSheet(ProductPricingSheet({
|
|
33
|
-
calculation: orderPosition.calculation,
|
|
34
|
-
currencyCode: order.currencyCode,
|
|
35
|
-
quantity: orderPosition.quantity,
|
|
36
|
-
}), totalAmountOfItems));
|
|
37
|
-
const deliveryShare = resolveRatioAndTaxDivisorForPricingSheet(DeliveryPricingSheet({
|
|
38
|
-
calculation: orderDelivery?.calculation || [],
|
|
39
|
-
currencyCode: order.currencyCode,
|
|
40
|
-
}), totalAmountOfPaymentAndDelivery);
|
|
41
|
-
const paymentShare = resolveRatioAndTaxDivisorForPricingSheet(PaymentPricingSheet({
|
|
42
|
-
calculation: orderPayment?.calculation || [],
|
|
43
|
-
currencyCode: order.currencyCode,
|
|
44
|
-
}), totalAmountOfPaymentAndDelivery);
|
|
45
|
-
let amountLeft = totalAmountOfPaymentAndDelivery + totalAmountOfItems;
|
|
46
|
-
params.discounts.forEach(({ configuration, discountId }) => {
|
|
47
|
-
const leftInDiscountToSplit = calcUtils.calculateAmountToSplit({ ...configuration }, Math.min(totalAmountOfItems, amountLeft));
|
|
48
|
-
const [itemsDiscountAmount, itemsTaxAmount] = calcUtils.applyDiscountToMultipleShares(itemShares, Math.max(0, Math.min(amountLeft, leftInDiscountToSplit)));
|
|
49
|
-
amountLeft -= itemsDiscountAmount;
|
|
50
|
-
const fixedRate = Number(configuration.fixedRate) > 0
|
|
51
|
-
? Math.max(0, configuration.fixedRate - itemsDiscountAmount)
|
|
52
|
-
: undefined;
|
|
53
|
-
const leftInFeesToSplit = calcUtils.calculateAmountToSplit({ ...configuration, fixedRate }, Math.min(totalAmountOfPaymentAndDelivery, amountLeft));
|
|
54
|
-
const [deliveryAndPaymentDiscountAmount, deliveryAndPaymentTaxAmount] = calcUtils.applyDiscountToMultipleShares([deliveryShare, paymentShare], Math.max(0, Math.min(amountLeft, leftInFeesToSplit)));
|
|
55
|
-
amountLeft -= deliveryAndPaymentDiscountAmount;
|
|
56
|
-
const discountAmount = (itemsDiscountAmount + deliveryAndPaymentDiscountAmount) * -1;
|
|
57
|
-
const taxAmount = (itemsTaxAmount + deliveryAndPaymentTaxAmount) * -1;
|
|
58
|
-
if (discountAmount) {
|
|
59
|
-
pricingAdapter.resultSheet().addDiscount({
|
|
60
|
-
amount: discountAmount,
|
|
61
|
-
taxAmount,
|
|
62
|
-
discountId,
|
|
63
|
-
meta: {
|
|
64
|
-
adapter: OrderDiscount.key,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return pricingAdapter.calculate();
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
export default OrderDiscount;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { OrderDiscount } from "./adapter.js";
|
|
3
|
-
export const OrderDiscountPlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.order-discount',
|
|
5
|
-
label: 'Order Discount Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [OrderDiscount],
|
|
8
|
-
};
|
|
9
|
-
export default OrderDiscountPlugin;
|
|
10
|
-
export { OrderDiscount } from "./adapter.js";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { OrderPricingAdapter, ProductPricingSheet, } from '@unchainedshop/core';
|
|
2
|
-
export const OrderItems = {
|
|
3
|
-
...OrderPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.order-items',
|
|
5
|
-
version: '1.0.0',
|
|
6
|
-
label: 'Add Total Value Of Goods to Order',
|
|
7
|
-
orderIndex: 0,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = OrderPricingAdapter.actions(params);
|
|
13
|
-
const { order, orderPositions } = params.context;
|
|
14
|
-
return {
|
|
15
|
-
...pricingAdapter,
|
|
16
|
-
calculate: async () => {
|
|
17
|
-
const totalAndTaxesOfAllItems = orderPositions.reduce((current, orderPosition) => {
|
|
18
|
-
const pricing = ProductPricingSheet({
|
|
19
|
-
calculation: orderPosition.calculation,
|
|
20
|
-
currencyCode: order.currencyCode,
|
|
21
|
-
quantity: orderPosition.quantity,
|
|
22
|
-
});
|
|
23
|
-
const tax = pricing.taxSum();
|
|
24
|
-
const items = pricing.gross();
|
|
25
|
-
return {
|
|
26
|
-
taxes: current.taxes + tax,
|
|
27
|
-
items: current.items + items,
|
|
28
|
-
};
|
|
29
|
-
}, {
|
|
30
|
-
taxes: 0,
|
|
31
|
-
items: 0,
|
|
32
|
-
});
|
|
33
|
-
pricingAdapter.resultSheet().addItems({
|
|
34
|
-
amount: totalAndTaxesOfAllItems.items,
|
|
35
|
-
taxAmount: totalAndTaxesOfAllItems.taxes,
|
|
36
|
-
meta: { adapter: OrderItems.key },
|
|
37
|
-
});
|
|
38
|
-
return pricingAdapter.calculate();
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
export default OrderItems;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { OrderItems } from "./adapter.js";
|
|
3
|
-
export const OrderItemsPlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.order-items',
|
|
5
|
-
label: 'Order Items Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [OrderItems],
|
|
8
|
-
};
|
|
9
|
-
export default OrderItemsPlugin;
|
|
10
|
-
export { OrderItems } from "./adapter.js";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { OrderPricingAdapter, PaymentPricingSheet, } from '@unchainedshop/core';
|
|
2
|
-
export const OrderPayment = {
|
|
3
|
-
...OrderPricingAdapter,
|
|
4
|
-
key: 'shop.unchained.pricing.order-payment',
|
|
5
|
-
version: '1.0.0',
|
|
6
|
-
label: 'Add Payment Fees to Order',
|
|
7
|
-
orderIndex: 10,
|
|
8
|
-
isActivatedFor: () => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
actions: (params) => {
|
|
12
|
-
const pricingAdapter = OrderPricingAdapter.actions(params);
|
|
13
|
-
const { order, orderPayment } = params.context;
|
|
14
|
-
return {
|
|
15
|
-
...pricingAdapter,
|
|
16
|
-
calculate: async () => {
|
|
17
|
-
if (!orderPayment)
|
|
18
|
-
return null;
|
|
19
|
-
const pricing = PaymentPricingSheet({
|
|
20
|
-
calculation: orderPayment.calculation,
|
|
21
|
-
currencyCode: order.currencyCode,
|
|
22
|
-
});
|
|
23
|
-
const tax = pricing.taxSum();
|
|
24
|
-
const paymentFees = pricing.gross();
|
|
25
|
-
pricingAdapter
|
|
26
|
-
.resultSheet()
|
|
27
|
-
.addPayment({ amount: paymentFees, taxAmount: tax, meta: { adapter: OrderPayment.key } });
|
|
28
|
-
return pricingAdapter.calculate();
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
export default OrderPayment;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { OrderPayment } from "./adapter.js";
|
|
3
|
-
export const OrderPaymentPlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.order-payment',
|
|
5
|
-
label: 'Order Payment Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [OrderPayment],
|
|
8
|
-
};
|
|
9
|
-
export default OrderPaymentPlugin;
|
|
10
|
-
export { OrderPayment } from "./adapter.js";
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ProductPricingAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { ProductType } from '@unchainedshop/core-products';
|
|
3
|
-
export const ProductPrice = {
|
|
4
|
-
...ProductPricingAdapter,
|
|
5
|
-
key: 'shop.unchained.pricing.product-price',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
label: 'Add Gross Price to Product',
|
|
8
|
-
orderIndex: 0,
|
|
9
|
-
isActivatedFor: () => {
|
|
10
|
-
return true;
|
|
11
|
-
},
|
|
12
|
-
actions: (params) => {
|
|
13
|
-
const pricingAdapter = ProductPricingAdapter.actions(params);
|
|
14
|
-
return {
|
|
15
|
-
...pricingAdapter,
|
|
16
|
-
calculate: async () => {
|
|
17
|
-
const { product, countryCode, currencyCode, quantity, modules } = params.context;
|
|
18
|
-
const price = await modules.products.prices.price(product, {
|
|
19
|
-
countryCode,
|
|
20
|
-
currencyCode,
|
|
21
|
-
quantity,
|
|
22
|
-
});
|
|
23
|
-
if (price) {
|
|
24
|
-
const itemTotal = price.amount * quantity;
|
|
25
|
-
pricingAdapter.resultSheet().addItem({
|
|
26
|
-
amount: itemTotal,
|
|
27
|
-
isTaxable: Boolean(price.isTaxable),
|
|
28
|
-
isNetPrice: Boolean(price.isNetPrice),
|
|
29
|
-
meta: { adapter: ProductPrice.key },
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else if (product.type === ProductType.BUNDLE_PRODUCT) {
|
|
33
|
-
for (const bundleItem of product.bundleItems || []) {
|
|
34
|
-
const bundledProduct = await modules.products.findProduct({
|
|
35
|
-
productId: bundleItem.productId,
|
|
36
|
-
});
|
|
37
|
-
if (bundledProduct) {
|
|
38
|
-
const bundleItemPrice = await modules.products.prices.price(bundledProduct, {
|
|
39
|
-
countryCode,
|
|
40
|
-
currencyCode,
|
|
41
|
-
quantity: bundleItem.quantity * quantity,
|
|
42
|
-
});
|
|
43
|
-
if (bundleItemPrice) {
|
|
44
|
-
const bundleItemTotal = bundleItemPrice.amount * bundleItem.quantity * quantity;
|
|
45
|
-
pricingAdapter.resultSheet().addItem({
|
|
46
|
-
amount: bundleItemTotal,
|
|
47
|
-
isTaxable: Boolean(bundleItemPrice.isTaxable),
|
|
48
|
-
isNetPrice: Boolean(bundleItemPrice.isNetPrice),
|
|
49
|
-
meta: { adapter: ProductPrice.key },
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return pricingAdapter.calculate();
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
export default ProductPrice;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { ProductPrice } from "./adapter.js";
|
|
3
|
-
export const ProductPricePlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.product-catalog',
|
|
5
|
-
label: 'Product Catalog Price Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [ProductPrice],
|
|
8
|
-
};
|
|
9
|
-
export default ProductPricePlugin;
|
|
10
|
-
export { ProductPrice } from "./adapter.js";
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { calculation as calcUtils } from '@unchainedshop/utils';
|
|
2
|
-
import { ProductPricingAdapter, ProductPricingRowCategory, } from '@unchainedshop/core';
|
|
3
|
-
export const ProductDiscount = {
|
|
4
|
-
...ProductPricingAdapter,
|
|
5
|
-
key: 'shop.unchained.pricing.product-discount',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
label: 'Apply Discounts on Product Price',
|
|
8
|
-
orderIndex: 30,
|
|
9
|
-
isActivatedFor: () => {
|
|
10
|
-
return true;
|
|
11
|
-
},
|
|
12
|
-
actions: (params) => {
|
|
13
|
-
const pricingAdapter = ProductPricingAdapter.actions(params);
|
|
14
|
-
const addDiscounts = (discount, total, resolvedConfiguration) => {
|
|
15
|
-
const { discountId } = discount;
|
|
16
|
-
const { isNetPrice = false, taxRate, ...meta } = resolvedConfiguration;
|
|
17
|
-
const amount = calcUtils.applyRate(resolvedConfiguration, total);
|
|
18
|
-
const isTaxable = taxRate === undefined || taxRate === null;
|
|
19
|
-
pricingAdapter.resultSheet().addDiscount({
|
|
20
|
-
amount: amount * -1,
|
|
21
|
-
discountId,
|
|
22
|
-
isNetPrice,
|
|
23
|
-
isTaxable,
|
|
24
|
-
meta: { adapter: ProductDiscount.key, ...meta },
|
|
25
|
-
});
|
|
26
|
-
if (!isTaxable && taxRate) {
|
|
27
|
-
const taxAmount = calcUtils.getTaxAmount(amount, taxRate, isNetPrice);
|
|
28
|
-
pricingAdapter.resultSheet().addTax({
|
|
29
|
-
amount: taxAmount * -1,
|
|
30
|
-
rate: taxRate,
|
|
31
|
-
discountId,
|
|
32
|
-
baseCategory: ProductPricingRowCategory.Discount,
|
|
33
|
-
meta: { adapter: ProductDiscount.key, discountId, ...meta },
|
|
34
|
-
});
|
|
35
|
-
if (!isNetPrice) {
|
|
36
|
-
pricingAdapter.resultSheet().addDiscount({
|
|
37
|
-
amount: taxAmount,
|
|
38
|
-
discountId,
|
|
39
|
-
isNetPrice: false,
|
|
40
|
-
isTaxable: false,
|
|
41
|
-
meta: { adapter: ProductDiscount.key, discountId, ...meta },
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
...pricingAdapter,
|
|
48
|
-
calculate: async () => {
|
|
49
|
-
params.discounts.forEach((discount) => {
|
|
50
|
-
if (!discount)
|
|
51
|
-
return;
|
|
52
|
-
const { configuration } = discount;
|
|
53
|
-
const resolvedConfiguration = configuration.customPriceConfigurationResolver
|
|
54
|
-
? configuration.customPriceConfigurationResolver(params.context.product, params.context.quantity, params.context.configuration)
|
|
55
|
-
: configuration;
|
|
56
|
-
if (!resolvedConfiguration)
|
|
57
|
-
return;
|
|
58
|
-
const total = params.calculationSheet.total({
|
|
59
|
-
category: ProductPricingRowCategory.Item,
|
|
60
|
-
useNetPrice: resolvedConfiguration.isNetPrice,
|
|
61
|
-
});
|
|
62
|
-
addDiscounts(discount, total.amount, resolvedConfiguration);
|
|
63
|
-
});
|
|
64
|
-
return pricingAdapter.calculate();
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
export default ProductDiscount;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { ProductDiscount } from "./adapter.js";
|
|
3
|
-
export const ProductDiscountPlugin = {
|
|
4
|
-
key: 'shop.unchained.pricing.product-discount',
|
|
5
|
-
label: 'Product Discount Pricing Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [ProductDiscount],
|
|
8
|
-
};
|
|
9
|
-
export default ProductDiscountPlugin;
|
|
10
|
-
export { ProductDiscount } from "./adapter.js";
|