@unchainedshop/plugins 4.8.25 → 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.
Files changed (251) hide show
  1. package/lib/pricing/tax/ch-tax-rates.json +1 -1
  2. package/lib/pricing/tax/eraRates.d.ts +3 -2
  3. package/lib/pricing/tax/eraRates.js +34 -8
  4. package/lib/pricing/tax/eu-tax-rates.json +33 -1
  5. package/lib/pricing/tax/eu.js +1 -1
  6. package/lib/pricing/tax/uk-tax-rates.json +1 -1
  7. package/lib/pricing/tax/us-tax-rates.json +63 -3
  8. package/lib/pricing/tax/us.js +1 -1
  9. package/package.json +1 -1
  10. package/lib/delivery/post/adapter.d.ts +0 -2
  11. package/lib/delivery/post/adapter.js +0 -22
  12. package/lib/delivery/post/index.d.ts +0 -4
  13. package/lib/delivery/post/index.js +0 -10
  14. package/lib/delivery/send-message/adapter.d.ts +0 -2
  15. package/lib/delivery/send-message/adapter.js +0 -39
  16. package/lib/delivery/send-message/index.d.ts +0 -4
  17. package/lib/delivery/send-message/index.js +0 -10
  18. package/lib/delivery/stores/adapter.d.ts +0 -2
  19. package/lib/delivery/stores/adapter.js +0 -42
  20. package/lib/delivery/stores/index.d.ts +0 -4
  21. package/lib/delivery/stores/index.js +0 -10
  22. package/lib/enrollments/licensed/adapter.d.ts +0 -6
  23. package/lib/enrollments/licensed/adapter.js +0 -51
  24. package/lib/enrollments/licensed/index.d.ts +0 -4
  25. package/lib/enrollments/licensed/index.js +0 -10
  26. package/lib/files/gridfs/api.d.ts +0 -7
  27. package/lib/files/gridfs/api.js +0 -163
  28. package/lib/files/minio/adapter.d.ts +0 -4
  29. package/lib/files/minio/adapter.js +0 -160
  30. package/lib/files/minio/api.d.ts +0 -2
  31. package/lib/files/minio/api.js +0 -40
  32. package/lib/files/temp-upload/api.d.ts +0 -8
  33. package/lib/files/temp-upload/api.js +0 -48
  34. package/lib/files/temp-upload/index.d.ts +0 -3
  35. package/lib/files/temp-upload/index.js +0 -15
  36. package/lib/filters/local-search/adapter.d.ts +0 -2
  37. package/lib/filters/local-search/adapter.js +0 -56
  38. package/lib/filters/local-search/index.d.ts +0 -4
  39. package/lib/filters/local-search/index.js +0 -10
  40. package/lib/filters/strict-equal/adapter.d.ts +0 -2
  41. package/lib/filters/strict-equal/adapter.js +0 -23
  42. package/lib/filters/strict-equal/index.d.ts +0 -4
  43. package/lib/filters/strict-equal/index.js +0 -10
  44. package/lib/payment/apple-iap/api.d.ts +0 -2
  45. package/lib/payment/apple-iap/api.js +0 -119
  46. package/lib/payment/cryptopay/adapter.d.ts +0 -2
  47. package/lib/payment/cryptopay/adapter.js +0 -157
  48. package/lib/payment/cryptopay/api.d.ts +0 -2
  49. package/lib/payment/cryptopay/api.js +0 -23
  50. package/lib/payment/datatrans-v2/adapter.d.ts +0 -2
  51. package/lib/payment/datatrans-v2/adapter.js +0 -417
  52. package/lib/payment/datatrans-v2/api.d.ts +0 -2
  53. package/lib/payment/datatrans-v2/api.js +0 -108
  54. package/lib/payment/invoice/adapter.d.ts +0 -2
  55. package/lib/payment/invoice/adapter.js +0 -26
  56. package/lib/payment/invoice/index.d.ts +0 -4
  57. package/lib/payment/invoice/index.js +0 -10
  58. package/lib/payment/invoice-prepaid/adapter.d.ts +0 -2
  59. package/lib/payment/invoice-prepaid/adapter.js +0 -29
  60. package/lib/payment/invoice-prepaid/index.d.ts +0 -4
  61. package/lib/payment/invoice-prepaid/index.js +0 -10
  62. package/lib/payment/payrexx/adapter.d.ts +0 -2
  63. package/lib/payment/payrexx/adapter.js +0 -161
  64. package/lib/payment/payrexx/api.d.ts +0 -2
  65. package/lib/payment/payrexx/api.js +0 -97
  66. package/lib/payment/postfinance-checkout/adapter.d.ts +0 -2
  67. package/lib/payment/postfinance-checkout/adapter.js +0 -189
  68. package/lib/payment/postfinance-checkout/webhook.d.ts +0 -2
  69. package/lib/payment/postfinance-checkout/webhook.js +0 -48
  70. package/lib/payment/saferpay/webhook.d.ts +0 -2
  71. package/lib/payment/saferpay/webhook.js +0 -64
  72. package/lib/payment/stripe/adapter.d.ts +0 -2
  73. package/lib/payment/stripe/adapter.js +0 -121
  74. package/lib/payment/stripe/api.d.ts +0 -6
  75. package/lib/payment/stripe/api.js +0 -165
  76. package/lib/pricing/delivery-eu-tax/adapter.d.ts +0 -3
  77. package/lib/pricing/delivery-eu-tax/adapter.js +0 -55
  78. package/lib/pricing/delivery-eu-tax/index.d.ts +0 -4
  79. package/lib/pricing/delivery-eu-tax/index.js +0 -10
  80. package/lib/pricing/delivery-swiss-tax/adapter.d.ts +0 -3
  81. package/lib/pricing/delivery-swiss-tax/adapter.js +0 -43
  82. package/lib/pricing/delivery-swiss-tax/index.d.ts +0 -4
  83. package/lib/pricing/delivery-swiss-tax/index.js +0 -10
  84. package/lib/pricing/delivery-uk-tax/adapter.d.ts +0 -3
  85. package/lib/pricing/delivery-uk-tax/adapter.js +0 -43
  86. package/lib/pricing/delivery-uk-tax/index.d.ts +0 -4
  87. package/lib/pricing/delivery-uk-tax/index.js +0 -10
  88. package/lib/pricing/delivery-us-sales-tax/adapter.d.ts +0 -3
  89. package/lib/pricing/delivery-us-sales-tax/adapter.js +0 -58
  90. package/lib/pricing/delivery-us-sales-tax/index.d.ts +0 -4
  91. package/lib/pricing/delivery-us-sales-tax/index.js +0 -10
  92. package/lib/pricing/discount-100-off/adapter.d.ts +0 -3
  93. package/lib/pricing/discount-100-off/adapter.js +0 -30
  94. package/lib/pricing/discount-100-off/index.d.ts +0 -4
  95. package/lib/pricing/discount-100-off/index.js +0 -10
  96. package/lib/pricing/discount-half-price-manual/adapter.d.ts +0 -3
  97. package/lib/pricing/discount-half-price-manual/adapter.js +0 -30
  98. package/lib/pricing/discount-half-price-manual/index.d.ts +0 -4
  99. package/lib/pricing/discount-half-price-manual/index.js +0 -10
  100. package/lib/pricing/free-delivery/adapter.d.ts +0 -3
  101. package/lib/pricing/free-delivery/adapter.js +0 -27
  102. package/lib/pricing/free-delivery/index.d.ts +0 -4
  103. package/lib/pricing/free-delivery/index.js +0 -10
  104. package/lib/pricing/free-payment/adapter.d.ts +0 -3
  105. package/lib/pricing/free-payment/adapter.js +0 -27
  106. package/lib/pricing/free-payment/index.d.ts +0 -4
  107. package/lib/pricing/free-payment/index.js +0 -10
  108. package/lib/pricing/order-delivery/adapter.d.ts +0 -3
  109. package/lib/pricing/order-delivery/adapter.js +0 -33
  110. package/lib/pricing/order-delivery/index.d.ts +0 -4
  111. package/lib/pricing/order-delivery/index.js +0 -10
  112. package/lib/pricing/order-discount/adapter.d.ts +0 -3
  113. package/lib/pricing/order-discount/adapter.js +0 -74
  114. package/lib/pricing/order-discount/index.d.ts +0 -4
  115. package/lib/pricing/order-discount/index.js +0 -10
  116. package/lib/pricing/order-items/adapter.d.ts +0 -3
  117. package/lib/pricing/order-items/adapter.js +0 -43
  118. package/lib/pricing/order-items/index.d.ts +0 -4
  119. package/lib/pricing/order-items/index.js +0 -10
  120. package/lib/pricing/order-payment/adapter.d.ts +0 -3
  121. package/lib/pricing/order-payment/adapter.js +0 -33
  122. package/lib/pricing/order-payment/index.d.ts +0 -4
  123. package/lib/pricing/order-payment/index.js +0 -10
  124. package/lib/pricing/product-catalog-price/adapter.d.ts +0 -3
  125. package/lib/pricing/product-catalog-price/adapter.js +0 -60
  126. package/lib/pricing/product-catalog-price/index.d.ts +0 -4
  127. package/lib/pricing/product-catalog-price/index.js +0 -10
  128. package/lib/pricing/product-discount/adapter.d.ts +0 -3
  129. package/lib/pricing/product-discount/adapter.js +0 -69
  130. package/lib/pricing/product-discount/index.d.ts +0 -4
  131. package/lib/pricing/product-discount/index.js +0 -10
  132. package/lib/pricing/product-eu-tax/adapter.d.ts +0 -3
  133. package/lib/pricing/product-eu-tax/adapter.js +0 -56
  134. package/lib/pricing/product-eu-tax/index.d.ts +0 -4
  135. package/lib/pricing/product-eu-tax/index.js +0 -10
  136. package/lib/pricing/product-price-rateconversion/adapter.d.ts +0 -3
  137. package/lib/pricing/product-price-rateconversion/adapter.js +0 -53
  138. package/lib/pricing/product-price-rateconversion/index.d.ts +0 -4
  139. package/lib/pricing/product-price-rateconversion/index.js +0 -10
  140. package/lib/pricing/product-quotation-price.d.ts +0 -2
  141. package/lib/pricing/product-quotation-price.js +0 -40
  142. package/lib/pricing/product-swiss-tax/adapter.d.ts +0 -3
  143. package/lib/pricing/product-swiss-tax/adapter.js +0 -57
  144. package/lib/pricing/product-swiss-tax/index.d.ts +0 -4
  145. package/lib/pricing/product-swiss-tax/index.js +0 -10
  146. package/lib/pricing/product-uk-tax/adapter.d.ts +0 -3
  147. package/lib/pricing/product-uk-tax/adapter.js +0 -57
  148. package/lib/pricing/product-uk-tax/index.d.ts +0 -4
  149. package/lib/pricing/product-uk-tax/index.js +0 -10
  150. package/lib/pricing/product-us-sales-tax/adapter.d.ts +0 -3
  151. package/lib/pricing/product-us-sales-tax/adapter.js +0 -52
  152. package/lib/pricing/product-us-sales-tax/index.d.ts +0 -4
  153. package/lib/pricing/product-us-sales-tax/index.js +0 -10
  154. package/lib/quotations/manual/adapter.d.ts +0 -2
  155. package/lib/quotations/manual/adapter.js +0 -24
  156. package/lib/quotations/manual/index.d.ts +0 -4
  157. package/lib/quotations/manual/index.js +0 -10
  158. package/lib/warehousing/erc-metadata/api.d.ts +0 -12
  159. package/lib/warehousing/erc-metadata/api.js +0 -43
  160. package/lib/warehousing/erc-metadata/index.d.ts +0 -3
  161. package/lib/warehousing/erc-metadata/index.js +0 -15
  162. package/lib/warehousing/eth-minter/adapter.d.ts +0 -2
  163. package/lib/warehousing/eth-minter/adapter.js +0 -119
  164. package/lib/warehousing/eth-minter/index.d.ts +0 -4
  165. package/lib/warehousing/eth-minter/index.js +0 -10
  166. package/lib/warehousing/store/adapter.d.ts +0 -2
  167. package/lib/warehousing/store/adapter.js +0 -33
  168. package/lib/warehousing/store/index.d.ts +0 -4
  169. package/lib/warehousing/store/index.js +0 -10
  170. package/lib/worker/budgetsms/adapter.d.ts +0 -22
  171. package/lib/worker/budgetsms/adapter.js +0 -169
  172. package/lib/worker/budgetsms/index.d.ts +0 -4
  173. package/lib/worker/budgetsms/index.js +0 -10
  174. package/lib/worker/bulk-export/adapter.d.ts +0 -3
  175. package/lib/worker/bulk-export/adapter.js +0 -64
  176. package/lib/worker/bulk-export/index.d.ts +0 -4
  177. package/lib/worker/bulk-export/index.js +0 -10
  178. package/lib/worker/bulk-import/adapter.d.ts +0 -3
  179. package/lib/worker/bulk-import/adapter.js +0 -65
  180. package/lib/worker/bulk-import/api.d.ts +0 -9
  181. package/lib/worker/bulk-import/api.js +0 -52
  182. package/lib/worker/bulk-import/index.d.ts +0 -4
  183. package/lib/worker/bulk-import/index.js +0 -18
  184. package/lib/worker/bulkgate/adapter.d.ts +0 -12
  185. package/lib/worker/bulkgate/adapter.js +0 -91
  186. package/lib/worker/bulkgate/index.d.ts +0 -4
  187. package/lib/worker/bulkgate/index.js +0 -10
  188. package/lib/worker/email/adapter.d.ts +0 -9
  189. package/lib/worker/email/adapter.js +0 -150
  190. package/lib/worker/email/index.d.ts +0 -4
  191. package/lib/worker/email/index.js +0 -10
  192. package/lib/worker/enrollment-order-generator/adapter.d.ts +0 -4
  193. package/lib/worker/enrollment-order-generator/adapter.js +0 -77
  194. package/lib/worker/enrollment-order-generator/index.d.ts +0 -4
  195. package/lib/worker/enrollment-order-generator/index.js +0 -13
  196. package/lib/worker/error-notifications/adapter.d.ts +0 -10
  197. package/lib/worker/error-notifications/adapter.js +0 -62
  198. package/lib/worker/error-notifications/index.d.ts +0 -4
  199. package/lib/worker/error-notifications/index.js +0 -13
  200. package/lib/worker/export-token/adapter.d.ts +0 -4
  201. package/lib/worker/export-token/adapter.js +0 -25
  202. package/lib/worker/export-token/index.d.ts +0 -4
  203. package/lib/worker/export-token/index.js +0 -13
  204. package/lib/worker/external/adapter.d.ts +0 -3
  205. package/lib/worker/external/adapter.js +0 -13
  206. package/lib/worker/external/index.d.ts +0 -4
  207. package/lib/worker/external/index.js +0 -10
  208. package/lib/worker/gc-guests/adapter.d.ts +0 -9
  209. package/lib/worker/gc-guests/adapter.js +0 -56
  210. package/lib/worker/gc-guests/index.d.ts +0 -4
  211. package/lib/worker/gc-guests/index.js +0 -13
  212. package/lib/worker/heartbeat/adapter.d.ts +0 -8
  213. package/lib/worker/heartbeat/adapter.js +0 -26
  214. package/lib/worker/heartbeat/index.d.ts +0 -4
  215. package/lib/worker/heartbeat/index.js +0 -10
  216. package/lib/worker/http-request/adapter.d.ts +0 -8
  217. package/lib/worker/http-request/adapter.js +0 -55
  218. package/lib/worker/http-request/index.d.ts +0 -4
  219. package/lib/worker/http-request/index.js +0 -10
  220. package/lib/worker/invalidate-carts/adapter.d.ts +0 -9
  221. package/lib/worker/invalidate-carts/adapter.js +0 -52
  222. package/lib/worker/invalidate-carts/index.d.ts +0 -4
  223. package/lib/worker/invalidate-carts/index.js +0 -13
  224. package/lib/worker/message/adapter.d.ts +0 -11
  225. package/lib/worker/message/adapter.js +0 -42
  226. package/lib/worker/message/index.d.ts +0 -4
  227. package/lib/worker/message/index.js +0 -10
  228. package/lib/worker/push-notification/adapter.d.ts +0 -9
  229. package/lib/worker/push-notification/adapter.js +0 -87
  230. package/lib/worker/push-notification/index.d.ts +0 -4
  231. package/lib/worker/push-notification/index.js +0 -10
  232. package/lib/worker/twilio/adapter.d.ts +0 -8
  233. package/lib/worker/twilio/adapter.js +0 -59
  234. package/lib/worker/twilio/index.d.ts +0 -4
  235. package/lib/worker/twilio/index.js +0 -10
  236. package/lib/worker/update-coinbase-rates/adapter.d.ts +0 -4
  237. package/lib/worker/update-coinbase-rates/adapter.js +0 -59
  238. package/lib/worker/update-coinbase-rates/index.d.ts +0 -4
  239. package/lib/worker/update-coinbase-rates/index.js +0 -13
  240. package/lib/worker/update-ecb-rates/adapter.d.ts +0 -4
  241. package/lib/worker/update-ecb-rates/adapter.js +0 -94
  242. package/lib/worker/update-ecb-rates/index.d.ts +0 -4
  243. package/lib/worker/update-ecb-rates/index.js +0 -13
  244. package/lib/worker/update-token-ownership/adapter.d.ts +0 -5
  245. package/lib/worker/update-token-ownership/adapter.js +0 -58
  246. package/lib/worker/update-token-ownership/index.d.ts +0 -4
  247. package/lib/worker/update-token-ownership/index.js +0 -13
  248. package/lib/worker/zombie-killer/adapter.d.ts +0 -15
  249. package/lib/worker/zombie-killer/adapter.js +0 -113
  250. package/lib/worker/zombie-killer/index.d.ts +0 -4
  251. 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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const HalfPriceManualPlugin: IPlugin;
3
- export default HalfPriceManualPlugin;
4
- export { HalfPriceManual } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IDeliveryPricingAdapter } from '@unchainedshop/core';
2
- export declare const DeliveryFreePrice: IDeliveryPricingAdapter;
3
- export default DeliveryFreePrice;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const DeliveryFreePricePlugin: IPlugin;
3
- export default DeliveryFreePricePlugin;
4
- export { DeliveryFreePrice } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IPaymentPricingAdapter } from '@unchainedshop/core';
2
- export declare const PaymentFreePrice: IPaymentPricingAdapter;
3
- export default PaymentFreePrice;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const PaymentFreePricePlugin: IPlugin;
3
- export default PaymentFreePricePlugin;
4
- export { PaymentFreePrice } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IOrderPricingAdapter } from '@unchainedshop/core';
2
- export declare const OrderDelivery: IOrderPricingAdapter;
3
- export default OrderDelivery;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const OrderDeliveryPlugin: IPlugin;
3
- export default OrderDeliveryPlugin;
4
- export { OrderDelivery } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IOrderPricingAdapter, type OrderDiscountConfiguration } from '@unchainedshop/core';
2
- export declare const OrderDiscount: IOrderPricingAdapter<OrderDiscountConfiguration>;
3
- export default OrderDiscount;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const OrderDiscountPlugin: IPlugin;
3
- export default OrderDiscountPlugin;
4
- export { OrderDiscount } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IOrderPricingAdapter } from '@unchainedshop/core';
2
- export declare const OrderItems: IOrderPricingAdapter;
3
- export default OrderItems;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const OrderItemsPlugin: IPlugin;
3
- export default OrderItemsPlugin;
4
- export { OrderItems } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IOrderPricingAdapter } from '@unchainedshop/core';
2
- export declare const OrderPayment: IOrderPricingAdapter;
3
- export default OrderPayment;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const OrderPaymentPlugin: IPlugin;
3
- export default OrderPaymentPlugin;
4
- export { OrderPayment } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type IProductPricingAdapter } from '@unchainedshop/core';
2
- export declare const ProductPrice: IProductPricingAdapter;
3
- export default ProductPrice;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const ProductPricePlugin: IPlugin;
3
- export default ProductPricePlugin;
4
- export { ProductPrice } from './adapter.ts';
@@ -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,3 +0,0 @@
1
- import { type ProductDiscountConfiguration, type IProductPricingAdapter } from '@unchainedshop/core';
2
- export declare const ProductDiscount: IProductPricingAdapter<ProductDiscountConfiguration>;
3
- export default ProductDiscount;
@@ -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,4 +0,0 @@
1
- import { type IPlugin } from '@unchainedshop/core';
2
- export declare const ProductDiscountPlugin: IPlugin;
3
- export default ProductDiscountPlugin;
4
- export { ProductDiscount } from './adapter.ts';
@@ -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";
@@ -1,3 +0,0 @@
1
- import { type IProductPricingAdapter } from '@unchainedshop/core';
2
- export declare const ProductEuTax: IProductPricingAdapter;
3
- export default ProductEuTax;