@unchainedshop/plugins 4.6.1 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/lib/delivery/post/adapter.d.ts +2 -0
- package/lib/delivery/{post.js → post/adapter.js} +2 -3
- package/lib/delivery/post/index.d.ts +4 -0
- package/lib/delivery/post/index.js +10 -0
- package/lib/delivery/send-message/adapter.d.ts +2 -0
- package/lib/delivery/{send-message.js → send-message/adapter.js} +2 -3
- package/lib/delivery/send-message/index.d.ts +4 -0
- package/lib/delivery/send-message/index.js +10 -0
- package/lib/delivery/stores/adapter.d.ts +2 -0
- package/lib/delivery/{stores.js → stores/adapter.js} +2 -3
- package/lib/delivery/stores/index.d.ts +4 -0
- package/lib/delivery/stores/index.js +10 -0
- package/lib/enrollments/licensed/adapter.d.ts +6 -0
- package/lib/enrollments/{licensed.js → licensed/adapter.js} +2 -3
- package/lib/enrollments/licensed/index.d.ts +4 -0
- package/lib/enrollments/licensed/index.js +10 -0
- package/lib/events/node-event-emitter.d.ts +3 -1
- package/lib/events/node-event-emitter.js +3 -3
- package/lib/files/gridfs/adapter.d.ts +2 -2
- package/lib/files/gridfs/adapter.js +2 -5
- package/lib/files/gridfs/api.d.ts +7 -0
- package/lib/files/gridfs/api.js +163 -0
- package/lib/files/gridfs/index.d.ts +5 -4
- package/lib/files/gridfs/index.js +30 -3
- package/lib/files/minio/adapter.d.ts +4 -0
- package/lib/files/minio/adapter.js +160 -0
- package/lib/files/minio/api.d.ts +2 -0
- package/lib/files/minio/api.js +41 -0
- package/lib/files/minio/index.d.ts +4 -5
- package/lib/files/minio/index.js +18 -157
- package/lib/files/temp-upload/api.d.ts +6 -0
- package/lib/files/temp-upload/api.js +49 -0
- package/lib/files/temp-upload/index.d.ts +3 -0
- package/lib/files/temp-upload/index.js +15 -0
- package/lib/filters/local-search/adapter.d.ts +2 -0
- package/lib/filters/{local-search.js → local-search/adapter.js} +2 -12
- package/lib/filters/local-search/index.d.ts +4 -0
- package/lib/filters/local-search/index.js +16 -0
- package/lib/filters/strict-equal/adapter.d.ts +2 -0
- package/lib/filters/{strict-equal.js → strict-equal/adapter.js} +2 -3
- package/lib/filters/strict-equal/index.d.ts +4 -0
- package/lib/filters/strict-equal/index.js +10 -0
- package/lib/payment/apple-iap/adapter.d.ts +2 -1
- package/lib/payment/apple-iap/adapter.js +2 -3
- package/lib/payment/apple-iap/api.d.ts +2 -0
- package/lib/payment/apple-iap/{handler-fastify.js → api.js} +47 -30
- package/lib/payment/apple-iap/index.d.ts +6 -4
- package/lib/payment/apple-iap/index.js +28 -3
- package/lib/payment/cryptopay/adapter.d.ts +2 -0
- package/lib/payment/cryptopay/{plugin.js → adapter.js} +2 -4
- package/lib/payment/cryptopay/api.d.ts +2 -0
- package/lib/payment/cryptopay/api.js +23 -0
- package/lib/payment/cryptopay/index.d.ts +5 -4
- package/lib/payment/cryptopay/index.js +31 -3
- package/lib/payment/datatrans-v2/adapter.d.ts +2 -0
- package/lib/payment/datatrans-v2/adapter.js +406 -0
- package/lib/payment/datatrans-v2/api.d.ts +2 -0
- package/lib/payment/datatrans-v2/api.js +108 -0
- package/lib/payment/datatrans-v2/index.d.ts +4 -1
- package/lib/payment/datatrans-v2/index.js +17 -400
- package/lib/payment/invoice/adapter.d.ts +2 -0
- package/lib/payment/{invoice.js → invoice/adapter.js} +2 -3
- package/lib/payment/invoice/index.d.ts +4 -0
- package/lib/payment/invoice/index.js +10 -0
- package/lib/payment/invoice-prepaid/adapter.d.ts +2 -0
- package/lib/payment/{invoice-prepaid.js → invoice-prepaid/adapter.js} +2 -3
- package/lib/payment/invoice-prepaid/index.d.ts +4 -0
- package/lib/payment/invoice-prepaid/index.js +10 -0
- package/lib/payment/payrexx/adapter.d.ts +2 -0
- package/lib/payment/payrexx/adapter.js +161 -0
- package/lib/payment/payrexx/api.d.ts +2 -0
- package/lib/payment/payrexx/api.js +97 -0
- package/lib/payment/payrexx/index.d.ts +4 -1
- package/lib/payment/payrexx/index.js +19 -158
- package/lib/payment/postfinance-checkout/adapter.d.ts +2 -0
- package/lib/payment/postfinance-checkout/adapter.js +189 -0
- package/lib/payment/postfinance-checkout/index.d.ts +5 -0
- package/lib/payment/postfinance-checkout/index.js +25 -186
- package/lib/payment/postfinance-checkout/webhook.d.ts +2 -0
- package/lib/payment/postfinance-checkout/webhook.js +48 -0
- package/lib/payment/saferpay/adapter.js +1 -2
- package/lib/payment/saferpay/index.d.ts +5 -4
- package/lib/payment/saferpay/index.js +29 -3
- package/lib/payment/saferpay/webhook.d.ts +2 -0
- package/lib/payment/saferpay/webhook.js +64 -0
- package/lib/payment/stripe/adapter.d.ts +2 -0
- package/lib/payment/stripe/adapter.js +121 -0
- package/lib/payment/stripe/api.d.ts +6 -0
- package/lib/payment/stripe/api.js +165 -0
- package/lib/payment/stripe/index.d.ts +4 -1
- package/lib/payment/stripe/index.js +22 -116
- package/lib/payment/stripe/stripe.js +2 -5
- package/lib/presets/all.d.ts +1 -70
- package/lib/presets/all.js +41 -27
- package/lib/presets/base.d.ts +1 -25
- package/lib/presets/base.js +56 -25
- package/lib/presets/countries/ch.d.ts +1 -2
- package/lib/presets/countries/ch.js +7 -2
- package/lib/presets/crypto.d.ts +3 -7
- package/lib/presets/crypto.js +18 -7
- package/lib/pricing/{delivery-swiss-tax.d.ts → delivery-swiss-tax/adapter.d.ts} +1 -0
- package/lib/pricing/{delivery-swiss-tax.js → delivery-swiss-tax/adapter.js} +4 -4
- package/lib/pricing/delivery-swiss-tax/index.d.ts +4 -0
- package/lib/pricing/delivery-swiss-tax/index.js +10 -0
- package/lib/pricing/{discount-100-off.d.ts → discount-100-off/adapter.d.ts} +1 -0
- package/lib/pricing/{discount-100-off.js → discount-100-off/adapter.js} +2 -2
- package/lib/pricing/discount-100-off/index.d.ts +4 -0
- package/lib/pricing/discount-100-off/index.js +10 -0
- package/lib/pricing/{discount-half-price-manual.d.ts → discount-half-price-manual/adapter.d.ts} +1 -0
- package/lib/pricing/{discount-half-price-manual.js → discount-half-price-manual/adapter.js} +2 -2
- package/lib/pricing/discount-half-price-manual/index.d.ts +4 -0
- package/lib/pricing/discount-half-price-manual/index.js +10 -0
- package/lib/pricing/{free-delivery.d.ts → free-delivery/adapter.d.ts} +1 -0
- package/lib/pricing/{free-delivery.js → free-delivery/adapter.js} +2 -2
- package/lib/pricing/free-delivery/index.d.ts +4 -0
- package/lib/pricing/free-delivery/index.js +10 -0
- package/lib/pricing/{free-payment.d.ts → free-payment/adapter.d.ts} +1 -0
- package/lib/pricing/{free-payment.js → free-payment/adapter.js} +2 -2
- package/lib/pricing/free-payment/index.d.ts +4 -0
- package/lib/pricing/free-payment/index.js +10 -0
- package/lib/pricing/{order-delivery.d.ts → order-delivery/adapter.d.ts} +1 -0
- package/lib/pricing/{order-delivery.js → order-delivery/adapter.js} +2 -2
- package/lib/pricing/order-delivery/index.d.ts +4 -0
- package/lib/pricing/order-delivery/index.js +10 -0
- package/lib/pricing/{order-discount.d.ts → order-discount/adapter.d.ts} +1 -0
- package/lib/pricing/{order-discount.js → order-discount/adapter.js} +2 -2
- package/lib/pricing/order-discount/index.d.ts +4 -0
- package/lib/pricing/order-discount/index.js +10 -0
- package/lib/pricing/{order-items.d.ts → order-items/adapter.d.ts} +1 -0
- package/lib/pricing/{order-items.js → order-items/adapter.js} +2 -2
- package/lib/pricing/order-items/index.d.ts +4 -0
- package/lib/pricing/order-items/index.js +10 -0
- package/lib/pricing/{order-payment.d.ts → order-payment/adapter.d.ts} +1 -0
- package/lib/pricing/{order-payment.js → order-payment/adapter.js} +2 -2
- package/lib/pricing/order-payment/index.d.ts +4 -0
- package/lib/pricing/order-payment/index.js +10 -0
- package/lib/pricing/{product-catalog-price.d.ts → product-catalog-price/adapter.d.ts} +1 -0
- package/lib/pricing/{product-catalog-price.js → product-catalog-price/adapter.js} +2 -2
- package/lib/pricing/product-catalog-price/index.d.ts +4 -0
- package/lib/pricing/product-catalog-price/index.js +10 -0
- package/lib/pricing/{product-discount.d.ts → product-discount/adapter.d.ts} +1 -0
- package/lib/pricing/{product-discount.js → product-discount/adapter.js} +2 -2
- package/lib/pricing/product-discount/index.d.ts +4 -0
- package/lib/pricing/product-discount/index.js +10 -0
- package/lib/pricing/{product-price-rateconversion.d.ts → product-price-rateconversion/adapter.d.ts} +1 -0
- package/lib/pricing/{product-price-rateconversion.js → product-price-rateconversion/adapter.js} +2 -2
- package/lib/pricing/product-price-rateconversion/index.d.ts +4 -0
- package/lib/pricing/product-price-rateconversion/index.js +10 -0
- package/lib/pricing/{product-swiss-tax.d.ts → product-swiss-tax/adapter.d.ts} +1 -0
- package/lib/pricing/{product-swiss-tax.js → product-swiss-tax/adapter.js} +4 -4
- package/lib/pricing/product-swiss-tax/index.d.ts +4 -0
- package/lib/pricing/product-swiss-tax/index.js +10 -0
- package/lib/quotations/manual/adapter.d.ts +2 -0
- package/lib/quotations/{manual.js → manual/adapter.js} +2 -3
- package/lib/quotations/manual/index.d.ts +4 -0
- package/lib/quotations/manual/index.js +10 -0
- package/lib/warehousing/erc-metadata/api.d.ts +12 -0
- package/lib/warehousing/erc-metadata/api.js +43 -0
- package/lib/warehousing/erc-metadata/index.d.ts +3 -0
- package/lib/warehousing/erc-metadata/index.js +15 -0
- package/lib/warehousing/eth-minter/adapter.d.ts +2 -0
- package/lib/warehousing/{eth-minter.js → eth-minter/adapter.js} +3 -4
- package/lib/warehousing/eth-minter/index.d.ts +4 -0
- package/lib/warehousing/eth-minter/index.js +10 -0
- package/lib/warehousing/store/adapter.d.ts +2 -0
- package/lib/warehousing/{store.js → store/adapter.js} +2 -3
- package/lib/warehousing/store/index.d.ts +4 -0
- package/lib/warehousing/store/index.js +10 -0
- package/lib/worker/budgetsms/adapter.d.ts +22 -0
- package/lib/worker/{budgetsms.js → budgetsms/adapter.js} +3 -3
- package/lib/worker/budgetsms/index.d.ts +4 -0
- package/lib/worker/budgetsms/index.js +10 -0
- package/lib/worker/bulk-export/adapter.d.ts +3 -0
- package/lib/worker/{bulk-export.js → bulk-export/adapter.js} +3 -3
- package/lib/worker/bulk-export/index.d.ts +4 -0
- package/lib/worker/bulk-export/index.js +10 -0
- package/lib/worker/{bulk-import.d.ts → bulk-import/adapter.d.ts} +1 -0
- package/lib/worker/{bulk-import.js → bulk-import/adapter.js} +2 -2
- package/lib/worker/bulk-import/api.d.ts +7 -0
- package/lib/worker/bulk-import/api.js +53 -0
- package/lib/worker/bulk-import/index.d.ts +4 -0
- package/lib/worker/bulk-import/index.js +18 -0
- package/lib/worker/bulkgate/adapter.d.ts +12 -0
- package/lib/worker/{bulkgate.js → bulkgate/adapter.js} +3 -3
- package/lib/worker/bulkgate/index.d.ts +4 -0
- package/lib/worker/bulkgate/index.js +10 -0
- package/lib/worker/email/adapter.d.ts +9 -0
- package/lib/worker/{email.js → email/adapter.js} +27 -13
- package/lib/worker/email/index.d.ts +4 -0
- package/lib/worker/email/index.js +10 -0
- package/lib/worker/enrollment-order-generator/adapter.d.ts +4 -0
- package/lib/worker/{enrollment-order-generator.js → enrollment-order-generator/adapter.js} +2 -2
- package/lib/worker/enrollment-order-generator/index.d.ts +4 -0
- package/lib/worker/enrollment-order-generator/index.js +13 -0
- package/lib/worker/{error-notifications.d.ts → error-notifications/adapter.d.ts} +1 -0
- package/lib/worker/{error-notifications.js → error-notifications/adapter.js} +9 -8
- package/lib/worker/error-notifications/index.d.ts +4 -0
- package/lib/worker/error-notifications/index.js +13 -0
- package/lib/worker/{export-token.d.ts → export-token/adapter.d.ts} +1 -1
- package/lib/worker/{export-token.js → export-token/adapter.js} +2 -3
- package/lib/worker/export-token/index.d.ts +4 -0
- package/lib/worker/export-token/index.js +13 -0
- package/lib/worker/{external.d.ts → external/adapter.d.ts} +1 -0
- package/lib/worker/{external.js → external/adapter.js} +2 -2
- package/lib/worker/external/index.d.ts +4 -0
- package/lib/worker/external/index.js +10 -0
- package/lib/worker/heartbeat/adapter.d.ts +8 -0
- package/lib/worker/{heartbeat.js → heartbeat/adapter.js} +3 -3
- package/lib/worker/heartbeat/index.d.ts +4 -0
- package/lib/worker/heartbeat/index.js +10 -0
- package/lib/worker/{http-request.d.ts → http-request/adapter.d.ts} +1 -1
- package/lib/worker/{http-request.js → http-request/adapter.js} +2 -3
- package/lib/worker/http-request/index.d.ts +4 -0
- package/lib/worker/http-request/index.js +10 -0
- package/lib/worker/{message.d.ts → message/adapter.d.ts} +1 -0
- package/lib/worker/{message.js → message/adapter.js} +2 -2
- package/lib/worker/message/index.d.ts +4 -0
- package/lib/worker/message/index.js +10 -0
- package/lib/worker/push-notification/adapter.d.ts +9 -0
- package/lib/worker/{push-notification.js → push-notification/adapter.js} +3 -3
- package/lib/worker/push-notification/index.d.ts +4 -0
- package/lib/worker/push-notification/index.js +10 -0
- package/lib/worker/twilio/adapter.d.ts +8 -0
- package/lib/worker/{twilio.js → twilio/adapter.js} +3 -3
- package/lib/worker/twilio/index.d.ts +4 -0
- package/lib/worker/twilio/index.js +10 -0
- package/lib/worker/update-coinbase-rates/adapter.d.ts +4 -0
- package/lib/worker/{update-coinbase-rates.js → update-coinbase-rates/adapter.js} +8 -6
- package/lib/worker/update-coinbase-rates/index.d.ts +4 -0
- package/lib/worker/update-coinbase-rates/index.js +13 -0
- package/lib/worker/update-ecb-rates/adapter.d.ts +4 -0
- package/lib/worker/{update-ecb-rates.js → update-ecb-rates/adapter.js} +11 -9
- package/lib/worker/update-ecb-rates/index.d.ts +4 -0
- package/lib/worker/update-ecb-rates/index.js +13 -0
- package/lib/worker/{update-token-ownership.d.ts → update-token-ownership/adapter.d.ts} +2 -0
- package/lib/worker/{update-token-ownership.js → update-token-ownership/adapter.js} +8 -7
- package/lib/worker/update-token-ownership/index.d.ts +4 -0
- package/lib/worker/update-token-ownership/index.js +13 -0
- package/lib/worker/{zombie-killer.js → zombie-killer/adapter.js} +1 -2
- package/lib/worker/zombie-killer/index.d.ts +4 -0
- package/lib/worker/zombie-killer/index.js +10 -0
- package/package.json +15 -10
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/enrollments/licensed.d.ts +0 -4
- package/lib/files/gridfs/handler-express.d.ts +0 -9
- package/lib/files/gridfs/handler-express.js +0 -110
- package/lib/files/gridfs/handler-fastify.d.ts +0 -3
- package/lib/files/gridfs/handler-fastify.js +0 -138
- package/lib/files/minio/handler-express.d.ts +0 -2
- package/lib/files/minio/handler-express.js +0 -36
- package/lib/files/minio/handler-fastify.d.ts +0 -3
- package/lib/files/minio/handler-fastify.js +0 -40
- package/lib/filters/local-search.d.ts +0 -3
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/payment/apple-iap/handler-express.d.ts +0 -2
- package/lib/payment/apple-iap/handler-express.js +0 -103
- package/lib/payment/apple-iap/handler-fastify.d.ts +0 -3
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -138
- package/lib/payment/cryptopay/handler-express.d.ts +0 -2
- package/lib/payment/cryptopay/handler-express.js +0 -19
- package/lib/payment/cryptopay/handler-fastify.d.ts +0 -3
- package/lib/payment/cryptopay/handler-fastify.js +0 -17
- package/lib/payment/cryptopay/plugin.d.ts +0 -3
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +0 -71
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +0 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +0 -71
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -87
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -85
- package/lib/payment/payrexx/handler-fastify.d.ts +0 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -91
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +0 -37
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +0 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +0 -40
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +0 -59
- package/lib/payment/saferpay/handler-fastify.d.ts +0 -2
- package/lib/payment/saferpay/handler-fastify.js +0 -62
- package/lib/payment/stripe/handler-express.d.ts +0 -5
- package/lib/payment/stripe/handler-express.js +0 -121
- package/lib/payment/stripe/handler-fastify.d.ts +0 -6
- package/lib/payment/stripe/handler-fastify.js +0 -131
- package/lib/presets/all-express.d.ts +0 -6
- package/lib/presets/all-express.js +0 -26
- package/lib/presets/all-fastify.d.ts +0 -6
- package/lib/presets/all-fastify.js +0 -49
- package/lib/presets/base-express.d.ts +0 -2
- package/lib/presets/base-express.js +0 -5
- package/lib/presets/base-fastify.d.ts +0 -3
- package/lib/presets/base-fastify.js +0 -16
- package/lib/presets/crypto-express.d.ts +0 -3
- package/lib/presets/crypto-express.js +0 -8
- package/lib/presets/crypto-fastify.d.ts +0 -3
- package/lib/presets/crypto-fastify.js +0 -11
- package/lib/pricing/discount-half-price.d.ts +0 -2
- package/lib/pricing/discount-half-price.js +0 -33
- package/lib/pricing/order-items-discount.d.ts +0 -2
- package/lib/pricing/order-items-discount.js +0 -50
- package/lib/pricing/order-round.d.ts +0 -10
- package/lib/pricing/order-round.js +0 -135
- package/lib/pricing/product-catalog-price-options.d.ts +0 -2
- package/lib/pricing/product-catalog-price-options.js +0 -51
- package/lib/pricing/product-round.d.ts +0 -10
- package/lib/pricing/product-round.js +0 -44
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/worker/budgetsms.d.ts +0 -9
- package/lib/worker/bulk-export.d.ts +0 -2
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- /package/lib/worker/{zombie-killer.d.ts → zombie-killer/adapter.d.ts} +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { stripe } from "./stripe.js";
|
|
3
|
+
const logger = createLogger('unchained:stripe:handler');
|
|
4
|
+
export const WebhookEventTypes = {
|
|
5
|
+
PAYMENT_INTENT_SUCCEEDED: 'payment_intent.succeeded',
|
|
6
|
+
SETUP_INTENT_SUCCEEDED: 'setup_intent.succeeded',
|
|
7
|
+
};
|
|
8
|
+
export async function stripeWebhookHandler(request, context) {
|
|
9
|
+
try {
|
|
10
|
+
const { modules, services } = context;
|
|
11
|
+
const sig = request.headers.get('stripe-signature');
|
|
12
|
+
if (!sig) {
|
|
13
|
+
logger.error('stripe-signature header was not provided for webhook');
|
|
14
|
+
return new Response(JSON.stringify({
|
|
15
|
+
success: false,
|
|
16
|
+
message: 'stripe-signature header was not provided for webhook',
|
|
17
|
+
name: 'MISSING_SIGNATURE',
|
|
18
|
+
}), {
|
|
19
|
+
status: 400,
|
|
20
|
+
headers: { 'Content-Type': 'application/json' },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (!process.env.STRIPE_ENDPOINT_SECRET) {
|
|
24
|
+
logger.error('env STRIPE_ENDPOINT_SECRET is required for webhook handling');
|
|
25
|
+
return new Response(JSON.stringify({
|
|
26
|
+
success: false,
|
|
27
|
+
message: 'env STRIPE_ENDPOINT_SECRET is required for webhook handling',
|
|
28
|
+
name: 'MISSING_ENDPOINT_SECRET',
|
|
29
|
+
}), {
|
|
30
|
+
status: 500,
|
|
31
|
+
headers: { 'Content-Type': 'application/json' },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const rawBody = await request.text();
|
|
35
|
+
let event;
|
|
36
|
+
try {
|
|
37
|
+
event = stripe.webhooks.constructEvent(rawBody, sig, process.env.STRIPE_ENDPOINT_SECRET);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
logger.error(`Error constructing event: ${err.message}`);
|
|
41
|
+
return new Response(JSON.stringify({
|
|
42
|
+
success: false,
|
|
43
|
+
message: err.message,
|
|
44
|
+
name: err.name || 'SIGNATURE_VERIFICATION_FAILED',
|
|
45
|
+
}), {
|
|
46
|
+
status: 400,
|
|
47
|
+
headers: { 'Content-Type': 'application/json' },
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!Object.values(WebhookEventTypes).includes(event.type)) {
|
|
51
|
+
logger.info(`unhandled event type`, {
|
|
52
|
+
type: event.type,
|
|
53
|
+
});
|
|
54
|
+
return new Response(JSON.stringify({
|
|
55
|
+
success: false,
|
|
56
|
+
ignored: true,
|
|
57
|
+
name: 'UNHANDLED_EVENT_TYPE',
|
|
58
|
+
message: `Unhandled event type: ${event.type}. Supported types: ${Object.values(WebhookEventTypes).join(', ')}`,
|
|
59
|
+
}), {
|
|
60
|
+
status: 200,
|
|
61
|
+
headers: { 'Content-Type': 'application/json' },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const environmentInMetadata = event.data?.object?.metadata?.environment || '';
|
|
65
|
+
const environmentInEnv = process.env.STRIPE_WEBHOOK_ENVIRONMENT || '';
|
|
66
|
+
if (environmentInMetadata !== environmentInEnv) {
|
|
67
|
+
logger.info(`unhandled event environment`, {
|
|
68
|
+
type: event.type,
|
|
69
|
+
environment: environmentInMetadata,
|
|
70
|
+
});
|
|
71
|
+
return new Response(JSON.stringify({
|
|
72
|
+
success: false,
|
|
73
|
+
ignored: true,
|
|
74
|
+
name: 'UNHANDLED_EVENT_ENVIRONMENT',
|
|
75
|
+
message: `Unhandled event environment: ${environmentInMetadata}. Supported environment: ${environmentInEnv}`,
|
|
76
|
+
}), {
|
|
77
|
+
status: 200,
|
|
78
|
+
headers: { 'Content-Type': 'application/json' },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
logger.info(`Processing event`, {
|
|
82
|
+
type: event.type,
|
|
83
|
+
});
|
|
84
|
+
if (event.type === WebhookEventTypes.PAYMENT_INTENT_SUCCEEDED) {
|
|
85
|
+
const paymentIntent = event.data.object;
|
|
86
|
+
const { orderPaymentId } = paymentIntent.metadata || {};
|
|
87
|
+
logger.info(`checkout with orderPaymentId: ${orderPaymentId}`, {
|
|
88
|
+
type: event.type,
|
|
89
|
+
});
|
|
90
|
+
await modules.orders.payments.logEvent(orderPaymentId, event);
|
|
91
|
+
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
92
|
+
orderPaymentId,
|
|
93
|
+
});
|
|
94
|
+
if (!orderPayment) {
|
|
95
|
+
throw new Error(`order payment not found with orderPaymentId: ${orderPaymentId}`);
|
|
96
|
+
}
|
|
97
|
+
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
98
|
+
paymentContext: {
|
|
99
|
+
paymentIntentId: paymentIntent.id,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
if (!order)
|
|
103
|
+
throw new Error(`Order with id ${orderPayment.orderId} not found`);
|
|
104
|
+
logger.info(`checkout successful`, {
|
|
105
|
+
orderPaymentId,
|
|
106
|
+
orderId: order._id,
|
|
107
|
+
type: event.type,
|
|
108
|
+
});
|
|
109
|
+
return new Response(JSON.stringify({
|
|
110
|
+
success: true,
|
|
111
|
+
message: 'checkout successful',
|
|
112
|
+
orderId: order._id,
|
|
113
|
+
}), {
|
|
114
|
+
status: 200,
|
|
115
|
+
headers: { 'Content-Type': 'application/json' },
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (event.type === WebhookEventTypes.SETUP_INTENT_SUCCEEDED) {
|
|
119
|
+
const setupIntent = event.data.object;
|
|
120
|
+
const { paymentProviderId, userId } = setupIntent.metadata || {};
|
|
121
|
+
logger.info(`registered payment credential with paymentProviderId: ${paymentProviderId}`, {
|
|
122
|
+
type: event.type,
|
|
123
|
+
userId,
|
|
124
|
+
});
|
|
125
|
+
const paymentCredentials = await services.orders.registerPaymentCredentials(paymentProviderId, {
|
|
126
|
+
transactionContext: {
|
|
127
|
+
setupIntentId: setupIntent.id,
|
|
128
|
+
},
|
|
129
|
+
userId,
|
|
130
|
+
});
|
|
131
|
+
logger.info(`payment credentials registration successful`, {
|
|
132
|
+
userId,
|
|
133
|
+
paymentProviderId,
|
|
134
|
+
paymentCredentialsId: paymentCredentials?._id,
|
|
135
|
+
type: event.type,
|
|
136
|
+
});
|
|
137
|
+
return new Response(JSON.stringify({
|
|
138
|
+
success: true,
|
|
139
|
+
message: 'payment credentials registration successful',
|
|
140
|
+
paymentCredentialsId: paymentCredentials?._id,
|
|
141
|
+
}), {
|
|
142
|
+
status: 200,
|
|
143
|
+
headers: { 'Content-Type': 'application/json' },
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return new Response(JSON.stringify({
|
|
147
|
+
success: false,
|
|
148
|
+
message: 'Unhandled event type',
|
|
149
|
+
}), {
|
|
150
|
+
status: 200,
|
|
151
|
+
headers: { 'Content-Type': 'application/json' },
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
logger.error(error);
|
|
156
|
+
return new Response(JSON.stringify({
|
|
157
|
+
success: false,
|
|
158
|
+
message: error.message,
|
|
159
|
+
name: error.name,
|
|
160
|
+
}), {
|
|
161
|
+
status: 500,
|
|
162
|
+
headers: { 'Content-Type': 'application/json' },
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -1,122 +1,28 @@
|
|
|
1
1
|
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Stripe } from "./adapter.js";
|
|
3
|
+
import { stripeWebhookHandler } from "./api.js";
|
|
4
|
+
const { STRIPE_WEBHOOK_PATH = '/payment/stripe/webhook' } = process.env;
|
|
4
5
|
const logger = createLogger('unchained:stripe');
|
|
5
|
-
const
|
|
6
|
-
...PaymentAdapter,
|
|
6
|
+
export const StripePlugin = {
|
|
7
7
|
key: 'shop.unchained.payment.stripe',
|
|
8
|
-
label: 'Stripe',
|
|
8
|
+
label: 'Stripe Payment Plugin',
|
|
9
9
|
version: '2.0.0',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
name,
|
|
26
|
-
userId,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const adapterActions = {
|
|
30
|
-
...PaymentAdapter.actions(config, context),
|
|
31
|
-
configurationError() {
|
|
32
|
-
if (!stripe)
|
|
33
|
-
return PaymentError.INCOMPLETE_CONFIGURATION;
|
|
34
|
-
return null;
|
|
35
|
-
},
|
|
36
|
-
isActive: () => {
|
|
37
|
-
if (adapterActions.configurationError() === null)
|
|
38
|
-
return true;
|
|
39
|
-
return false;
|
|
40
|
-
},
|
|
41
|
-
isPayLaterAllowed() {
|
|
42
|
-
return false;
|
|
43
|
-
},
|
|
44
|
-
validate: async ({ token }) => {
|
|
45
|
-
const paymentMethod = await stripe.paymentMethods.retrieve(token);
|
|
46
|
-
return !!paymentMethod;
|
|
47
|
-
},
|
|
48
|
-
register: async ({ setupIntentId }) => {
|
|
49
|
-
if (!setupIntentId) {
|
|
50
|
-
throw new Error('You have to provide a setupIntentId');
|
|
51
|
-
}
|
|
52
|
-
const setupIntent = await stripe.setupIntents.retrieve(setupIntentId);
|
|
53
|
-
if (setupIntent.status === 'succeeded') {
|
|
54
|
-
return {
|
|
55
|
-
token: setupIntent.payment_method,
|
|
56
|
-
customer: setupIntent.customer,
|
|
57
|
-
payment_method_types: setupIntent.payment_method_types,
|
|
58
|
-
usage: setupIntent.usage,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
logger.warn('Registration declined', setupIntentId);
|
|
62
|
-
return null;
|
|
63
|
-
},
|
|
64
|
-
sign: async (transactionContext = {}) => {
|
|
65
|
-
const { orderPayment, order, paymentProvider } = context;
|
|
66
|
-
const { userId, name, email } = await assertUserData(order?.userId);
|
|
67
|
-
if (orderPayment) {
|
|
68
|
-
if (!order)
|
|
69
|
-
throw new Error('order not found in context');
|
|
70
|
-
const pricing = OrderPricingSheet({
|
|
71
|
-
calculation: order?.calculation,
|
|
72
|
-
currencyCode: order?.currencyCode,
|
|
73
|
-
});
|
|
74
|
-
const paymentIntent = await createOrderPaymentIntent({ userId, name, email, order, orderPayment, pricing, descriptorPrefix }, transactionContext);
|
|
75
|
-
return paymentIntent.client_secret;
|
|
76
|
-
}
|
|
77
|
-
const paymentIntent = await createRegistrationIntent({ userId, name, email, paymentProviderId: paymentProvider._id, descriptorPrefix }, transactionContext);
|
|
78
|
-
return paymentIntent.client_secret;
|
|
79
|
-
},
|
|
80
|
-
charge: async ({ paymentIntentId, paymentCredentials }) => {
|
|
81
|
-
if (!paymentIntentId && !paymentCredentials) {
|
|
82
|
-
throw new Error('You have to provide paymentIntentId or paymentCredentials');
|
|
83
|
-
}
|
|
84
|
-
const { order, orderPayment } = context;
|
|
85
|
-
if (!order)
|
|
86
|
-
throw new Error('order not found in context');
|
|
87
|
-
if (!orderPayment)
|
|
88
|
-
throw new Error('orderPayment not found in context');
|
|
89
|
-
const { userId, name, email } = await assertUserData(order?.userId);
|
|
90
|
-
const pricing = OrderPricingSheet({
|
|
91
|
-
calculation: order.calculation,
|
|
92
|
-
currencyCode: order.currencyCode,
|
|
93
|
-
});
|
|
94
|
-
const paymentIntentObject = paymentIntentId
|
|
95
|
-
? await stripe.paymentIntents.retrieve(paymentIntentId)
|
|
96
|
-
: await createOrderPaymentIntent({ userId, name, email, orderPayment, order, pricing, descriptorPrefix }, {
|
|
97
|
-
customer: paymentCredentials.meta?.customer,
|
|
98
|
-
confirm: true,
|
|
99
|
-
payment_method: paymentCredentials.token,
|
|
100
|
-
payment_method_types: paymentCredentials.meta?.payment_method_types,
|
|
101
|
-
});
|
|
102
|
-
const { currencyCode, amount } = pricing.total({ useNetPrice: false });
|
|
103
|
-
if (paymentIntentObject.currency !== currencyCode.toLowerCase() ||
|
|
104
|
-
paymentIntentObject.amount !== Math.round(amount)) {
|
|
105
|
-
throw new Error('The price has changed since the intent has been created');
|
|
106
|
-
}
|
|
107
|
-
if (paymentIntentObject.metadata?.orderPaymentId !== orderPayment?._id) {
|
|
108
|
-
throw new Error('The order payment is different from the initiating intent');
|
|
109
|
-
}
|
|
110
|
-
if (paymentIntentObject.status === 'succeeded') {
|
|
111
|
-
return paymentIntentObject;
|
|
112
|
-
}
|
|
113
|
-
logger.info('Charge postponed because paymentIntent has wrong status', {
|
|
114
|
-
orderPaymentId: paymentIntentObject.id,
|
|
115
|
-
});
|
|
116
|
-
return false;
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
return adapterActions;
|
|
10
|
+
adapters: [Stripe],
|
|
11
|
+
routes: [
|
|
12
|
+
{
|
|
13
|
+
path: STRIPE_WEBHOOK_PATH,
|
|
14
|
+
method: 'POST',
|
|
15
|
+
handler: stripeWebhookHandler,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
onRegister: () => {
|
|
19
|
+
if (!process.env.STRIPE_SECRET) {
|
|
20
|
+
throw new Error('STRIPE_SECRET not set');
|
|
21
|
+
}
|
|
22
|
+
if (!process.env.STRIPE_ENDPOINT_SECRET) {
|
|
23
|
+
logger.warn('STRIPE_ENDPOINT_SECRET not set - webhooks will not work');
|
|
24
|
+
}
|
|
120
25
|
},
|
|
121
26
|
};
|
|
122
|
-
|
|
27
|
+
export default StripePlugin;
|
|
28
|
+
export { Stripe } from "./adapter.js";
|
|
@@ -3,14 +3,11 @@ const logger = createLogger('unchained:stripe');
|
|
|
3
3
|
const { STRIPE_SECRET, STRIPE_WEBHOOK_ENVIRONMENT, EMAIL_WEBSITE_NAME } = process.env;
|
|
4
4
|
export let stripe;
|
|
5
5
|
const environment = STRIPE_WEBHOOK_ENVIRONMENT ?? null;
|
|
6
|
-
if (
|
|
7
|
-
logger.warn('STRIPE_SECRET is not set, skipping initialization');
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
6
|
+
if (STRIPE_SECRET) {
|
|
10
7
|
try {
|
|
11
8
|
const { default: Stripe } = await import('stripe');
|
|
12
9
|
stripe = new Stripe(STRIPE_SECRET, {
|
|
13
|
-
apiVersion: '
|
|
10
|
+
apiVersion: '2026-02-25.clover',
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
13
|
catch {
|
package/lib/presets/all.d.ts
CHANGED
|
@@ -1,70 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import '../delivery/send-message.ts';
|
|
3
|
-
import '../delivery/stores.ts';
|
|
4
|
-
import '../payment/invoice-prepaid.ts';
|
|
5
|
-
import '../payment/paypal-checkout.ts';
|
|
6
|
-
import '../payment/stripe/index.ts';
|
|
7
|
-
import '../payment/postfinance-checkout/index.ts';
|
|
8
|
-
import '../payment/datatrans-v2/index.ts';
|
|
9
|
-
import '../payment/payrexx/index.ts';
|
|
10
|
-
import '../filters/strict-equal.ts';
|
|
11
|
-
import '../filters/local-search.ts';
|
|
12
|
-
import '../worker/twilio.ts';
|
|
13
|
-
import '../worker/bulkgate.ts';
|
|
14
|
-
import '../worker/budgetsms.ts';
|
|
15
|
-
import '../worker/push-notification.ts';
|
|
16
|
-
import '../worker/enrollment-order-generator.ts';
|
|
17
|
-
declare const modules: {
|
|
18
|
-
saferpayTransactions: {
|
|
19
|
-
configure: ({ db }: {
|
|
20
|
-
db: import("mongodb").Db;
|
|
21
|
-
}) => Promise<{
|
|
22
|
-
findTransactionById: (_id: import("bson").ObjectId) => Promise<import("mongodb").WithId<import("../payment/saferpay/db/SaferpayTransactionsCollection.ts").SaferpayTransaction> | null>;
|
|
23
|
-
createTransaction: (orderPaymentId: any) => Promise<import("bson").ObjectId>;
|
|
24
|
-
setToken: (_id: import("bson").ObjectId, token: string) => Promise<void>;
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
appleTransactions: {
|
|
28
|
-
configure: ({ db }: {
|
|
29
|
-
db: any;
|
|
30
|
-
}) => Promise<{
|
|
31
|
-
findTransactionById: (transactionIdentifier: string) => Promise<import("../payment/apple-iap/db/AppleTransactionsCollection.ts").AppleTransaction | null>;
|
|
32
|
-
createTransaction: (doc: Omit<import("../payment/apple-iap/db/AppleTransactionsCollection.ts").AppleTransaction, "_id" | "created"> & Pick<Partial<import("../payment/apple-iap/db/AppleTransactionsCollection.ts").AppleTransaction>, "_id" | "created">) => Promise<string>;
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
cryptopay: {
|
|
36
|
-
configure: ({ db }: {
|
|
37
|
-
db: any;
|
|
38
|
-
}) => {
|
|
39
|
-
getWalletAddress: (address: string, contract?: string) => Promise<import("../payment/cryptopay/db/CryptopayTransactions.ts").CryptopayTransaction | null>;
|
|
40
|
-
updateMostRecentBlock: (currencyCode: string, blockHeight: number) => Promise<void>;
|
|
41
|
-
updateWalletAddress: ({ address, blockHeight, amount, contract, currencyCode, decimals, }: {
|
|
42
|
-
address: string;
|
|
43
|
-
blockHeight: number;
|
|
44
|
-
amount: string | number;
|
|
45
|
-
contract?: string;
|
|
46
|
-
currencyCode: string;
|
|
47
|
-
decimals: number;
|
|
48
|
-
}) => Promise<import("../payment/cryptopay/db/CryptopayTransactions.ts").CryptopayTransaction>;
|
|
49
|
-
mapOrderPaymentToWalletAddress: ({ address, contract, currencyCode, orderPaymentId, }: {
|
|
50
|
-
address: string;
|
|
51
|
-
contract?: string;
|
|
52
|
-
currencyCode: string;
|
|
53
|
-
orderPaymentId: string;
|
|
54
|
-
}) => Promise<import("../payment/cryptopay/db/CryptopayTransactions.ts").CryptopayTransaction>;
|
|
55
|
-
getNextDerivationNumber: (currencyCode: string) => Promise<number>;
|
|
56
|
-
getWalletAddressesByOrderPaymentId: (orderPaymentId: string) => Promise<import("../payment/cryptopay/db/CryptopayTransactions.ts").CryptopayTransaction[]>;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
gridfsFileUploads: {
|
|
60
|
-
configure: ({ db }: {
|
|
61
|
-
db: any;
|
|
62
|
-
}) => {
|
|
63
|
-
createWriteStream: (directoryName: any, fileId: any, fileName: any, uploadOptions: import("mongodb").GridFSBucketWriteStream["options"]) => Promise<import("mongodb").GridFSBucketWriteStream>;
|
|
64
|
-
getFileInfo: (directoryName: any, fileId: any) => Promise<import("mongodb").GridFSFile | null>;
|
|
65
|
-
createReadStream: (directoryName: any, fileId: any) => Promise<import("mongodb").GridFSBucketReadStream>;
|
|
66
|
-
removeFileFromBucket: (directoryName: any, fileId: any) => Promise<void>;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
export default modules;
|
|
1
|
+
export declare function registerAllPlugins(): void;
|
package/lib/presets/all.js
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import "../
|
|
6
|
-
import "../payment/
|
|
7
|
-
import "../payment/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import "../payment/
|
|
11
|
-
import "../payment/
|
|
12
|
-
import "../payment/
|
|
13
|
-
import "../payment/
|
|
14
|
-
import "../filters/strict-equal.js";
|
|
15
|
-
import "../filters/local-search.js";
|
|
16
|
-
import "../worker/twilio.js";
|
|
17
|
-
import "../worker/bulkgate.js";
|
|
18
|
-
import "../worker/budgetsms.js";
|
|
19
|
-
import "../worker/push-notification.js";
|
|
20
|
-
import "../worker/enrollment-order-generator.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { registerBasePlugins } from "./base.js";
|
|
2
|
+
import { registerCryptoPlugins } from "./crypto.js";
|
|
3
|
+
import { registerSwissTaxPlugins } from "./countries/ch.js";
|
|
4
|
+
import { pluginRegistry } from '@unchainedshop/core';
|
|
5
|
+
import { DatatransPlugin } from "../payment/datatrans-v2/index.js";
|
|
6
|
+
import { StripePlugin } from "../payment/stripe/index.js";
|
|
7
|
+
import { InvoicePrepaidPlugin } from "../payment/invoice-prepaid/index.js";
|
|
8
|
+
import { SendMessagePlugin } from "../delivery/send-message/index.js";
|
|
9
|
+
import { PickMupPlugin } from "../delivery/stores/index.js";
|
|
10
|
+
import { AppleIAPPlugin } from "../payment/apple-iap/index.js";
|
|
11
|
+
import { PayrexxPlugin } from "../payment/payrexx/index.js";
|
|
12
|
+
import { PostfinanceCheckoutPlugin } from "../payment/postfinance-checkout/index.js";
|
|
13
|
+
import { SaferpayPlugin } from "../payment/saferpay/index.js";
|
|
14
|
+
import { StrictQualFilterPlugin } from "../filters/strict-equal/index.js";
|
|
15
|
+
import { LocalSearchPlugin } from "../filters/local-search/index.js";
|
|
16
|
+
import { TwilioPlugin } from "../worker/twilio/index.js";
|
|
17
|
+
import { BulkGatePlugin } from "../worker/bulkgate/index.js";
|
|
18
|
+
import { BudgetSMSPlugin } from "../worker/budgetsms/index.js";
|
|
19
|
+
import { PushNotificationPlugin } from "../worker/push-notification/index.js";
|
|
20
|
+
import { EnrollmentOrderGeneratorPlugin } from "../worker/enrollment-order-generator/index.js";
|
|
21
|
+
export function registerAllPlugins() {
|
|
22
|
+
registerBasePlugins();
|
|
23
|
+
registerCryptoPlugins();
|
|
24
|
+
registerSwissTaxPlugins();
|
|
25
|
+
pluginRegistry.register(DatatransPlugin);
|
|
26
|
+
pluginRegistry.register(StripePlugin);
|
|
27
|
+
pluginRegistry.register(AppleIAPPlugin);
|
|
28
|
+
pluginRegistry.register(PayrexxPlugin);
|
|
29
|
+
pluginRegistry.register(PostfinanceCheckoutPlugin);
|
|
30
|
+
pluginRegistry.register(SaferpayPlugin);
|
|
31
|
+
pluginRegistry.register(InvoicePrepaidPlugin);
|
|
32
|
+
pluginRegistry.register(SendMessagePlugin);
|
|
33
|
+
pluginRegistry.register(PickMupPlugin);
|
|
34
|
+
pluginRegistry.register(StrictQualFilterPlugin);
|
|
35
|
+
pluginRegistry.register(LocalSearchPlugin);
|
|
36
|
+
pluginRegistry.register(TwilioPlugin);
|
|
37
|
+
pluginRegistry.register(BulkGatePlugin);
|
|
38
|
+
pluginRegistry.register(BudgetSMSPlugin);
|
|
39
|
+
pluginRegistry.register(PushNotificationPlugin);
|
|
40
|
+
pluginRegistry.register(EnrollmentOrderGeneratorPlugin);
|
|
41
|
+
}
|
package/lib/presets/base.d.ts
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import '../payment/invoice.ts';
|
|
3
|
-
import '../warehousing/store.ts';
|
|
4
|
-
import '../pricing/free-payment.ts';
|
|
5
|
-
import '../pricing/free-delivery.ts';
|
|
6
|
-
import '../pricing/order-items.ts';
|
|
7
|
-
import '../pricing/order-discount.ts';
|
|
8
|
-
import '../pricing/order-delivery.ts';
|
|
9
|
-
import '../pricing/order-payment.ts';
|
|
10
|
-
import '../pricing/product-catalog-price.ts';
|
|
11
|
-
import '../pricing/product-discount.ts';
|
|
12
|
-
import '../quotations/manual.ts';
|
|
13
|
-
import '../enrollments/licensed.ts';
|
|
14
|
-
import '../events/node-event-emitter.ts';
|
|
15
|
-
import '../worker/bulk-import.ts';
|
|
16
|
-
import '../worker/zombie-killer.ts';
|
|
17
|
-
import '../worker/message.ts';
|
|
18
|
-
import '../worker/external.ts';
|
|
19
|
-
import '../worker/http-request.ts';
|
|
20
|
-
import '../worker/heartbeat.ts';
|
|
21
|
-
import '../worker/email.ts';
|
|
22
|
-
import '../worker/error-notifications.ts';
|
|
23
|
-
import '../worker/bulk-export.ts';
|
|
24
|
-
import gridfsModules from '../files/gridfs/index.ts';
|
|
25
|
-
export default gridfsModules;
|
|
1
|
+
export declare function registerBasePlugins(): void;
|
package/lib/presets/base.js
CHANGED
|
@@ -1,25 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../pricing/
|
|
10
|
-
import "../pricing/
|
|
11
|
-
import "../pricing/
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import "../
|
|
20
|
-
import "../worker/
|
|
21
|
-
import "../worker/
|
|
22
|
-
import "../worker/
|
|
23
|
-
import "../worker/
|
|
24
|
-
import
|
|
25
|
-
|
|
1
|
+
import { pluginRegistry } from '@unchainedshop/core';
|
|
2
|
+
import { setEmitAdapter } from '@unchainedshop/events';
|
|
3
|
+
import { GridFSPlugin } from "../files/gridfs/index.js";
|
|
4
|
+
import { TempUploadPlugin } from "../files/temp-upload/index.js";
|
|
5
|
+
import { InvoicePlugin } from "../payment/invoice/index.js";
|
|
6
|
+
import { PostPlugin } from "../delivery/post/index.js";
|
|
7
|
+
import { StorePlugin } from "../warehousing/store/index.js";
|
|
8
|
+
import { ERCMetadataPlugin } from "../warehousing/erc-metadata/index.js";
|
|
9
|
+
import { PaymentFreePricePlugin } from "../pricing/free-payment/index.js";
|
|
10
|
+
import { DeliveryFreePricePlugin } from "../pricing/free-delivery/index.js";
|
|
11
|
+
import { OrderItemsPlugin } from "../pricing/order-items/index.js";
|
|
12
|
+
import { OrderDiscountPlugin } from "../pricing/order-discount/index.js";
|
|
13
|
+
import { OrderDeliveryPlugin } from "../pricing/order-delivery/index.js";
|
|
14
|
+
import { OrderPaymentPlugin } from "../pricing/order-payment/index.js";
|
|
15
|
+
import { ProductPricePlugin } from "../pricing/product-catalog-price/index.js";
|
|
16
|
+
import { ProductDiscountPlugin } from "../pricing/product-discount/index.js";
|
|
17
|
+
import { ManualOfferingPlugin } from "../quotations/manual/index.js";
|
|
18
|
+
import { LicensedEnrollmentsPlugin } from "../enrollments/licensed/index.js";
|
|
19
|
+
import { NodeEventEmitter } from "../events/node-event-emitter.js";
|
|
20
|
+
import { BulkImportPlugin } from "../worker/bulk-import/index.js";
|
|
21
|
+
import { ZombieKillerPlugin } from "../worker/zombie-killer/index.js";
|
|
22
|
+
import { MessagePlugin } from "../worker/message/index.js";
|
|
23
|
+
import { ExternalPlugin } from "../worker/external/index.js";
|
|
24
|
+
import { HttpRequestPlugin } from "../worker/http-request/index.js";
|
|
25
|
+
import { HeartbeatPlugin } from "../worker/heartbeat/index.js";
|
|
26
|
+
import { EmailPlugin } from "../worker/email/index.js";
|
|
27
|
+
import { ErrorNotificationsPlugin } from "../worker/error-notifications/index.js";
|
|
28
|
+
import { BulkExportPlugin } from "../worker/bulk-export/index.js";
|
|
29
|
+
export function registerBasePlugins() {
|
|
30
|
+
pluginRegistry.register(GridFSPlugin);
|
|
31
|
+
pluginRegistry.register(TempUploadPlugin);
|
|
32
|
+
pluginRegistry.register(InvoicePlugin);
|
|
33
|
+
pluginRegistry.register(PostPlugin);
|
|
34
|
+
pluginRegistry.register(StorePlugin);
|
|
35
|
+
pluginRegistry.register(ERCMetadataPlugin);
|
|
36
|
+
pluginRegistry.register(PaymentFreePricePlugin);
|
|
37
|
+
pluginRegistry.register(DeliveryFreePricePlugin);
|
|
38
|
+
pluginRegistry.register(OrderItemsPlugin);
|
|
39
|
+
pluginRegistry.register(OrderDiscountPlugin);
|
|
40
|
+
pluginRegistry.register(OrderDeliveryPlugin);
|
|
41
|
+
pluginRegistry.register(OrderPaymentPlugin);
|
|
42
|
+
pluginRegistry.register(ProductPricePlugin);
|
|
43
|
+
pluginRegistry.register(ProductDiscountPlugin);
|
|
44
|
+
pluginRegistry.register(ManualOfferingPlugin);
|
|
45
|
+
pluginRegistry.register(LicensedEnrollmentsPlugin);
|
|
46
|
+
setEmitAdapter(NodeEventEmitter());
|
|
47
|
+
pluginRegistry.register(BulkImportPlugin);
|
|
48
|
+
pluginRegistry.register(ZombieKillerPlugin);
|
|
49
|
+
pluginRegistry.register(MessagePlugin);
|
|
50
|
+
pluginRegistry.register(ExternalPlugin);
|
|
51
|
+
pluginRegistry.register(HttpRequestPlugin);
|
|
52
|
+
pluginRegistry.register(HeartbeatPlugin);
|
|
53
|
+
pluginRegistry.register(EmailPlugin);
|
|
54
|
+
pluginRegistry.register(ErrorNotificationsPlugin);
|
|
55
|
+
pluginRegistry.register(BulkExportPlugin);
|
|
56
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import '../../pricing/delivery-swiss-tax.ts';
|
|
1
|
+
export declare function registerSwissTaxPlugins(): void;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import "../../pricing/product-swiss-tax.js";
|
|
2
|
-
import "../../pricing/delivery-swiss-tax.js";
|
|
1
|
+
import { ProductSwissTaxPlugin } from "../../pricing/product-swiss-tax/index.js";
|
|
2
|
+
import { DeliverySwissTaxPlugin } from "../../pricing/delivery-swiss-tax/index.js";
|
|
3
|
+
import { pluginRegistry } from '@unchainedshop/core';
|
|
4
|
+
export function registerSwissTaxPlugins() {
|
|
5
|
+
pluginRegistry.register(ProductSwissTaxPlugin);
|
|
6
|
+
pluginRegistry.register(DeliverySwissTaxPlugin);
|
|
7
|
+
}
|
package/lib/presets/crypto.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '../worker/update-ecb-rates.ts';
|
|
5
|
-
import '../worker/update-coinbase-rates.ts';
|
|
6
|
-
import '../worker/export-token.ts';
|
|
7
|
-
export default cryptopayModules;
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export declare function registerCryptoPlugins(): void;
|
package/lib/presets/crypto.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../worker/
|
|
6
|
-
import "../worker/
|
|
7
|
-
|
|
1
|
+
import { pluginRegistry } from '@unchainedshop/core';
|
|
2
|
+
import { CryptopayPlugin } from "../payment/cryptopay/index.js";
|
|
3
|
+
import { ETHMinterPlugin } from "../warehousing/eth-minter/index.js";
|
|
4
|
+
import { ProductPriceRateConversionPlugin } from "../pricing/product-price-rateconversion/index.js";
|
|
5
|
+
import { ExportTokenPlugin } from "../worker/export-token/index.js";
|
|
6
|
+
import { UpdateECBRatesPlugin } from "../worker/update-ecb-rates/index.js";
|
|
7
|
+
import { UpdateCoinbaseRatesPlugin } from "../worker/update-coinbase-rates/index.js";
|
|
8
|
+
import { UpdateTokenOwnershipPlugin } from "../worker/update-token-ownership/index.js";
|
|
9
|
+
export default {};
|
|
10
|
+
export function registerCryptoPlugins() {
|
|
11
|
+
pluginRegistry.register(CryptopayPlugin);
|
|
12
|
+
pluginRegistry.register(ETHMinterPlugin);
|
|
13
|
+
pluginRegistry.register(ProductPriceRateConversionPlugin);
|
|
14
|
+
pluginRegistry.register(ExportTokenPlugin);
|
|
15
|
+
pluginRegistry.register(UpdateECBRatesPlugin);
|
|
16
|
+
pluginRegistry.register(UpdateCoinbaseRatesPlugin);
|
|
17
|
+
pluginRegistry.register(UpdateTokenOwnershipPlugin);
|
|
18
|
+
}
|