@unchainedshop/plugins 3.0.0-alpha2 → 3.0.0-alpha3

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 (208) hide show
  1. package/lib/delivery/pick-mup.js +1 -1
  2. package/lib/delivery/pick-mup.js.map +1 -1
  3. package/lib/files/gridfs/gridfs-webhook.d.ts +1 -1
  4. package/lib/files/gridfs/gridfs-webhook.d.ts.map +1 -1
  5. package/lib/filters/local-search.d.ts +1 -1
  6. package/lib/filters/local-search.d.ts.map +1 -1
  7. package/lib/filters/local-search.js.map +1 -1
  8. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
  9. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +1 -1
  10. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
  11. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +1 -1
  12. package/lib/payment/cryptopay/plugin.d.ts +1 -1
  13. package/lib/payment/cryptopay/plugin.d.ts.map +1 -1
  14. package/lib/payment/datatrans-v2/index.js +2 -2
  15. package/lib/payment/datatrans-v2/index.js.map +1 -1
  16. package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +2 -2
  17. package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +1 -1
  18. package/lib/payment/paypal-checkout.js +7 -1
  19. package/lib/payment/paypal-checkout.js.map +1 -1
  20. package/lib/payment/postfinance-checkout/api.js +3 -3
  21. package/lib/payment/postfinance-checkout/api.js.map +1 -1
  22. package/lib/payment/postfinance-checkout/utils.d.ts +1 -1
  23. package/lib/payment/postfinance-checkout/utils.d.ts.map +1 -1
  24. package/lib/payment/saferpay/adapter.d.ts +1 -1
  25. package/lib/payment/saferpay/adapter.d.ts.map +1 -1
  26. package/lib/payment/saferpay/api/api/SaferpayClient.d.ts +1 -1
  27. package/lib/payment/saferpay/api/api/SaferpayClient.d.ts.map +1 -1
  28. package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -1
  29. package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +1 -1
  30. package/lib/payment/stripe/middleware.d.ts.map +1 -1
  31. package/lib/payment/stripe/middleware.js +0 -3
  32. package/lib/payment/stripe/middleware.js.map +1 -1
  33. package/lib/payment/stripe/stripe.d.ts +3 -3
  34. package/lib/payment/stripe/stripe.d.ts.map +1 -1
  35. package/lib/payment/stripe/stripe.js +2 -2
  36. package/lib/payment/stripe/stripe.js.map +1 -1
  37. package/lib/plugins-index.d.ts +2 -31
  38. package/lib/plugins-index.d.ts.map +1 -1
  39. package/lib/plugins-index.js +10 -61
  40. package/lib/plugins-index.js.map +1 -1
  41. package/lib/presets/base-express.d.ts +3 -0
  42. package/lib/presets/base-express.d.ts.map +1 -0
  43. package/lib/presets/base-express.js +6 -0
  44. package/lib/presets/base-express.js.map +1 -0
  45. package/lib/presets/base-modules.d.ts +29 -0
  46. package/lib/presets/base-modules.d.ts.map +1 -0
  47. package/lib/presets/base-modules.js +40 -0
  48. package/lib/presets/base-modules.js.map +1 -0
  49. package/lib/presets/countries/ch.d.ts +4 -0
  50. package/lib/presets/countries/ch.d.ts.map +1 -0
  51. package/lib/presets/countries/ch.js +4 -0
  52. package/lib/presets/countries/ch.js.map +1 -0
  53. package/lib/presets/crypto-express.d.ts +4 -0
  54. package/lib/presets/crypto-express.d.ts.map +1 -0
  55. package/lib/presets/crypto-express.js +9 -0
  56. package/lib/presets/crypto-express.js.map +1 -0
  57. package/lib/presets/crypto-modules.d.ts +11 -0
  58. package/lib/presets/crypto-modules.d.ts.map +1 -0
  59. package/lib/presets/crypto-modules.js +14 -0
  60. package/lib/presets/crypto-modules.js.map +1 -0
  61. package/lib/pricing/delivery-swiss-tax.d.ts +1 -1
  62. package/lib/pricing/delivery-swiss-tax.d.ts.map +1 -1
  63. package/lib/pricing/delivery-swiss-tax.js +1 -1
  64. package/lib/pricing/delivery-swiss-tax.js.map +1 -1
  65. package/lib/pricing/discount-100-off.d.ts +1 -1
  66. package/lib/pricing/discount-100-off.d.ts.map +1 -1
  67. package/lib/pricing/discount-half-price-manual.d.ts +1 -1
  68. package/lib/pricing/discount-half-price-manual.d.ts.map +1 -1
  69. package/lib/pricing/discount-half-price.d.ts +1 -1
  70. package/lib/pricing/discount-half-price.d.ts.map +1 -1
  71. package/lib/pricing/free-delivery.d.ts +1 -1
  72. package/lib/pricing/free-delivery.d.ts.map +1 -1
  73. package/lib/pricing/free-delivery.js +1 -1
  74. package/lib/pricing/free-delivery.js.map +1 -1
  75. package/lib/pricing/free-payment.d.ts +1 -1
  76. package/lib/pricing/free-payment.d.ts.map +1 -1
  77. package/lib/pricing/free-payment.js +1 -1
  78. package/lib/pricing/free-payment.js.map +1 -1
  79. package/lib/pricing/order-delivery.d.ts +1 -1
  80. package/lib/pricing/order-delivery.d.ts.map +1 -1
  81. package/lib/pricing/order-discount.d.ts +1 -1
  82. package/lib/pricing/order-discount.d.ts.map +1 -1
  83. package/lib/pricing/order-discount.js +1 -1
  84. package/lib/pricing/order-discount.js.map +1 -1
  85. package/lib/pricing/order-items-discount.js +1 -1
  86. package/lib/pricing/order-items-discount.js.map +1 -1
  87. package/lib/pricing/order-round.d.ts +1 -1
  88. package/lib/pricing/order-round.d.ts.map +1 -1
  89. package/lib/pricing/order-round.js +1 -1
  90. package/lib/pricing/order-round.js.map +1 -1
  91. package/lib/pricing/product-catalog-price.d.ts +1 -1
  92. package/lib/pricing/product-catalog-price.d.ts.map +1 -1
  93. package/lib/pricing/product-discount.js +1 -1
  94. package/lib/pricing/product-discount.js.map +1 -1
  95. package/lib/pricing/product-price-rateconversion.d.ts +1 -1
  96. package/lib/pricing/product-price-rateconversion.d.ts.map +1 -1
  97. package/lib/pricing/product-round.d.ts +1 -1
  98. package/lib/pricing/product-round.d.ts.map +1 -1
  99. package/lib/pricing/product-swiss-tax.d.ts +4 -12
  100. package/lib/pricing/product-swiss-tax.d.ts.map +1 -1
  101. package/lib/pricing/product-swiss-tax.js +3 -3
  102. package/lib/pricing/product-swiss-tax.js.map +1 -1
  103. package/lib/warehousing/eth-minter.js +4 -3
  104. package/lib/warehousing/eth-minter.js.map +1 -1
  105. package/lib/worker/bulk-import.d.ts +1 -1
  106. package/lib/worker/bulk-import.d.ts.map +1 -1
  107. package/lib/worker/bulk-import.js.map +1 -1
  108. package/lib/worker/error-notifications.d.ts +1 -1
  109. package/lib/worker/error-notifications.d.ts.map +1 -1
  110. package/lib/worker/error-notifications.js +1 -1
  111. package/lib/worker/error-notifications.js.map +1 -1
  112. package/lib/worker/export-token.d.ts +2 -2
  113. package/lib/worker/export-token.d.ts.map +1 -1
  114. package/lib/worker/export-token.js +1 -1
  115. package/lib/worker/export-token.js.map +1 -1
  116. package/lib/worker/external.d.ts +1 -1
  117. package/lib/worker/external.d.ts.map +1 -1
  118. package/lib/worker/http-request.d.ts +1 -1
  119. package/lib/worker/http-request.d.ts.map +1 -1
  120. package/lib/worker/message.d.ts +1 -1
  121. package/lib/worker/message.d.ts.map +1 -1
  122. package/lib/worker/message.js.map +1 -1
  123. package/lib/worker/update-coinbase-rates.js +1 -1
  124. package/lib/worker/update-coinbase-rates.js.map +1 -1
  125. package/lib/worker/update-ecb-rates.js +1 -1
  126. package/lib/worker/update-ecb-rates.js.map +1 -1
  127. package/lib/worker/update-token-ownership.d.ts +1 -1
  128. package/lib/worker/update-token-ownership.d.ts.map +1 -1
  129. package/lib/worker/zombie-killer.d.ts +1 -1
  130. package/lib/worker/zombie-killer.d.ts.map +1 -1
  131. package/package.json +28 -26
  132. package/src/delivery/pick-mup.ts +1 -1
  133. package/src/delivery/post.ts +1 -1
  134. package/src/delivery/send-message.ts +1 -1
  135. package/src/delivery/stores.ts +1 -1
  136. package/src/enrollments/licensed.ts +1 -1
  137. package/src/files/gridfs/gridfs-adapter.ts +1 -1
  138. package/src/files/gridfs/gridfs-webhook.ts +1 -1
  139. package/src/files/minio/minio-adapter.ts +1 -1
  140. package/src/filters/local-search.ts +4 -4
  141. package/src/filters/strict-equal.ts +1 -1
  142. package/src/payment/apple-iap/adapter.ts +3 -3
  143. package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
  144. package/src/payment/braintree.ts +1 -1
  145. package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
  146. package/src/payment/cryptopay/middleware.ts +3 -3
  147. package/src/payment/cryptopay/plugin.ts +2 -2
  148. package/src/payment/datatrans-v2/index.ts +3 -3
  149. package/src/payment/datatrans-v2/middleware.ts +1 -1
  150. package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +2 -2
  151. package/src/payment/invoice-prepaid.ts +1 -1
  152. package/src/payment/invoice.ts +1 -1
  153. package/src/payment/paypal-checkout.ts +8 -2
  154. package/src/payment/payrexx/index.ts +1 -1
  155. package/src/payment/payrexx/middleware.ts +1 -1
  156. package/src/payment/postfinance-checkout/api.ts +3 -3
  157. package/src/payment/postfinance-checkout/index.ts +1 -1
  158. package/src/payment/postfinance-checkout/middleware.ts +1 -1
  159. package/src/payment/postfinance-checkout/utils.ts +1 -1
  160. package/src/payment/saferpay/adapter.ts +2 -2
  161. package/src/payment/saferpay/api/api/SaferpayClient.ts +1 -1
  162. package/src/payment/saferpay/db/SaferpayTransactionsCollection.ts +1 -1
  163. package/src/payment/saferpay/middleware.ts +1 -1
  164. package/src/payment/stripe/index.ts +1 -1
  165. package/src/payment/stripe/middleware.ts +1 -4
  166. package/src/payment/stripe/stripe.ts +5 -5
  167. package/src/plugins-index.ts +13 -70
  168. package/src/presets/base-express.ts +7 -0
  169. package/src/presets/base-modules.ts +56 -0
  170. package/src/presets/countries/ch.ts +3 -0
  171. package/src/presets/crypto-express.ts +12 -0
  172. package/src/presets/crypto-modules.ts +23 -0
  173. package/src/pricing/delivery-swiss-tax.ts +3 -6
  174. package/src/pricing/discount-100-off.ts +1 -1
  175. package/src/pricing/discount-half-price-manual.ts +1 -1
  176. package/src/pricing/discount-half-price.ts +1 -1
  177. package/src/pricing/free-delivery.ts +5 -2
  178. package/src/pricing/free-payment.ts +5 -2
  179. package/src/pricing/order-delivery.ts +1 -1
  180. package/src/pricing/order-discount.ts +1 -1
  181. package/src/pricing/order-items-discount.ts +1 -1
  182. package/src/pricing/order-items.ts +1 -1
  183. package/src/pricing/order-payment.ts +1 -1
  184. package/src/pricing/order-round.ts +1 -1
  185. package/src/pricing/product-catalog-price.ts +1 -1
  186. package/src/pricing/product-discount.ts +2 -5
  187. package/src/pricing/product-price-rateconversion.ts +1 -1
  188. package/src/pricing/product-round.ts +1 -1
  189. package/src/pricing/product-swiss-tax.test.ts +1 -0
  190. package/src/pricing/product-swiss-tax.ts +11 -8
  191. package/src/quotations/manual.ts +1 -1
  192. package/src/warehousing/eth-minter.ts +8 -6
  193. package/src/warehousing/store.ts +1 -1
  194. package/src/worker/bulk-import.ts +2 -2
  195. package/src/worker/email.ts +1 -1
  196. package/src/worker/enrollment-order-generator.ts +5 -5
  197. package/src/worker/error-notifications.ts +1 -1
  198. package/src/worker/export-token.ts +8 -3
  199. package/src/worker/external.ts +1 -1
  200. package/src/worker/heartbeat.ts +1 -1
  201. package/src/worker/http-request.ts +1 -1
  202. package/src/worker/message.ts +1 -2
  203. package/src/worker/push-notification.ts +1 -1
  204. package/src/worker/sms.ts +1 -1
  205. package/src/worker/update-coinbase-rates.ts +3 -3
  206. package/src/worker/update-ecb-rates.ts +3 -3
  207. package/src/worker/update-token-ownership.ts +1 -1
  208. package/src/worker/zombie-killer.ts +1 -1
@@ -1,11 +1,11 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
3
3
  import { ethers } from 'ethers';
4
4
  import { BIP32Factory } from 'bip32';
5
5
  import * as ecc from 'tiny-secp256k1';
6
6
  import { networks, payments } from 'bitcoinjs-lib';
7
7
  import { createLogger } from '@unchainedshop/logger';
8
- import { UnchainedCore } from '@unchainedshop/types/core.js';
8
+ import { UnchainedCore } from '@unchainedshop/core';
9
9
  import { OrderPricingSheet } from '@unchainedshop/core-orders';
10
10
  import { CryptopayModule } from './module/configureCryptopayModule.js';
11
11
 
@@ -1,7 +1,7 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentAdapter, PaymentError, PaymentDirector } from '@unchainedshop/core-payment';
3
3
  import { createLogger } from '@unchainedshop/logger';
4
- import { PaymentPricingRowCategory } from '@unchainedshop/types/payments.pricing.js';
4
+ import { PaymentPricingRowCategory } from '@unchainedshop/core-payment';
5
5
  import createDatatransAPI from './api/index.js';
6
6
  import type {
7
7
  AuthorizeAuthenticatedResponseSuccess,
@@ -446,7 +446,7 @@ const Datatrans: IPaymentAdapter = {
446
446
  } else {
447
447
  settledTransaction = result as StatusResponseSuccess;
448
448
  }
449
- } catch (e) {
449
+ } catch {
450
450
  await cancel({ transactionId, refno: settledTransaction.refno });
451
451
  logger.error(
452
452
  `Transaction declined / Transaction ID ${transactionId} authorization cancelled`,
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from '@unchainedshop/logger';
2
- import { Context } from '@unchainedshop/types/api.js';
2
+ import { Context } from '@unchainedshop/api';
3
3
  import generateSignature, { Security } from './generateSignature.js';
4
4
 
5
5
  import type { StatusResponseSuccess } from './api/types.js';
@@ -1,5 +1,5 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
2
- import { Order } from '@unchainedshop/types/orders.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
+ import { Order } from '@unchainedshop/core-orders';
3
3
 
4
4
  const roundedAmountFromOrder = (
5
5
  order: Order,
@@ -1,4 +1,4 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
3
3
 
4
4
  const InvoicePrepaid: IPaymentAdapter = {
@@ -1,4 +1,4 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
3
3
 
4
4
  const Invoice: IPaymentAdapter = {
@@ -1,7 +1,13 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentDirector, PaymentAdapter, PaymentError } from '@unchainedshop/core-payment';
3
3
  import { createLogger } from '@unchainedshop/logger';
4
- import checkoutNodeJssdk from '@paypal/checkout-server-sdk';
4
+
5
+ let checkoutNodeJssdk;
6
+ try {
7
+ checkoutNodeJssdk = await import('@paypal/checkout-server-sdk');
8
+ } catch {
9
+ /* */
10
+ }
5
11
 
6
12
  const logger = createLogger('unchained:core-payment');
7
13
 
@@ -1,4 +1,4 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
3
3
  import { createLogger } from '@unchainedshop/logger';
4
4
  import { mapOrderDataToGatewayObject, mapUserToGatewayObject } from './payrexx.js';
@@ -1,4 +1,4 @@
1
- import { Context } from '@unchainedshop/types/api.js';
1
+ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
 
4
4
  const logger = createLogger('unchained:core-payment:payrexx:webhook');
@@ -87,7 +87,7 @@ export const voidTransaction = async (transactionId: string): Promise<boolean> =
87
87
  try {
88
88
  await transactionVoidService.voidOnline(SPACE_ID, parseInt(transactionId, 10));
89
89
  return true;
90
- } catch (e) {
90
+ } catch {
91
91
  return false;
92
92
  }
93
93
  };
@@ -107,7 +107,7 @@ export const refundTransaction = async (
107
107
  try {
108
108
  await refundService.refund(SPACE_ID, refund);
109
109
  return true;
110
- } catch (e) {
110
+ } catch {
111
111
  return false;
112
112
  }
113
113
  };
@@ -117,7 +117,7 @@ export const confirmDeferredTransaction = async (transactionId: string): Promise
117
117
  try {
118
118
  await transactionCompletionService.completeOnline(SPACE_ID, parseInt(transactionId, 10));
119
119
  return true;
120
- } catch (e) {
120
+ } catch {
121
121
  return false;
122
122
  }
123
123
  };
@@ -2,7 +2,7 @@ import {
2
2
  IPaymentActions,
3
3
  IPaymentAdapter,
4
4
  PaymentChargeActionResult,
5
- } from '@unchainedshop/types/payments.js';
5
+ } from '@unchainedshop/core-payment';
6
6
  import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
7
7
  import { createLogger } from '@unchainedshop/logger';
8
8
 
@@ -1,4 +1,4 @@
1
- import { Context } from '@unchainedshop/types/api.js';
1
+ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import { WebhookData } from './types.js';
4
4
  import { getTransaction, getTransactionCompletion } from './api.js';
@@ -1,4 +1,4 @@
1
- import { Order, OrdersModule } from '@unchainedshop/types/orders.js';
1
+ import { Order, OrdersModule } from '@unchainedshop/core-orders';
2
2
  import * as pf from 'postfinancecheckout';
3
3
 
4
4
  const { PostFinanceCheckout } = pf;
@@ -1,6 +1,6 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
3
- import { UnchainedCore } from '@unchainedshop/types/core.js';
3
+ import { UnchainedCore } from '@unchainedshop/core';
4
4
  import { mongodb } from '@unchainedshop/mongodb';
5
5
  import { PaymentPageInitializeInput, SaferpayClient } from './api/index.js';
6
6
  import { buildSignature } from './buildSignature.js';
@@ -1,4 +1,4 @@
1
- import { OrderPayment } from '@unchainedshop/types/orders.payments.js';
1
+ import { OrderPayment } from '@unchainedshop/core-orders';
2
2
  import { TransactionCancelInput, TransactionCancelResponse } from '../models/TransactionCancel.js';
3
3
  import { TransactionCaptureInput, TransactionCaptureResponse } from '../models/TransactionCapture.js';
4
4
  import { PaymentPageAssertInput, PaymentPageAssertResponse } from '../models/PaymentPageAssert.js';
@@ -1,5 +1,5 @@
1
1
  import { mongodb } from '@unchainedshop/mongodb';
2
- import { TimestampFields } from '@unchainedshop/types/common.js';
2
+ import type { TimestampFields } from '@unchainedshop/mongodb';
3
3
 
4
4
  export type SaferpayTransaction = {
5
5
  orderPaymentId: any;
@@ -1,4 +1,4 @@
1
- import { Context } from '@unchainedshop/types/api.js';
1
+ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import { buildSignature } from './buildSignature.js';
4
4
  import { SaferpayTransactionsModule } from './module/configureSaferpayTransactionsModule.js';
@@ -1,4 +1,4 @@
1
- import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
1
+ import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
2
  import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
3
3
  import { createLogger } from '@unchainedshop/logger';
4
4
  import stripe, { createOrderPaymentIntent, createRegistrationIntent } from './stripe.js';
@@ -1,4 +1,4 @@
1
- import { Context } from '@unchainedshop/types/api.js';
1
+ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import stripe from './stripe.js';
4
4
 
@@ -80,9 +80,6 @@ export const stripeHandler = async (request, response) => {
80
80
  const order = await modules.orders.checkout(
81
81
  orderPayment.orderId,
82
82
  {
83
- transactionContext: {
84
- paymentIntentId: paymentIntent.id,
85
- },
86
83
  paymentContext: {
87
84
  paymentIntentId: paymentIntent.id,
88
85
  },
@@ -1,12 +1,12 @@
1
- import { Order } from '@unchainedshop/types/orders.js';
2
- import { OrderPayment } from '@unchainedshop/types/orders.payments.js';
3
- import { IOrderPricingSheet } from '@unchainedshop/types/orders.pricing.js';
1
+ import { Order } from '@unchainedshop/core-orders';
2
+ import { OrderPayment } from '@unchainedshop/core-orders';
3
+ import { IOrderPricingSheet } from '@unchainedshop/core-orders';
4
4
  import Stripe from 'stripe';
5
5
 
6
6
  const { STRIPE_SECRET, STRIPE_WEBHOOK_ENVIRONMENT, EMAIL_WEBSITE_NAME } = process.env;
7
7
 
8
8
  const stripe = new Stripe(STRIPE_SECRET, {
9
- apiVersion: '2024-04-10',
9
+ apiVersion: '2024-06-20',
10
10
  });
11
11
 
12
12
  const environment = STRIPE_WEBHOOK_ENVIRONMENT ?? null;
@@ -35,7 +35,7 @@ export const upsertCustomer = async ({ userId, name, email }): Promise<string> =
35
35
  }
36
36
 
37
37
  return existingCustomer.id;
38
- } catch (e) {
38
+ } catch {
39
39
  const customer = await stripe.customers.create({
40
40
  metadata: {
41
41
  userId,
@@ -1,116 +1,68 @@
1
- import { ModuleInput, UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { ModuleInput, UnchainedCore } from '@unchainedshop/core';
2
2
  import express from 'express';
3
3
 
4
+ import baseModules from './presets/base-modules.js';
5
+ import './presets/countries/ch.js';
6
+ import cryptoModules from './presets/crypto-modules.js';
7
+
8
+ import connectCryptoToExpress from './presets/crypto-express.js';
9
+ import connectBaseToExpress from './presets/base-express.js';
10
+
4
11
  // Delivery
5
- import './delivery/post.js';
6
- import './delivery/pick-mup.js';
7
12
  import './delivery/send-message.js';
8
13
  import './delivery/stores.js';
9
14
 
10
15
  // Payment
11
- import './payment/invoice.js';
12
16
  import './payment/invoice-prepaid.js';
13
17
  import './payment/paypal-checkout.js';
14
18
  import { datatransHandler } from './payment/datatrans-v2/index.js';
15
- import { configureCryptopayModule, cryptopayHandler } from './payment/cryptopay/index.js';
16
19
  import { appleIAPHandler, configureAppleTransactionsModule } from './payment/apple-iap/index.js';
17
20
  import { stripeHandler } from './payment/stripe/index.js';
18
21
  import { postfinanceCheckoutHandler } from './payment/postfinance-checkout/index.js';
19
22
  import { configureSaferpayTransactionsModule, saferpayHandler } from './payment/saferpay/index.js';
20
23
  import { payrexxHandler } from './payment/payrexx/index.js';
21
24
 
22
- // Warehousing
23
- import './warehousing/store.js';
24
- import './warehousing/eth-minter.js';
25
-
26
- // Pricing
27
- import './pricing/free-payment.js';
28
- import './pricing/free-delivery.js';
29
- import './pricing/order-items.js';
30
- import './pricing/order-discount.js';
31
- import './pricing/order-delivery.js';
32
- import './pricing/order-payment.js';
33
- import './pricing/product-catalog-price.js';
34
- import './pricing/product-price-rateconversion.js';
35
- import './pricing/product-discount.js';
36
- import './pricing/product-swiss-tax.js';
37
- import './pricing/delivery-swiss-tax.js';
38
-
39
25
  // Filter & Search
40
26
  import './filters/strict-equal.js';
41
27
  import './filters/local-search.js';
42
28
 
43
- // Quotations
44
- import './quotations/manual.js';
45
-
46
- // Enrollments
47
- import './enrollments/licensed.js';
48
-
49
- // Event Queue
50
- import './events/node-event-emitter.js';
51
-
52
29
  // Workers
53
- import './worker/bulk-import.js';
54
- import './worker/zombie-killer.js';
55
- import './worker/message.js';
56
- import './worker/external.js';
57
- import './worker/http-request.js';
58
- import './worker/heartbeat.js';
59
- import './worker/email.js';
60
30
  import './worker/sms.js';
61
31
  import './worker/push-notification.js';
62
- import './worker/update-ecb-rates.js';
63
- import './worker/error-notifications.js';
64
- import './worker/update-coinbase-rates.js';
65
- import { configureExportToken } from './worker/export-token.js';
66
32
  import { configureGenerateOrderAutoscheduling } from './worker/enrollment-order-generator.js';
67
33
 
68
- // Asset Management
69
- import './files/gridfs/gridfs-adapter.js';
70
- import { gridfsHandler } from './files/gridfs/gridfs-webhook.js';
71
- import { configureGridFSFileUploadModule } from './files/gridfs/index.js';
72
-
73
34
  const {
74
- CRYPTOPAY_WEBHOOK_PATH = '/payment/cryptopay',
75
35
  STRIPE_WEBHOOK_PATH = '/payment/stripe',
76
36
  PAYREXX_WEBHOOK_PATH = '/payment/payrexx',
77
37
  PFCHECKOUT_WEBHOOK_PATH = '/payment/postfinance-checkout',
78
38
  DATATRANS_WEBHOOK_PATH = '/payment/datatrans/webhook',
79
39
  APPLE_IAP_WEBHOOK_PATH = '/payment/apple-iap',
80
- // MINIO_PUT_SERVER_PATH = '/minio',
81
- GRIDFS_PUT_SERVER_PATH = '/gridfs',
82
40
  SAFERPAY_WEBHOOK_PATH = '/payment/saferpay/webhook',
83
41
  } = process.env;
84
42
 
85
- // import './files/minio/minio-adapter';
86
- // import { minioHandler } from './files/minio/minio-webhook';
87
-
88
43
  export const defaultModules: Record<
89
44
  string,
90
45
  {
91
46
  configure: (params: ModuleInput<any>) => any;
92
47
  }
93
48
  > = {
49
+ ...baseModules,
50
+ ...cryptoModules,
94
51
  appleTransactions: {
95
52
  configure: configureAppleTransactionsModule,
96
53
  },
97
54
  saferpayTransactions: {
98
55
  configure: configureSaferpayTransactionsModule,
99
56
  },
100
- gridfsFileUploads: {
101
- configure: configureGridFSFileUploadModule,
102
- },
103
- cryptopay: {
104
- configure: configureCryptopayModule,
105
- },
106
57
  };
107
58
 
108
59
  export const connectDefaultPluginsToExpress4 = (
109
60
  app,
110
61
  { unchainedAPI }: { unchainedAPI: UnchainedCore },
111
62
  ) => {
112
- app.use(GRIDFS_PUT_SERVER_PATH, gridfsHandler);
113
- app.use(CRYPTOPAY_WEBHOOK_PATH, express.json(), cryptopayHandler);
63
+ connectBaseToExpress(app);
64
+ connectCryptoToExpress(app, unchainedAPI);
65
+
114
66
  app.use(STRIPE_WEBHOOK_PATH, express.raw({ type: 'application/json' }), stripeHandler);
115
67
  app.use(PFCHECKOUT_WEBHOOK_PATH, express.json(), postfinanceCheckoutHandler);
116
68
 
@@ -133,14 +85,5 @@ export const connectDefaultPluginsToExpress4 = (
133
85
  app.use(PAYREXX_WEBHOOK_PATH, express.json({ type: 'application/json' }), payrexxHandler);
134
86
  app.use(SAFERPAY_WEBHOOK_PATH, saferpayHandler);
135
87
 
136
- // app.use(
137
- // MINIO_PUT_SERVER_PATH,
138
- // express.json({
139
- // strict: false,
140
- // }),
141
- // minioHandler
142
- // );
143
-
144
- configureExportToken(unchainedAPI);
145
88
  configureGenerateOrderAutoscheduling();
146
89
  };
@@ -0,0 +1,7 @@
1
+ import { gridfsHandler } from '../files/gridfs/gridfs-webhook.js';
2
+
3
+ const { GRIDFS_PUT_SERVER_PATH = '/gridfs' } = process.env;
4
+
5
+ export default (app) => {
6
+ app.use(GRIDFS_PUT_SERVER_PATH, gridfsHandler);
7
+ };
@@ -0,0 +1,56 @@
1
+ import { ModuleInput } from '@unchainedshop/core';
2
+
3
+ // Delivery
4
+ import '../delivery/post.js';
5
+
6
+ // Payment
7
+ import '../payment/invoice.js';
8
+
9
+ // Warehousing
10
+ import '../warehousing/store.js';
11
+
12
+ // Pricing
13
+ import '../pricing/free-payment.js';
14
+ import '../pricing/free-delivery.js';
15
+ import '../pricing/order-items.js';
16
+ import '../pricing/order-discount.js';
17
+ import '../pricing/order-delivery.js';
18
+ import '../pricing/order-payment.js';
19
+ import '../pricing/product-catalog-price.js';
20
+ import '../pricing/product-discount.js';
21
+
22
+ // Quotations
23
+ import '../quotations/manual.js';
24
+
25
+ // Enrollments
26
+ import '../enrollments/licensed.js';
27
+
28
+ // Event Queue
29
+ import '../events/node-event-emitter.js';
30
+
31
+ // Workers
32
+ import '../worker/bulk-import.js';
33
+ import '../worker/zombie-killer.js';
34
+ import '../worker/message.js';
35
+ import '../worker/external.js';
36
+ import '../worker/http-request.js';
37
+ import '../worker/heartbeat.js';
38
+ import '../worker/email.js';
39
+ import '../worker/error-notifications.js';
40
+
41
+ // Asset Management
42
+ import '../files/gridfs/gridfs-adapter.js';
43
+ import { configureGridFSFileUploadModule } from '../files/gridfs/index.js';
44
+
45
+ const modules: Record<
46
+ string,
47
+ {
48
+ configure: (params: ModuleInput<any>) => any;
49
+ }
50
+ > = {
51
+ gridfsFileUploads: {
52
+ configure: configureGridFSFileUploadModule,
53
+ },
54
+ };
55
+
56
+ export default modules;
@@ -0,0 +1,3 @@
1
+ import '../../delivery/pick-mup.js';
2
+ import '../../pricing/product-swiss-tax.js';
3
+ import '../../pricing/delivery-swiss-tax.js';
@@ -0,0 +1,12 @@
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
+ import express from 'express';
3
+
4
+ import { cryptopayHandler } from '../payment/cryptopay/index.js';
5
+ import { configureExportToken } from '../worker/export-token.js';
6
+
7
+ const { CRYPTOPAY_WEBHOOK_PATH = '/payment/cryptopay' } = process.env;
8
+
9
+ export default (app, unchainedAPI: UnchainedCore) => {
10
+ app.use(CRYPTOPAY_WEBHOOK_PATH, express.json(), cryptopayHandler);
11
+ configureExportToken(unchainedAPI);
12
+ };
@@ -0,0 +1,23 @@
1
+ import { ModuleInput } from '@unchainedshop/core';
2
+ import { configureCryptopayModule } from '../payment/cryptopay/index.js';
3
+
4
+ // Warehousing
5
+ import '../warehousing/eth-minter.js';
6
+
7
+ import '../pricing/product-price-rateconversion.js';
8
+ import '../worker/update-ecb-rates.js';
9
+ import '../worker/update-coinbase-rates.js';
10
+ import '../worker/export-token.js';
11
+
12
+ const modules: Record<
13
+ string,
14
+ {
15
+ configure: (params: ModuleInput<any>) => any;
16
+ }
17
+ > = {
18
+ cryptopay: {
19
+ configure: configureCryptopayModule,
20
+ },
21
+ };
22
+
23
+ export default modules;
@@ -1,11 +1,8 @@
1
1
  import { DeliveryPricingAdapter, DeliveryPricingDirector } from '@unchainedshop/core-delivery';
2
- import {
3
- DeliveryPricingRowCategory,
4
- IDeliveryPricingAdapter,
5
- } from '@unchainedshop/types/delivery.pricing.js';
2
+ import { DeliveryPricingRowCategory, IDeliveryPricingAdapter } from '@unchainedshop/core-delivery';
6
3
 
7
- import { Order } from '@unchainedshop/types/orders.js';
8
- import { DeliveryProvider } from '@unchainedshop/types/delivery.js';
4
+ import { Order } from '@unchainedshop/core-orders';
5
+ import { DeliveryProvider } from '@unchainedshop/core-delivery';
9
6
  import { SwissTaxCategories } from './tax/ch.js';
10
7
 
11
8
  const getTaxRate = ({ order, provider }: { order?: Order; provider?: DeliveryProvider }) => {
@@ -1,4 +1,4 @@
1
- import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
1
+ import { IDiscountAdapter } from '@unchainedshop/utils';
2
2
  import {
3
3
  OrderDiscountDirector,
4
4
  OrderDiscountAdapter,
@@ -1,4 +1,4 @@
1
- import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
1
+ import { IDiscountAdapter } from '@unchainedshop/utils';
2
2
  import { OrderDiscountDirector, OrderDiscountAdapter } from '@unchainedshop/core-orders';
3
3
  import { ProductDiscountConfiguration } from '@unchainedshop/core-products';
4
4
 
@@ -1,4 +1,4 @@
1
- import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
1
+ import { IDiscountAdapter } from '@unchainedshop/utils';
2
2
  import { OrderDiscountDirector, OrderDiscountAdapter } from '@unchainedshop/core-orders';
3
3
  import { ProductDiscountConfiguration } from '@unchainedshop/core-products';
4
4
 
@@ -1,5 +1,8 @@
1
- import { DeliveryPricingAdapter, DeliveryPricingDirector } from '@unchainedshop/core-delivery';
2
- import { IDeliveryPricingAdapter } from '@unchainedshop/types/delivery.pricing.js';
1
+ import {
2
+ DeliveryPricingAdapter,
3
+ DeliveryPricingDirector,
4
+ IDeliveryPricingAdapter,
5
+ } from '@unchainedshop/core-delivery';
3
6
 
4
7
  export const DeliveryFreePrice: IDeliveryPricingAdapter = {
5
8
  ...DeliveryPricingAdapter,
@@ -1,5 +1,8 @@
1
- import { PaymentPricingAdapter, PaymentPricingDirector } from '@unchainedshop/core-payment';
2
- import { IPaymentPricingAdapter } from '@unchainedshop/types/payments.pricing.js';
1
+ import {
2
+ PaymentPricingAdapter,
3
+ PaymentPricingDirector,
4
+ IPaymentPricingAdapter,
5
+ } from '@unchainedshop/core-payment';
3
6
 
4
7
  export const PaymentFreePrice: IPaymentPricingAdapter = {
5
8
  ...PaymentPricingAdapter,
@@ -1,4 +1,4 @@
1
- import { IOrderPricingAdapter } from '@unchainedshop/types/orders.pricing.js';
1
+ import { IOrderPricingAdapter } from '@unchainedshop/core-orders';
2
2
  import { OrderPricingDirector, OrderPricingAdapter } from '@unchainedshop/core-orders';
3
3
 
4
4
  export const OrderDelivery: IOrderPricingAdapter = {
@@ -1,4 +1,4 @@
1
- import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/types/orders.pricing.js';
1
+ import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/core-orders';
2
2
  import {
3
3
  OrderPricingDirector,
4
4
  OrderPricingAdapter,
@@ -1,4 +1,4 @@
1
- import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/types/orders.pricing.js';
1
+ import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/core-orders';
2
2
  import {
3
3
  OrderPricingDirector,
4
4
  OrderPricingAdapter,
@@ -1,4 +1,4 @@
1
- import { IOrderPricingAdapter } from '@unchainedshop/types/orders.pricing.js';
1
+ import { IOrderPricingAdapter } from '@unchainedshop/core-orders';
2
2
  import { OrderPricingDirector, OrderPricingAdapter } from '@unchainedshop/core-orders';
3
3
 
4
4
  const OrderItems: IOrderPricingAdapter = {
@@ -1,4 +1,4 @@
1
- import { IOrderPricingAdapter } from '@unchainedshop/types/orders.pricing.js';
1
+ import { IOrderPricingAdapter } from '@unchainedshop/core-orders';
2
2
  import { OrderPricingDirector, OrderPricingAdapter } from '@unchainedshop/core-orders';
3
3
 
4
4
  const OrderPayment: IOrderPricingAdapter = {
@@ -1,5 +1,5 @@
1
1
  import { OrderPricingAdapter, OrderPricingDirector } from '@unchainedshop/core-orders';
2
- import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/types/orders.pricing.js';
2
+ import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/core-orders';
3
3
 
4
4
  interface PriceRoundSettings {
5
5
  defaultPrecision: number;
@@ -1,4 +1,4 @@
1
- import { IProductPricingAdapter } from '@unchainedshop/types/products.pricing.js';
1
+ import { IProductPricingAdapter } from '@unchainedshop/core-products';
2
2
  import { ProductPricingDirector, ProductPricingAdapter } from '@unchainedshop/core-products';
3
3
  import { resolveBestCurrency } from '@unchainedshop/utils';
4
4
  import memoizee from 'memoizee';
@@ -1,8 +1,5 @@
1
- import type { Discount } from '@unchainedshop/types/discount.js';
2
- import {
3
- IProductPricingAdapter,
4
- ProductPricingRowCategory,
5
- } from '@unchainedshop/types/products.pricing.js';
1
+ import type { Discount } from '@unchainedshop/utils';
2
+ import { IProductPricingAdapter, ProductPricingRowCategory } from '@unchainedshop/core-products';
6
3
  import {
7
4
  ProductPricingDirector,
8
5
  ProductPricingAdapter,
@@ -1,4 +1,4 @@
1
- import { IProductPricingAdapter } from '@unchainedshop/types/products.pricing.js';
1
+ import { IProductPricingAdapter } from '@unchainedshop/core-products';
2
2
  import { ProductPricingDirector, ProductPricingAdapter } from '@unchainedshop/core-products';
3
3
 
4
4
  export const ProductPriceRateConversion: IProductPricingAdapter = {
@@ -1,4 +1,4 @@
1
- import { IProductPricingAdapter } from '@unchainedshop/types/products.pricing.js';
1
+ import { IProductPricingAdapter } from '@unchainedshop/core-products';
2
2
  import { ProductPricingAdapter, ProductPricingDirector } from '@unchainedshop/core-products';
3
3
 
4
4
  interface PriceRoundSettings {
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { getTaxRate, isDeliveryAddressInSwitzerland } from './product-swiss-tax.js';
2
3
 
3
4
  describe("ProductSwissTax", () => {