@unchainedshop/plugins 4.3.5 → 4.4.0
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 +137 -0
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/post.js +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/send-message.js +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/delivery/stores.js +0 -1
- package/lib/enrollments/licensed.d.ts +0 -1
- package/lib/enrollments/licensed.js +0 -1
- package/lib/events/aws-eventbridge.d.ts +0 -1
- package/lib/events/aws-eventbridge.js +0 -3
- package/lib/events/node-event-emitter.d.ts +0 -1
- package/lib/events/node-event-emitter.js +0 -1
- package/lib/events/redis.d.ts +0 -1
- package/lib/events/redis.js +0 -1
- package/lib/files/gridfs/adapter.d.ts +3 -4
- package/lib/files/gridfs/adapter.js +6 -6
- package/lib/files/gridfs/handler-express.d.ts +2 -3
- package/lib/files/gridfs/handler-express.js +6 -9
- package/lib/files/gridfs/handler-fastify.d.ts +1 -2
- package/lib/files/gridfs/handler-fastify.js +6 -9
- package/lib/files/gridfs/index.d.ts +2 -3
- package/lib/files/gridfs/index.js +2 -3
- package/lib/files/gridfs/module.d.ts +0 -1
- package/lib/files/gridfs/module.js +0 -4
- package/lib/files/gridfs/sign.d.ts +0 -1
- package/lib/files/gridfs/sign.js +0 -1
- package/lib/files/minio/handler-express.d.ts +0 -1
- package/lib/files/minio/handler-express.js +0 -1
- package/lib/files/minio/handler-fastify.d.ts +1 -2
- package/lib/files/minio/handler-fastify.js +2 -1
- package/lib/files/minio/index.d.ts +1 -2
- package/lib/files/minio/index.js +1 -5
- package/lib/filters/local-search.d.ts +1 -2
- package/lib/filters/local-search.js +3 -6
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/filters/strict-equal.js +0 -1
- package/lib/payment/apple-iap/adapter.d.ts +0 -1
- package/lib/payment/apple-iap/adapter.js +3 -5
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -2
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +2 -1
- package/lib/payment/apple-iap/fix-periods.d.ts +1 -2
- package/lib/payment/apple-iap/fix-periods.js +1 -1
- package/lib/payment/apple-iap/handler-express.d.ts +0 -1
- package/lib/payment/apple-iap/handler-express.js +2 -5
- package/lib/payment/apple-iap/handler-fastify.d.ts +1 -2
- package/lib/payment/apple-iap/handler-fastify.js +4 -5
- package/lib/payment/apple-iap/index.d.ts +2 -3
- package/lib/payment/apple-iap/index.js +2 -3
- package/lib/payment/apple-iap/module.d.ts +1 -2
- package/lib/payment/apple-iap/module.js +1 -2
- package/lib/payment/apple-iap/verify-receipt.d.ts +0 -1
- package/lib/payment/apple-iap/verify-receipt.js +0 -4
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -5
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -2
- package/lib/payment/cryptopay/db/CryptopayTransactions.js +2 -1
- package/lib/payment/cryptopay/denote-amount.d.ts +0 -24
- package/lib/payment/cryptopay/denote-amount.js +2 -26
- package/lib/payment/cryptopay/derive-btc-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js +4 -14
- package/lib/payment/cryptopay/derive-eth-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js +1 -3
- package/lib/payment/cryptopay/handle-webhook.d.ts +2 -3
- package/lib/payment/cryptopay/handle-webhook.js +3 -3
- package/lib/payment/cryptopay/handler-express.d.ts +0 -1
- package/lib/payment/cryptopay/handler-express.js +1 -2
- package/lib/payment/cryptopay/handler-fastify.d.ts +1 -2
- package/lib/payment/cryptopay/handler-fastify.js +2 -2
- package/lib/payment/cryptopay/index.d.ts +2 -3
- package/lib/payment/cryptopay/index.js +2 -3
- package/lib/payment/cryptopay/module.d.ts +1 -2
- package/lib/payment/cryptopay/module.js +2 -3
- package/lib/payment/cryptopay/plugin.d.ts +1 -2
- package/lib/payment/cryptopay/plugin.js +8 -37
- package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorize.js +0 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/cancel.js +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +8 -9
- package/lib/payment/datatrans-v2/api/index.js +9 -10
- package/lib/payment/datatrans-v2/api/init.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/init.js +2 -4
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -3
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/secureFields.js +1 -3
- package/lib/payment/datatrans-v2/api/settle.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/settle.js +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/status.js +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/types.js +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/validate.js +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js +0 -2
- package/lib/payment/datatrans-v2/getPaths.d.ts +0 -1
- package/lib/payment/datatrans-v2/getPaths.js +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +1 -2
- package/lib/payment/datatrans-v2/index.d.ts +0 -1
- package/lib/payment/datatrans-v2/index.js +3 -14
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -5
- package/lib/payment/datatrans-v2/parseRegistrationData.js +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js +0 -2
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice-prepaid.js +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/invoice.js +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -11
- package/lib/payment/payrexx/api/index.d.ts +15 -15
- package/lib/payment/payrexx/api/index.js +15 -27
- package/lib/payment/payrexx/api/makeFetcher.d.ts +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js +0 -1
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -4
- package/lib/payment/payrexx/handler-fastify.d.ts +1 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -4
- package/lib/payment/payrexx/index.d.ts +0 -1
- package/lib/payment/payrexx/index.js +9 -35
- package/lib/payment/payrexx/payrexx.d.ts +0 -1
- package/lib/payment/payrexx/payrexx.js +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts +0 -1
- package/lib/payment/postfinance-checkout/api-client.js +0 -6
- package/lib/payment/postfinance-checkout/api-types.d.ts +49 -44
- package/lib/payment/postfinance-checkout/api-types.js +43 -51
- package/lib/payment/postfinance-checkout/api.d.ts +1 -2
- package/lib/payment/postfinance-checkout/api.js +2 -3
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +1 -2
- package/lib/payment/postfinance-checkout/index.d.ts +2 -3
- package/lib/payment/postfinance-checkout/index.js +7 -10
- package/lib/payment/postfinance-checkout/types.d.ts +11 -10
- package/lib/payment/postfinance-checkout/types.js +9 -12
- package/lib/payment/postfinance-checkout/utils.d.ts +2 -3
- package/lib/payment/postfinance-checkout/utils.js +1 -2
- package/lib/payment/saferpay/adapter.d.ts +1 -2
- package/lib/payment/saferpay/adapter.js +2 -5
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts +6 -7
- package/lib/payment/saferpay/api/api/SaferpayClient.js +2 -2
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js +0 -1
- package/lib/payment/saferpay/api/index.d.ts +4 -5
- package/lib/payment/saferpay/api/index.js +1 -2
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Request.js +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Response.js +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts +2 -3
- package/lib/payment/saferpay/api/models/TransactionCancel.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts +3 -4
- package/lib/payment/saferpay/api/models/TransactionCapture.js +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts +0 -1
- package/lib/payment/saferpay/buildSignature.js +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -2
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js +1 -1
- package/lib/payment/saferpay/getReturnPath.d.ts +0 -1
- package/lib/payment/saferpay/getReturnPath.js +0 -1
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +1 -2
- package/lib/payment/saferpay/handler-fastify.d.ts +1 -2
- package/lib/payment/saferpay/handler-fastify.js +1 -2
- package/lib/payment/saferpay/index.d.ts +2 -3
- package/lib/payment/saferpay/index.js +2 -3
- package/lib/payment/saferpay/module.d.ts +2 -3
- package/lib/payment/saferpay/module.js +2 -2
- package/lib/payment/stripe/handler-express.d.ts +0 -1
- package/lib/payment/stripe/handler-express.js +1 -2
- package/lib/payment/stripe/handler-fastify.d.ts +1 -2
- package/lib/payment/stripe/handler-fastify.js +1 -2
- package/lib/payment/stripe/index.d.ts +0 -1
- package/lib/payment/stripe/index.js +1 -4
- package/lib/payment/stripe/stripe.d.ts +1 -2
- package/lib/payment/stripe/stripe.js +1 -2
- package/lib/presets/all-express.d.ts +1 -2
- package/lib/presets/all-express.js +9 -10
- package/lib/presets/all-fastify.d.ts +2 -3
- package/lib/presets/all-fastify.js +9 -10
- package/lib/presets/all.d.ts +23 -24
- package/lib/presets/all.js +20 -25
- package/lib/presets/base-express.d.ts +0 -1
- package/lib/presets/base-express.js +1 -2
- package/lib/presets/base-fastify.d.ts +1 -2
- package/lib/presets/base-fastify.js +1 -3
- package/lib/presets/base.d.ts +23 -24
- package/lib/presets/base.js +23 -33
- package/lib/presets/countries/ch.d.ts +2 -3
- package/lib/presets/countries/ch.js +2 -3
- package/lib/presets/crypto-express.d.ts +1 -2
- package/lib/presets/crypto-express.js +2 -3
- package/lib/presets/crypto-fastify.d.ts +1 -2
- package/lib/presets/crypto-fastify.js +2 -3
- package/lib/presets/crypto.d.ts +6 -7
- package/lib/presets/crypto.js +6 -8
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -2
- package/lib/pricing/delivery-swiss-tax.js +2 -3
- package/lib/pricing/discount-100-off.d.ts +1 -2
- package/lib/pricing/discount-100-off.js +0 -4
- package/lib/pricing/discount-half-price-manual.d.ts +1 -2
- package/lib/pricing/discount-half-price-manual.js +0 -4
- package/lib/pricing/discount-half-price.d.ts +1 -2
- package/lib/pricing/discount-half-price.js +0 -4
- package/lib/pricing/free-delivery.d.ts +1 -2
- package/lib/pricing/free-delivery.js +0 -1
- package/lib/pricing/free-payment.d.ts +1 -2
- package/lib/pricing/free-payment.js +0 -1
- package/lib/pricing/order-delivery.d.ts +1 -2
- package/lib/pricing/order-delivery.js +0 -2
- package/lib/pricing/order-discount.d.ts +1 -2
- package/lib/pricing/order-discount.js +0 -4
- package/lib/pricing/order-items-discount.d.ts +0 -1
- package/lib/pricing/order-items-discount.js +0 -5
- package/lib/pricing/order-items.d.ts +0 -1
- package/lib/pricing/order-items.js +0 -2
- package/lib/pricing/order-payment.d.ts +0 -1
- package/lib/pricing/order-payment.js +0 -2
- package/lib/pricing/order-round.d.ts +1 -2
- package/lib/pricing/order-round.js +0 -6
- package/lib/pricing/product-catalog-price-options.d.ts +0 -1
- package/lib/pricing/product-catalog-price-options.js +0 -1
- package/lib/pricing/product-catalog-price.d.ts +1 -2
- package/lib/pricing/product-catalog-price.js +2 -3
- package/lib/pricing/product-discount.d.ts +0 -1
- package/lib/pricing/product-discount.js +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts +1 -2
- package/lib/pricing/product-price-rateconversion.js +0 -4
- package/lib/pricing/product-round.d.ts +1 -2
- package/lib/pricing/product-round.js +0 -1
- package/lib/pricing/product-swiss-tax.d.ts +1 -2
- package/lib/pricing/product-swiss-tax.js +2 -5
- package/lib/pricing/tax/ch.d.ts +2 -3
- package/lib/pricing/tax/ch.js +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts +1 -2
- package/lib/pricing/utils/isDeliveryAddressInCountry.js +0 -1
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/quotations/manual.js +0 -1
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/eth-minter.js +2 -11
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/warehousing/store.js +0 -1
- package/lib/worker/budgetsms.d.ts +0 -1
- package/lib/worker/budgetsms.js +4 -52
- package/lib/worker/bulk-import.d.ts +1 -2
- package/lib/worker/bulk-import.js +1 -3
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/bulkgate.js +7 -20
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/email.js +0 -3
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.js +1 -2
- package/lib/worker/error-notifications.d.ts +1 -2
- package/lib/worker/error-notifications.js +0 -1
- package/lib/worker/export-token.d.ts +1 -2
- package/lib/worker/export-token.js +1 -2
- package/lib/worker/external.d.ts +1 -2
- package/lib/worker/external.js +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/heartbeat.js +0 -1
- package/lib/worker/http-request.d.ts +1 -2
- package/lib/worker/http-request.js +0 -3
- package/lib/worker/message.d.ts +2 -3
- package/lib/worker/message.js +2 -3
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/push-notification.js +0 -1
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/twilio.js +1 -2
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.js +1 -3
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.js +0 -3
- package/lib/worker/update-token-ownership.d.ts +1 -2
- package/lib/worker/update-token-ownership.js +0 -1
- package/lib/worker/zombie-killer.d.ts +1 -2
- package/lib/worker/zombie-killer.js +0 -7
- package/package.json +20 -19
- package/lib/delivery/post.d.ts.map +0 -1
- package/lib/delivery/post.js.map +0 -1
- package/lib/delivery/send-message.d.ts.map +0 -1
- package/lib/delivery/send-message.js.map +0 -1
- package/lib/delivery/stores.d.ts.map +0 -1
- package/lib/delivery/stores.js.map +0 -1
- package/lib/enrollments/licensed.d.ts.map +0 -1
- package/lib/enrollments/licensed.js.map +0 -1
- package/lib/events/aws-eventbridge.d.ts.map +0 -1
- package/lib/events/aws-eventbridge.js.map +0 -1
- package/lib/events/node-event-emitter.d.ts.map +0 -1
- package/lib/events/node-event-emitter.js.map +0 -1
- package/lib/events/redis.d.ts.map +0 -1
- package/lib/events/redis.js.map +0 -1
- package/lib/files/gridfs/adapter.d.ts.map +0 -1
- package/lib/files/gridfs/adapter.js.map +0 -1
- package/lib/files/gridfs/handler-express.d.ts.map +0 -1
- package/lib/files/gridfs/handler-express.js.map +0 -1
- package/lib/files/gridfs/handler-fastify.d.ts.map +0 -1
- package/lib/files/gridfs/handler-fastify.js.map +0 -1
- package/lib/files/gridfs/index.d.ts.map +0 -1
- package/lib/files/gridfs/index.js.map +0 -1
- package/lib/files/gridfs/module.d.ts.map +0 -1
- package/lib/files/gridfs/module.js.map +0 -1
- package/lib/files/gridfs/sign.d.ts.map +0 -1
- package/lib/files/gridfs/sign.js.map +0 -1
- package/lib/files/minio/handler-express.d.ts.map +0 -1
- package/lib/files/minio/handler-express.js.map +0 -1
- package/lib/files/minio/handler-fastify.d.ts.map +0 -1
- package/lib/files/minio/handler-fastify.js.map +0 -1
- package/lib/files/minio/index.d.ts.map +0 -1
- package/lib/files/minio/index.js.map +0 -1
- package/lib/filters/local-search.d.ts.map +0 -1
- package/lib/filters/local-search.js.map +0 -1
- package/lib/filters/strict-equal.d.ts.map +0 -1
- package/lib/filters/strict-equal.js.map +0 -1
- package/lib/payment/apple-iap/adapter.d.ts.map +0 -1
- package/lib/payment/apple-iap/adapter.js.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +0 -1
- package/lib/payment/apple-iap/fix-periods.d.ts.map +0 -1
- package/lib/payment/apple-iap/fix-periods.js.map +0 -1
- package/lib/payment/apple-iap/handler-express.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-express.js.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.js.map +0 -1
- package/lib/payment/apple-iap/index.d.ts.map +0 -1
- package/lib/payment/apple-iap/index.js.map +0 -1
- package/lib/payment/apple-iap/module.d.ts.map +0 -1
- package/lib/payment/apple-iap/module.js.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.d.ts.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.js.map +0 -1
- package/lib/payment/braintree.d.ts.map +0 -1
- package/lib/payment/braintree.js.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.js.map +0 -1
- package/lib/payment/cryptopay/denote-amount.d.ts.map +0 -1
- package/lib/payment/cryptopay/denote-amount.js.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.d.ts.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.js.map +0 -1
- package/lib/payment/cryptopay/handler-express.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-express.js.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.js.map +0 -1
- package/lib/payment/cryptopay/index.d.ts.map +0 -1
- package/lib/payment/cryptopay/index.js.map +0 -1
- package/lib/payment/cryptopay/module.d.ts.map +0 -1
- package/lib/payment/cryptopay/module.js.map +0 -1
- package/lib/payment/cryptopay/plugin.d.ts.map +0 -1
- package/lib/payment/cryptopay/plugin.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.js.map +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/index.js.map +0 -1
- package/lib/payment/datatrans-v2/api/init.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/init.js.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.js.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.js.map +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/status.js.map +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/types.js.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.js.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.js.map +0 -1
- package/lib/payment/datatrans-v2/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/index.js.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js.map +0 -1
- package/lib/payment/invoice-prepaid.d.ts.map +0 -1
- package/lib/payment/invoice-prepaid.js.map +0 -1
- package/lib/payment/invoice.d.ts.map +0 -1
- package/lib/payment/invoice.js.map +0 -1
- package/lib/payment/paypal-checkout.d.ts.map +0 -1
- package/lib/payment/paypal-checkout.js.map +0 -1
- package/lib/payment/payrexx/api/index.d.ts.map +0 -1
- package/lib/payment/payrexx/api/index.js.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js.map +0 -1
- package/lib/payment/payrexx/handler-express.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-express.js.map +0 -1
- package/lib/payment/payrexx/handler-fastify.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-fastify.js.map +0 -1
- package/lib/payment/payrexx/index.d.ts.map +0 -1
- package/lib/payment/payrexx/index.js.map +0 -1
- package/lib/payment/payrexx/payrexx.d.ts.map +0 -1
- package/lib/payment/payrexx/payrexx.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.js.map +0 -1
- package/lib/payment/postfinance-checkout/api.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.js.map +0 -1
- package/lib/payment/postfinance-checkout/index.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/index.js.map +0 -1
- package/lib/payment/postfinance-checkout/types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/types.js.map +0 -1
- package/lib/payment/postfinance-checkout/utils.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/utils.js.map +0 -1
- package/lib/payment/saferpay/adapter.d.ts.map +0 -1
- package/lib/payment/saferpay/adapter.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js.map +0 -1
- package/lib/payment/saferpay/api/index.d.ts.map +0 -1
- package/lib/payment/saferpay/api/index.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js.map +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Request.js.map +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Response.js.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.js.map +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts.map +0 -1
- package/lib/payment/saferpay/buildSignature.js.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js.map +0 -1
- package/lib/payment/saferpay/getReturnPath.d.ts.map +0 -1
- package/lib/payment/saferpay/getReturnPath.js.map +0 -1
- package/lib/payment/saferpay/handler-express.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-express.js.map +0 -1
- package/lib/payment/saferpay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-fastify.js.map +0 -1
- package/lib/payment/saferpay/index.d.ts.map +0 -1
- package/lib/payment/saferpay/index.js.map +0 -1
- package/lib/payment/saferpay/module.d.ts.map +0 -1
- package/lib/payment/saferpay/module.js.map +0 -1
- package/lib/payment/stripe/handler-express.d.ts.map +0 -1
- package/lib/payment/stripe/handler-express.js.map +0 -1
- package/lib/payment/stripe/handler-fastify.d.ts.map +0 -1
- package/lib/payment/stripe/handler-fastify.js.map +0 -1
- package/lib/payment/stripe/index.d.ts.map +0 -1
- package/lib/payment/stripe/index.js.map +0 -1
- package/lib/payment/stripe/stripe.d.ts.map +0 -1
- package/lib/payment/stripe/stripe.js.map +0 -1
- package/lib/presets/all-express.d.ts.map +0 -1
- package/lib/presets/all-express.js.map +0 -1
- package/lib/presets/all-fastify.d.ts.map +0 -1
- package/lib/presets/all-fastify.js.map +0 -1
- package/lib/presets/all.d.ts.map +0 -1
- package/lib/presets/all.js.map +0 -1
- package/lib/presets/base-express.d.ts.map +0 -1
- package/lib/presets/base-express.js.map +0 -1
- package/lib/presets/base-fastify.d.ts.map +0 -1
- package/lib/presets/base-fastify.js.map +0 -1
- package/lib/presets/base.d.ts.map +0 -1
- package/lib/presets/base.js.map +0 -1
- package/lib/presets/countries/ch.d.ts.map +0 -1
- package/lib/presets/countries/ch.js.map +0 -1
- package/lib/presets/crypto-express.d.ts.map +0 -1
- package/lib/presets/crypto-express.js.map +0 -1
- package/lib/presets/crypto-fastify.d.ts.map +0 -1
- package/lib/presets/crypto-fastify.js.map +0 -1
- package/lib/presets/crypto.d.ts.map +0 -1
- package/lib/presets/crypto.js.map +0 -1
- package/lib/pricing/delivery-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/delivery-swiss-tax.js.map +0 -1
- package/lib/pricing/discount-100-off.d.ts.map +0 -1
- package/lib/pricing/discount-100-off.js.map +0 -1
- package/lib/pricing/discount-half-price-manual.d.ts.map +0 -1
- package/lib/pricing/discount-half-price-manual.js.map +0 -1
- package/lib/pricing/discount-half-price.d.ts.map +0 -1
- package/lib/pricing/discount-half-price.js.map +0 -1
- package/lib/pricing/free-delivery.d.ts.map +0 -1
- package/lib/pricing/free-delivery.js.map +0 -1
- package/lib/pricing/free-payment.d.ts.map +0 -1
- package/lib/pricing/free-payment.js.map +0 -1
- package/lib/pricing/order-delivery.d.ts.map +0 -1
- package/lib/pricing/order-delivery.js.map +0 -1
- package/lib/pricing/order-discount.d.ts.map +0 -1
- package/lib/pricing/order-discount.js.map +0 -1
- package/lib/pricing/order-items-discount.d.ts.map +0 -1
- package/lib/pricing/order-items-discount.js.map +0 -1
- package/lib/pricing/order-items.d.ts.map +0 -1
- package/lib/pricing/order-items.js.map +0 -1
- package/lib/pricing/order-payment.d.ts.map +0 -1
- package/lib/pricing/order-payment.js.map +0 -1
- package/lib/pricing/order-round.d.ts.map +0 -1
- package/lib/pricing/order-round.js.map +0 -1
- package/lib/pricing/product-catalog-price-options.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price-options.js.map +0 -1
- package/lib/pricing/product-catalog-price.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price.js.map +0 -1
- package/lib/pricing/product-discount.d.ts.map +0 -1
- package/lib/pricing/product-discount.js.map +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts.map +0 -1
- package/lib/pricing/product-price-rateconversion.js.map +0 -1
- package/lib/pricing/product-round.d.ts.map +0 -1
- package/lib/pricing/product-round.js.map +0 -1
- package/lib/pricing/product-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/product-swiss-tax.js.map +0 -1
- package/lib/pricing/tax/ch.d.ts.map +0 -1
- package/lib/pricing/tax/ch.js.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.js.map +0 -1
- package/lib/quotations/manual.d.ts.map +0 -1
- package/lib/quotations/manual.js.map +0 -1
- package/lib/warehousing/eth-minter.d.ts.map +0 -1
- package/lib/warehousing/eth-minter.js.map +0 -1
- package/lib/warehousing/store.d.ts.map +0 -1
- package/lib/warehousing/store.js.map +0 -1
- package/lib/worker/budgetsms.d.ts.map +0 -1
- package/lib/worker/budgetsms.js.map +0 -1
- package/lib/worker/bulk-import.d.ts.map +0 -1
- package/lib/worker/bulk-import.js.map +0 -1
- package/lib/worker/bulkgate.d.ts.map +0 -1
- package/lib/worker/bulkgate.js.map +0 -1
- package/lib/worker/email.d.ts.map +0 -1
- package/lib/worker/email.js.map +0 -1
- package/lib/worker/enrollment-order-generator.d.ts.map +0 -1
- package/lib/worker/enrollment-order-generator.js.map +0 -1
- package/lib/worker/error-notifications.d.ts.map +0 -1
- package/lib/worker/error-notifications.js.map +0 -1
- package/lib/worker/export-token.d.ts.map +0 -1
- package/lib/worker/export-token.js.map +0 -1
- package/lib/worker/external.d.ts.map +0 -1
- package/lib/worker/external.js.map +0 -1
- package/lib/worker/heartbeat.d.ts.map +0 -1
- package/lib/worker/heartbeat.js.map +0 -1
- package/lib/worker/http-request.d.ts.map +0 -1
- package/lib/worker/http-request.js.map +0 -1
- package/lib/worker/message.d.ts.map +0 -1
- package/lib/worker/message.js.map +0 -1
- package/lib/worker/push-notification.d.ts.map +0 -1
- package/lib/worker/push-notification.js.map +0 -1
- package/lib/worker/twilio.d.ts.map +0 -1
- package/lib/worker/twilio.js.map +0 -1
- package/lib/worker/update-coinbase-rates.d.ts.map +0 -1
- package/lib/worker/update-coinbase-rates.js.map +0 -1
- package/lib/worker/update-ecb-rates.d.ts.map +0 -1
- package/lib/worker/update-ecb-rates.js.map +0 -1
- package/lib/worker/update-token-ownership.d.ts.map +0 -1
- package/lib/worker/update-token-ownership.js.map +0 -1
- package/lib/worker/zombie-killer.d.ts.map +0 -1
- package/lib/worker/zombie-killer.js.map +0 -1
- package/readme.md +0 -5
- package/src/delivery/post.ts +0 -30
- package/src/delivery/send-message.ts +0 -50
- package/src/delivery/stores.ts +0 -53
- package/src/enrollments/licensed.ts +0 -61
- package/src/events/aws-eventbridge.ts +0 -45
- package/src/events/node-event-emitter.ts +0 -18
- package/src/events/redis.ts +0 -34
- package/src/files/gridfs/adapter.ts +0 -176
- package/src/files/gridfs/handler-express.ts +0 -145
- package/src/files/gridfs/handler-fastify.ts +0 -177
- package/src/files/gridfs/index.ts +0 -6
- package/src/files/gridfs/module.ts +0 -54
- package/src/files/gridfs/sign.ts +0 -28
- package/src/files/minio/handler-express.ts +0 -35
- package/src/files/minio/handler-fastify.ts +0 -44
- package/src/files/minio/index.ts +0 -232
- package/src/filters/local-search.ts +0 -101
- package/src/filters/strict-equal.ts +0 -30
- package/src/payment/apple-iap/adapter.ts +0 -153
- package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +0 -14
- package/src/payment/apple-iap/fix-periods.ts +0 -31
- package/src/payment/apple-iap/handler-express.ts +0 -140
- package/src/payment/apple-iap/handler-fastify.ts +0 -147
- package/src/payment/apple-iap/index.ts +0 -6
- package/src/payment/apple-iap/module.ts +0 -34
- package/src/payment/apple-iap/verify-receipt.ts +0 -27
- package/src/payment/braintree.ts +0 -167
- package/src/payment/cryptopay/db/CryptopayTransactions.ts +0 -16
- package/src/payment/cryptopay/denote-amount.test.ts +0 -28
- package/src/payment/cryptopay/denote-amount.ts +0 -29
- package/src/payment/cryptopay/derive-btc-address.test.ts +0 -22
- package/src/payment/cryptopay/derive-btc-address.ts +0 -46
- package/src/payment/cryptopay/derive-eth-address.test.ts +0 -22
- package/src/payment/cryptopay/derive-eth-address.ts +0 -40
- package/src/payment/cryptopay/handle-webhook.ts +0 -103
- package/src/payment/cryptopay/handler-express.ts +0 -21
- package/src/payment/cryptopay/handler-fastify.ts +0 -24
- package/src/payment/cryptopay/index.ts +0 -7
- package/src/payment/cryptopay/module.ts +0 -138
- package/src/payment/cryptopay/plugin.ts +0 -282
- package/src/payment/cryptopay/readme.md +0 -23
- package/src/payment/datatrans-v2/api/authorize.ts +0 -17
- package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +0 -20
- package/src/payment/datatrans-v2/api/cancel.ts +0 -13
- package/src/payment/datatrans-v2/api/index.ts +0 -24
- package/src/payment/datatrans-v2/api/init.ts +0 -43
- package/src/payment/datatrans-v2/api/makeFetcher.ts +0 -52
- package/src/payment/datatrans-v2/api/secureFields.ts +0 -19
- package/src/payment/datatrans-v2/api/settle.ts +0 -13
- package/src/payment/datatrans-v2/api/status.ts +0 -8
- package/src/payment/datatrans-v2/api/types.ts +0 -378
- package/src/payment/datatrans-v2/api/validate.ts +0 -13
- package/src/payment/datatrans-v2/generateSignature.test.ts +0 -18
- package/src/payment/datatrans-v2/generateSignature.ts +0 -36
- package/src/payment/datatrans-v2/getPaths.ts +0 -25
- package/src/payment/datatrans-v2/handler-express.ts +0 -91
- package/src/payment/datatrans-v2/handler-fastify.ts +0 -97
- package/src/payment/datatrans-v2/index.ts +0 -524
- package/src/payment/datatrans-v2/parseRegistrationData.ts +0 -34
- package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +0 -16
- package/src/payment/datatrans-v2/splitProperties.ts +0 -58
- package/src/payment/invoice-prepaid.ts +0 -40
- package/src/payment/invoice.ts +0 -36
- package/src/payment/paypal-checkout.ts +0 -127
- package/src/payment/payrexx/api/index.ts +0 -84
- package/src/payment/payrexx/api/makeFetcher.ts +0 -83
- package/src/payment/payrexx/handler-express.ts +0 -93
- package/src/payment/payrexx/handler-fastify.ts +0 -105
- package/src/payment/payrexx/index.ts +0 -248
- package/src/payment/payrexx/payrexx.ts +0 -65
- package/src/payment/payrexx/readme.md +0 -4
- package/src/payment/postfinance-checkout/api-client.ts +0 -111
- package/src/payment/postfinance-checkout/api-types.ts +0 -111
- package/src/payment/postfinance-checkout/api.ts +0 -114
- package/src/payment/postfinance-checkout/handler-express.ts +0 -44
- package/src/payment/postfinance-checkout/handler-fastify.ts +0 -53
- package/src/payment/postfinance-checkout/index.ts +0 -271
- package/src/payment/postfinance-checkout/types.ts +0 -27
- package/src/payment/postfinance-checkout/utils.ts +0 -39
- package/src/payment/saferpay/adapter.ts +0 -273
- package/src/payment/saferpay/api/api/SaferpayClient.ts +0 -79
- package/src/payment/saferpay/api/api/SaferpayConnection.ts +0 -36
- package/src/payment/saferpay/api/index.ts +0 -8
- package/src/payment/saferpay/api/models/PaymentMethods.ts +0 -26
- package/src/payment/saferpay/api/models/PaymentPageAssert.ts +0 -75
- package/src/payment/saferpay/api/models/PaymentPageInitialize.ts +0 -58
- package/src/payment/saferpay/api/models/Request.ts +0 -14
- package/src/payment/saferpay/api/models/Response.ts +0 -9
- package/src/payment/saferpay/api/models/Transaction.ts +0 -6
- package/src/payment/saferpay/api/models/TransactionCancel.ts +0 -15
- package/src/payment/saferpay/api/models/TransactionCapture.ts +0 -20
- package/src/payment/saferpay/buildSignature.ts +0 -9
- package/src/payment/saferpay/db/SaferpayTransactionsCollection.ts +0 -13
- package/src/payment/saferpay/getReturnPath.ts +0 -10
- package/src/payment/saferpay/handler-express.ts +0 -71
- package/src/payment/saferpay/handler-fastify.ts +0 -80
- package/src/payment/saferpay/index.ts +0 -6
- package/src/payment/saferpay/module.ts +0 -41
- package/src/payment/stripe/handler-express.ts +0 -135
- package/src/payment/stripe/handler-fastify.ts +0 -151
- package/src/payment/stripe/index.ts +0 -163
- package/src/payment/stripe/readme.md +0 -12
- package/src/payment/stripe/stripe.ts +0 -137
- package/src/presets/all-express.ts +0 -51
- package/src/presets/all-fastify.ts +0 -72
- package/src/presets/all.ts +0 -37
- package/src/presets/base-express.ts +0 -7
- package/src/presets/base-fastify.ts +0 -20
- package/src/presets/base.ts +0 -42
- package/src/presets/countries/ch.ts +0 -2
- package/src/presets/crypto-express.ts +0 -12
- package/src/presets/crypto-fastify.ts +0 -15
- package/src/presets/crypto.ts +0 -11
- package/src/pricing/delivery-swiss-tax.ts +0 -78
- package/src/pricing/discount-100-off.test.ts +0 -41
- package/src/pricing/discount-100-off.ts +0 -48
- package/src/pricing/discount-half-price-manual.test.ts +0 -52
- package/src/pricing/discount-half-price-manual.ts +0 -47
- package/src/pricing/discount-half-price.test.ts +0 -52
- package/src/pricing/discount-half-price.ts +0 -50
- package/src/pricing/free-delivery.test.ts +0 -10
- package/src/pricing/free-delivery.ts +0 -36
- package/src/pricing/free-payment.ts +0 -37
- package/src/pricing/licenced-enrollment.test.ts +0 -38
- package/src/pricing/order-delivery.test.ts +0 -9
- package/src/pricing/order-delivery.ts +0 -47
- package/src/pricing/order-discount.test.ts +0 -10
- package/src/pricing/order-discount.ts +0 -123
- package/src/pricing/order-items-discount.ts +0 -86
- package/src/pricing/order-items.ts +0 -61
- package/src/pricing/order-payment.ts +0 -48
- package/src/pricing/order-round.ts +0 -174
- package/src/pricing/plugins-index.test.ts +0 -5
- package/src/pricing/product-catalog-price-options.ts +0 -67
- package/src/pricing/product-catalog-price.ts +0 -71
- package/src/pricing/product-discount.ts +0 -97
- package/src/pricing/product-price-rateconversion.ts +0 -74
- package/src/pricing/product-round.ts +0 -66
- package/src/pricing/product-swiss-tax.ts +0 -102
- package/src/pricing/tax/ch.test.ts +0 -20
- package/src/pricing/tax/ch.ts +0 -65
- package/src/pricing/utils/isDeliveryAddressInCountry.test.ts +0 -106
- package/src/pricing/utils/isDeliveryAddressInCountry.ts +0 -26
- package/src/quotations/manual.ts +0 -26
- package/src/warehousing/eth-minter.ts +0 -167
- package/src/warehousing/store.ts +0 -45
- package/src/worker/budgetsms.ts +0 -268
- package/src/worker/bulk-import.ts +0 -77
- package/src/worker/bulkgate.ts +0 -138
- package/src/worker/email.ts +0 -165
- package/src/worker/enrollment-order-generator.ts +0 -94
- package/src/worker/error-notifications.ts +0 -83
- package/src/worker/export-token.ts +0 -32
- package/src/worker/external.ts +0 -17
- package/src/worker/heartbeat.ts +0 -37
- package/src/worker/http-request.ts +0 -71
- package/src/worker/message.ts +0 -56
- package/src/worker/push-notification.ts +0 -121
- package/src/worker/twilio.ts +0 -78
- package/src/worker/update-coinbase-rates.ts +0 -76
- package/src/worker/update-ecb-rates.ts +0 -115
- package/src/worker/update-token-ownership.ts +0 -70
- package/src/worker/zombie-killer.ts +0 -139
- package/tests/mock/datatrans/v1/secure-fields.json +0 -4
- package/tests/mock/datatrans/v1/transactions/authorize.json +0 -48
- package/tests/mock/datatrans/v1/transactions/card_check_authorized.json +0 -47
- package/tests/mock/datatrans/v1/transactions/payment_alias_authorized/settle.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_alias_authorized.json +0 -48
- package/tests/mock/datatrans/v1/transactions/payment_authorized/cancel.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized/settle.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized.json +0 -48
- package/tests/mock/datatrans/v1/transactions/payment_authorized_low_amount/cancel.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized_low_amount.json +0 -48
- package/tests/mock/datatrans/v1/transactions/validate.json +0 -1
- package/tests/mock/datatrans/v1/transactions.json +0 -4
- package/tests/mock/payrexx/Gateway/1000001.json +0 -106
- package/tests/mock/payrexx/Gateway.json +0 -24
- package/tests/mock/payrexx/transaction_example1.json +0 -65
- package/tests/mock/payrexx/transaction_example2.json +0 -65
- package/tests/mock/payrexx/transaction_example3.json +0 -94
- package/tsconfig.json +0 -9
package/src/worker/bulkgate.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { IWorkerAdapter, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
|
|
3
|
-
const { BULKGATE_APPLICATION_ID, BULKGATE_APPLICATION_TOKEN } = process.env;
|
|
4
|
-
|
|
5
|
-
// BulkGate Simple API for SMS (transactional by default, promotional via boolean)
|
|
6
|
-
const BulkGateWorker: IWorkerAdapter<
|
|
7
|
-
{
|
|
8
|
-
from?: string;
|
|
9
|
-
to?: string;
|
|
10
|
-
text?: string;
|
|
11
|
-
unicode?: boolean;
|
|
12
|
-
country?: string;
|
|
13
|
-
schedule?: string | number; // ISO 8601 format or Unix timestamp
|
|
14
|
-
promotional?: boolean; // Set to true for promotional SMS, defaults to transactional
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
},
|
|
17
|
-
any
|
|
18
|
-
> = {
|
|
19
|
-
...WorkerAdapter,
|
|
20
|
-
|
|
21
|
-
key: 'shop.unchained.worker-plugin.bulkgate',
|
|
22
|
-
label: 'Send SMS through BulkGate',
|
|
23
|
-
version: '1.0.0',
|
|
24
|
-
|
|
25
|
-
type: 'BULKGATE',
|
|
26
|
-
|
|
27
|
-
doWork: async ({
|
|
28
|
-
from,
|
|
29
|
-
to,
|
|
30
|
-
text,
|
|
31
|
-
unicode = false,
|
|
32
|
-
country,
|
|
33
|
-
schedule,
|
|
34
|
-
promotional = false,
|
|
35
|
-
...params
|
|
36
|
-
}) => {
|
|
37
|
-
try {
|
|
38
|
-
// Choose API endpoint based on promotional flag
|
|
39
|
-
const url = promotional
|
|
40
|
-
? 'https://portal.bulkgate.com/api/1.0/simple/promotional'
|
|
41
|
-
: 'https://portal.bulkgate.com/api/1.0/simple/transactional';
|
|
42
|
-
|
|
43
|
-
// Prepare the request body
|
|
44
|
-
const requestBody = {
|
|
45
|
-
application_id: BULKGATE_APPLICATION_ID,
|
|
46
|
-
application_token: BULKGATE_APPLICATION_TOKEN,
|
|
47
|
-
number: to, // Phone number in international format (or semicolon-separated for promotional)
|
|
48
|
-
text: text || '',
|
|
49
|
-
unicode: unicode, // Boolean value for unicode support
|
|
50
|
-
sender_id: from ? 'gText' : 'gSystem', // Use text sender if 'from' is provided
|
|
51
|
-
sender_id_value: from || '', // Custom sender name if using gText
|
|
52
|
-
...(country && { country }), // Optional country code
|
|
53
|
-
...(schedule && { schedule }), // Optional scheduled time
|
|
54
|
-
...params, // Any additional parameters
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const response = await fetch(url, {
|
|
58
|
-
method: 'POST',
|
|
59
|
-
headers: {
|
|
60
|
-
'Content-Type': 'application/json',
|
|
61
|
-
'Cache-Control': 'no-cache',
|
|
62
|
-
},
|
|
63
|
-
body: JSON.stringify(requestBody),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const responseData = await response.json();
|
|
67
|
-
|
|
68
|
-
// Check if we have an error response
|
|
69
|
-
if (responseData.error || responseData.type) {
|
|
70
|
-
return {
|
|
71
|
-
success: false,
|
|
72
|
-
error: {
|
|
73
|
-
name: 'BULKGATE_ERROR',
|
|
74
|
-
message:
|
|
75
|
-
responseData.error ||
|
|
76
|
-
`Failed to send ${promotional ? 'promotional' : 'transactional'} SMS`,
|
|
77
|
-
type: responseData.type || null,
|
|
78
|
-
code: responseData.code || response.status,
|
|
79
|
-
detail: responseData.detail || null,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Success response (transactional has specific structure, promotional might vary)
|
|
85
|
-
if (responseData.data) {
|
|
86
|
-
// For transactional SMS, check for specific accepted status
|
|
87
|
-
if (!promotional && responseData.data.status === 'accepted') {
|
|
88
|
-
return {
|
|
89
|
-
success: true,
|
|
90
|
-
result: {
|
|
91
|
-
sms_id: responseData.data.sms_id,
|
|
92
|
-
price: responseData.data.price,
|
|
93
|
-
credit: responseData.data.credit,
|
|
94
|
-
number: responseData.data.number,
|
|
95
|
-
status: responseData.data.status,
|
|
96
|
-
},
|
|
97
|
-
error: null,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// For promotional SMS or other successful responses
|
|
102
|
-
if (promotional || responseData.data.status) {
|
|
103
|
-
return {
|
|
104
|
-
success: true,
|
|
105
|
-
result: responseData.data,
|
|
106
|
-
error: null,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Unexpected response format
|
|
112
|
-
return {
|
|
113
|
-
success: false,
|
|
114
|
-
error: {
|
|
115
|
-
name: 'BULKGATE_ERROR',
|
|
116
|
-
message: 'Unexpected response format from BulkGate API',
|
|
117
|
-
response: responseData,
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
} catch (err) {
|
|
121
|
-
return {
|
|
122
|
-
success: false,
|
|
123
|
-
error: {
|
|
124
|
-
name: err.name,
|
|
125
|
-
message: err.message,
|
|
126
|
-
stack: err.stack,
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// Register the plugin
|
|
134
|
-
WorkerDirector.registerAdapter(BulkGateWorker);
|
|
135
|
-
|
|
136
|
-
// Environment variables needed:
|
|
137
|
-
// BULKGATE_APPLICATION_ID=your_application_id
|
|
138
|
-
// BULKGATE_APPLICATION_TOKEN=your_application_token
|
package/src/worker/email.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { WorkerDirector, WorkerAdapter, IWorkerAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
|
-
import { writeFile, mkdtemp } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
7
|
-
|
|
8
|
-
const logger = createLogger('unchained:worker:email');
|
|
9
|
-
|
|
10
|
-
export const checkEmailInterceptionEnabled = () => {
|
|
11
|
-
return process.env.NODE_ENV !== 'production' && !process.env.UNCHAINED_DISABLE_EMAIL_INTERCEPTION;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const buildLink = async ({ filename, content, href, contentType, encoding, path }) => {
|
|
15
|
-
if (path) {
|
|
16
|
-
return `<a href="file:/${path.startsWith('/') ? path : `${process.cwd()}/${path}`}">${filename}</a>`;
|
|
17
|
-
}
|
|
18
|
-
if (href) {
|
|
19
|
-
return `<a href="${href}">${filename}</a>`;
|
|
20
|
-
}
|
|
21
|
-
if (content && encoding === 'base64') {
|
|
22
|
-
return `<a target="_blank" href="${`data:${contentType};base64,${content}`}">${filename}</a>`;
|
|
23
|
-
}
|
|
24
|
-
return '';
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
let nodemailer;
|
|
28
|
-
try {
|
|
29
|
-
const nodemailerModule = await import('nodemailer');
|
|
30
|
-
nodemailer = nodemailerModule.default;
|
|
31
|
-
} catch {
|
|
32
|
-
logger.warn(`optional peer npm package 'nodemailer' not installed, emails can't be sent`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const openInBrowser = async (options): Promise<boolean> => {
|
|
36
|
-
const command = {
|
|
37
|
-
darwin: 'open',
|
|
38
|
-
win32: 'explorer.exe',
|
|
39
|
-
linux: 'xdg-open',
|
|
40
|
-
}[process.platform];
|
|
41
|
-
|
|
42
|
-
if (!command) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const messageBody = options.html || options.text.replace(/(\r\n|\n|\r)/gm, '<br/>');
|
|
47
|
-
const attachmentLinks = await Promise.all((options.attachments || []).map(buildLink));
|
|
48
|
-
const content = `
|
|
49
|
-
<!DOCTYPE html>
|
|
50
|
-
<html lang="en" xmlns="https://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
51
|
-
<head>
|
|
52
|
-
<meta charset="UTF-8"/>
|
|
53
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
54
|
-
</head>
|
|
55
|
-
<body>
|
|
56
|
-
<b>From: </b>${options.from}<br/>
|
|
57
|
-
<b>To: </b>${options.to}<br/>
|
|
58
|
-
<b>Cc: </b>${options.cc}<br/>
|
|
59
|
-
<b>Bcc: </b>${options.bcc}<br/>
|
|
60
|
-
<b>Reply-To: </b>${options.replyTo}<br/>
|
|
61
|
-
<br/>
|
|
62
|
-
<b>subject: </b>${options.subject}<br/>
|
|
63
|
-
<b>attachments: </b>${attachmentLinks.join(', ')}<br/>
|
|
64
|
-
<hr/>
|
|
65
|
-
${messageBody}
|
|
66
|
-
</body>
|
|
67
|
-
</html>`;
|
|
68
|
-
|
|
69
|
-
// Create a temporary directory and file
|
|
70
|
-
const tempDir = await mkdtemp(join(tmpdir(), 'unchained-email-'));
|
|
71
|
-
const tempFile = join(tempDir, 'email-preview.html');
|
|
72
|
-
|
|
73
|
-
await writeFile(tempFile, content, 'utf8');
|
|
74
|
-
|
|
75
|
-
return new Promise((resolve) => {
|
|
76
|
-
const child = spawn(command, [tempFile], {
|
|
77
|
-
detached: true,
|
|
78
|
-
stdio: 'ignore',
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
child.unref();
|
|
82
|
-
|
|
83
|
-
// Resolve immediately after spawning since process is detached
|
|
84
|
-
resolve(true);
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const EmailWorkerPlugin: IWorkerAdapter<
|
|
89
|
-
{
|
|
90
|
-
from?: string;
|
|
91
|
-
to?: string;
|
|
92
|
-
subject?: string;
|
|
93
|
-
[x: string]: any;
|
|
94
|
-
},
|
|
95
|
-
any
|
|
96
|
-
> = {
|
|
97
|
-
...WorkerAdapter,
|
|
98
|
-
|
|
99
|
-
key: 'shop.unchained.worker-plugin.email',
|
|
100
|
-
label: 'Send a Mail through Nodemailer',
|
|
101
|
-
version: '1.0.0',
|
|
102
|
-
type: 'EMAIL',
|
|
103
|
-
|
|
104
|
-
doWork: async ({ from, to, subject, ...rest }) => {
|
|
105
|
-
if (!to) {
|
|
106
|
-
return {
|
|
107
|
-
success: false,
|
|
108
|
-
error: {
|
|
109
|
-
name: 'RECIPIENT_REQUIRED',
|
|
110
|
-
message: 'EMAIL requires a to',
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
const sendMailOptions = {
|
|
117
|
-
from,
|
|
118
|
-
to,
|
|
119
|
-
subject,
|
|
120
|
-
...rest,
|
|
121
|
-
};
|
|
122
|
-
if (checkEmailInterceptionEnabled()) {
|
|
123
|
-
const opened = await openInBrowser(sendMailOptions);
|
|
124
|
-
return {
|
|
125
|
-
success: opened,
|
|
126
|
-
result: opened ? { intercepted: true } : undefined,
|
|
127
|
-
error: !opened ? { message: "Interception failed due to missing package 'open'" } : undefined,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (!process.env.MAIL_URL) {
|
|
132
|
-
return {
|
|
133
|
-
success: false,
|
|
134
|
-
error: { name: 'NO_MAIL_URL_SET', message: 'MAIL_URL is not set' },
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (!nodemailer) {
|
|
139
|
-
return {
|
|
140
|
-
success: false,
|
|
141
|
-
error: {
|
|
142
|
-
name: 'NODEMAILER_NOT_INSTALLED',
|
|
143
|
-
message:
|
|
144
|
-
'npm dependency nodemailer is not installed, please install it to use email features',
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const transporter = nodemailer.createTransport(process.env.MAIL_URL);
|
|
150
|
-
const result = await transporter.sendMail(sendMailOptions);
|
|
151
|
-
return { success: true, result };
|
|
152
|
-
} catch (err) {
|
|
153
|
-
return {
|
|
154
|
-
success: false,
|
|
155
|
-
error: {
|
|
156
|
-
name: err.name,
|
|
157
|
-
message: err.message,
|
|
158
|
-
stack: err.stack,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
WorkerDirector.registerAdapter(EmailWorkerPlugin);
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { enrollmentsSettings, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
2
|
-
import { EnrollmentDirector, WorkerDirector, WorkerAdapter, IWorkerAdapter } from '@unchainedshop/core';
|
|
3
|
-
|
|
4
|
-
const GenerateOrderWorker: IWorkerAdapter<never, any> = {
|
|
5
|
-
...WorkerAdapter,
|
|
6
|
-
|
|
7
|
-
key: 'shop.unchained.worker-plugin.generate-enrollment-orders',
|
|
8
|
-
label: 'Generates new Orders from Enrollments',
|
|
9
|
-
version: '1.0.0',
|
|
10
|
-
type: 'ENROLLMENT_ORDER_GENERATOR',
|
|
11
|
-
|
|
12
|
-
doWork: async (input, unchainedAPI) => {
|
|
13
|
-
const { modules, services } = unchainedAPI;
|
|
14
|
-
|
|
15
|
-
const enrollments = await modules.enrollments.findEnrollments({
|
|
16
|
-
status: [EnrollmentStatus.ACTIVE, EnrollmentStatus.PAUSED],
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const errors = (
|
|
20
|
-
await Promise.all(
|
|
21
|
-
enrollments.map(async (enrollment) => {
|
|
22
|
-
try {
|
|
23
|
-
const product = await unchainedAPI.modules.products.findProduct({
|
|
24
|
-
productId: enrollment.productId,
|
|
25
|
-
});
|
|
26
|
-
const director = await EnrollmentDirector.actions(
|
|
27
|
-
{ enrollment, product: product! },
|
|
28
|
-
unchainedAPI,
|
|
29
|
-
);
|
|
30
|
-
const period = await director.nextPeriod();
|
|
31
|
-
if (period) {
|
|
32
|
-
if (period.isTrial) {
|
|
33
|
-
await modules.enrollments.addEnrollmentPeriod(enrollment._id, {
|
|
34
|
-
...period,
|
|
35
|
-
});
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const configuration = await director.configurationForOrder({
|
|
39
|
-
period,
|
|
40
|
-
});
|
|
41
|
-
if (configuration) {
|
|
42
|
-
const order = await services.enrollments.generateOrderFromEnrollment(
|
|
43
|
-
enrollment,
|
|
44
|
-
configuration,
|
|
45
|
-
);
|
|
46
|
-
if (order) {
|
|
47
|
-
await modules.enrollments.addEnrollmentPeriod(enrollment._id, {
|
|
48
|
-
...period,
|
|
49
|
-
orderId: order._id,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch (e) {
|
|
55
|
-
return {
|
|
56
|
-
name: e.name,
|
|
57
|
-
message: e.message,
|
|
58
|
-
stack: e.stack,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}),
|
|
63
|
-
)
|
|
64
|
-
).filter(Boolean);
|
|
65
|
-
|
|
66
|
-
if (errors.length) {
|
|
67
|
-
return {
|
|
68
|
-
success: false,
|
|
69
|
-
error: {
|
|
70
|
-
name: 'SOME_ENROLLMENTS_COULD_NOT_PROCESS',
|
|
71
|
-
message: 'Some errors have been reported during order generation',
|
|
72
|
-
logs: errors,
|
|
73
|
-
},
|
|
74
|
-
result: {},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
success: true,
|
|
79
|
-
result: input,
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
WorkerDirector.registerAdapter(GenerateOrderWorker);
|
|
85
|
-
|
|
86
|
-
export const configureGenerateOrderAutoscheduling = () => {
|
|
87
|
-
if (enrollmentsSettings.autoSchedulingSchedule) {
|
|
88
|
-
WorkerDirector.configureAutoscheduling({
|
|
89
|
-
type: GenerateOrderWorker.type,
|
|
90
|
-
schedule: enrollmentsSettings.autoSchedulingSchedule,
|
|
91
|
-
retries: 5,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Work, WorkStatus } from '@unchainedshop/core-worker';
|
|
2
|
-
import { IWorkerAdapter, WorkerDirector, WorkerAdapter } from '@unchainedshop/core';
|
|
3
|
-
import later from '@breejs/later';
|
|
4
|
-
|
|
5
|
-
interface Arg {
|
|
6
|
-
secondsPassed?: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface Result {
|
|
10
|
-
forked?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const everyDayAtFourInTheNight = later.parse.cron('0 3 * * *');
|
|
14
|
-
|
|
15
|
-
export const ErrorNotifications: IWorkerAdapter<Arg, Result> = {
|
|
16
|
-
...WorkerAdapter,
|
|
17
|
-
|
|
18
|
-
key: 'shop.unchained.worker.error-notifications',
|
|
19
|
-
label: 'Send a daily report about errors that failed permanently/unrecoverable',
|
|
20
|
-
version: '1.0',
|
|
21
|
-
|
|
22
|
-
type: 'ERROR_NOTIFICATIONS',
|
|
23
|
-
|
|
24
|
-
doWork: async (args, context, workId) => {
|
|
25
|
-
const work = (await context.modules.worker.findWork({ workId })) as Work;
|
|
26
|
-
const secondsPassed = args?.secondsPassed || 60;
|
|
27
|
-
const to = new Date();
|
|
28
|
-
const from = new Date(new Date(work.scheduled).getTime() - secondsPassed * 1000);
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
const workItems = (
|
|
32
|
-
await context.modules.worker.findWorkQueue({
|
|
33
|
-
scheduled: {
|
|
34
|
-
end: to,
|
|
35
|
-
start: from,
|
|
36
|
-
},
|
|
37
|
-
types: undefined,
|
|
38
|
-
status: [WorkStatus.FAILED],
|
|
39
|
-
})
|
|
40
|
-
).filter((workItem) => workItem.type !== ErrorNotifications.type && workItem.retries === 0);
|
|
41
|
-
|
|
42
|
-
if (!workItems.length) {
|
|
43
|
-
return { success: true, result: {} };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const message = await context.modules.worker.addWork({
|
|
47
|
-
type: 'MESSAGE',
|
|
48
|
-
retries: 0,
|
|
49
|
-
input: {
|
|
50
|
-
workItems,
|
|
51
|
-
template: 'ERROR_REPORT',
|
|
52
|
-
},
|
|
53
|
-
originalWorkId: workId,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
success: true,
|
|
58
|
-
result: { forked: message._id },
|
|
59
|
-
};
|
|
60
|
-
} catch (err) {
|
|
61
|
-
return {
|
|
62
|
-
success: false,
|
|
63
|
-
error: {
|
|
64
|
-
name: err.name,
|
|
65
|
-
message: err.message,
|
|
66
|
-
stack: err.stack,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
WorkerDirector.registerAdapter(ErrorNotifications);
|
|
74
|
-
|
|
75
|
-
export default ErrorNotifications;
|
|
76
|
-
|
|
77
|
-
const ONE_DAY_IN_SECONDS = 24 * 60 * 60;
|
|
78
|
-
WorkerDirector.configureAutoscheduling({
|
|
79
|
-
type: ErrorNotifications.type,
|
|
80
|
-
schedule: everyDayAtFourInTheNight,
|
|
81
|
-
input: async () => ({ secondsPassed: ONE_DAY_IN_SECONDS }),
|
|
82
|
-
retries: 0,
|
|
83
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { WorkerEventTypes, Work } from '@unchainedshop/core-worker';
|
|
2
|
-
import { IWorkerAdapter, UnchainedCore, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
3
|
-
import { subscribe } from '@unchainedshop/events';
|
|
4
|
-
|
|
5
|
-
export const ExportTokenWorker: IWorkerAdapter<void, void> = {
|
|
6
|
-
...WorkerAdapter,
|
|
7
|
-
|
|
8
|
-
key: 'shop.unchained.worker-plugin.export-token',
|
|
9
|
-
label: 'External worker to hold the state of the minting/export process of tokens',
|
|
10
|
-
version: '1.0.0',
|
|
11
|
-
type: 'EXPORT_TOKEN',
|
|
12
|
-
external: true,
|
|
13
|
-
|
|
14
|
-
async doWork() {
|
|
15
|
-
throw new Error('Cannot do work for external workers');
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const configureExportToken = (unchainedAPI: UnchainedCore) => {
|
|
20
|
-
subscribe<Work>(WorkerEventTypes.FINISHED, async ({ payload: work }) => {
|
|
21
|
-
if (work.type === 'EXPORT_TOKEN' && work.success) {
|
|
22
|
-
await unchainedAPI.modules.warehousing.updateTokenOwnership({
|
|
23
|
-
tokenId: work.input.token._id,
|
|
24
|
-
walletAddress: work.input.recipientWalletAddress,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default configureExportToken;
|
|
31
|
-
|
|
32
|
-
WorkerDirector.registerAdapter(ExportTokenWorker);
|
package/src/worker/external.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IWorkerAdapter, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
|
|
3
|
-
export const ExternalWorkerPlugin: IWorkerAdapter<void, void> = {
|
|
4
|
-
...WorkerAdapter,
|
|
5
|
-
|
|
6
|
-
key: 'shop.unchained.worker-plugin.external',
|
|
7
|
-
label: 'External plugin as a placeholder for workers who interact with the system only via GraphQL',
|
|
8
|
-
version: '1.0.0',
|
|
9
|
-
type: 'EXTERNAL',
|
|
10
|
-
external: true,
|
|
11
|
-
|
|
12
|
-
async doWork() {
|
|
13
|
-
throw new Error('Cannot do work for external workers');
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
WorkerDirector.registerAdapter(ExternalWorkerPlugin);
|
package/src/worker/heartbeat.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { IWorkerAdapter, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
import { setTimeout } from 'node:timers/promises';
|
|
3
|
-
|
|
4
|
-
interface Arg {
|
|
5
|
-
wait?: number;
|
|
6
|
-
fails?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type Result = Arg;
|
|
10
|
-
|
|
11
|
-
const Heartbeat: IWorkerAdapter<Arg, Result> = {
|
|
12
|
-
...WorkerAdapter,
|
|
13
|
-
|
|
14
|
-
key: 'shop.unchained.worker-plugin.heartbeat',
|
|
15
|
-
label: 'Heartbeat plugin to check if workers are working',
|
|
16
|
-
version: '1.0.0',
|
|
17
|
-
type: 'HEARTBEAT',
|
|
18
|
-
maxParallelAllocations: 1,
|
|
19
|
-
|
|
20
|
-
doWork: async (input: Arg): Promise<{ success: boolean; result: Result }> => {
|
|
21
|
-
if (input?.wait) {
|
|
22
|
-
await setTimeout(input.wait);
|
|
23
|
-
}
|
|
24
|
-
if (input?.fails) {
|
|
25
|
-
return {
|
|
26
|
-
success: false,
|
|
27
|
-
result: input,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
success: true,
|
|
32
|
-
result: input,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
WorkerDirector.registerAdapter(Heartbeat);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { IWorkerAdapter, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
|
|
3
|
-
const postFetch = async (url, { data, headers }) => {
|
|
4
|
-
return fetch(url, {
|
|
5
|
-
method: 'POST',
|
|
6
|
-
body: JSON.stringify(data),
|
|
7
|
-
// eslint-disable-next-line
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
duplex: 'half',
|
|
10
|
-
headers: { 'Content-Type': 'application/json', ...headers },
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const nonPostFetch = async (url, { headers, method = 'GET' }) => {
|
|
15
|
-
return fetch(url, {
|
|
16
|
-
method,
|
|
17
|
-
headers,
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const HttpRequestWorkerPlugin: IWorkerAdapter<
|
|
22
|
-
{ url?: string; data?: any; headers?: any; method: 'POST' | 'GET' },
|
|
23
|
-
any
|
|
24
|
-
> = {
|
|
25
|
-
...WorkerAdapter,
|
|
26
|
-
|
|
27
|
-
key: 'shop.unchained.worker-plugin.http-request',
|
|
28
|
-
label: 'Request a resource via http request. 200 = success',
|
|
29
|
-
version: '1.0.0',
|
|
30
|
-
type: 'HTTP_REQUEST',
|
|
31
|
-
|
|
32
|
-
async doWork({ url, data = {}, headers, method = 'POST' } = { method: 'POST' }) {
|
|
33
|
-
if (!url) {
|
|
34
|
-
return {
|
|
35
|
-
success: false,
|
|
36
|
-
error: {
|
|
37
|
-
name: 'URL_REQUIRED',
|
|
38
|
-
message: 'HTTP_REQUEST requires an url',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const normalizedFetch = method.toUpperCase() === 'POST' ? postFetch : nonPostFetch;
|
|
45
|
-
const res = await normalizedFetch(url, { data, headers, method });
|
|
46
|
-
|
|
47
|
-
const contentType = res.headers.get('content-type');
|
|
48
|
-
const isJson = contentType && contentType.includes('application/json');
|
|
49
|
-
|
|
50
|
-
const result = isJson ? await res.json() : { text: await res.text() };
|
|
51
|
-
|
|
52
|
-
if (res.status === 200 && res.ok) {
|
|
53
|
-
return { success: true, result };
|
|
54
|
-
}
|
|
55
|
-
return { success: false, result };
|
|
56
|
-
} catch (err) {
|
|
57
|
-
return {
|
|
58
|
-
success: false,
|
|
59
|
-
error: {
|
|
60
|
-
name: err.name,
|
|
61
|
-
message: err.message,
|
|
62
|
-
stack: err.stack,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
WorkerDirector.registerAdapter(HttpRequestWorkerPlugin);
|
|
70
|
-
|
|
71
|
-
export default HttpRequestWorkerPlugin;
|
package/src/worker/message.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { MessagingDirector, IWorkerAdapter, WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
import { Work } from '@unchainedshop/core-worker';
|
|
3
|
-
|
|
4
|
-
export const MessageWorker: IWorkerAdapter<
|
|
5
|
-
{ template: string; _id: string; [x: string]: any },
|
|
6
|
-
{ info?: string; forked?: Work[] }
|
|
7
|
-
> = {
|
|
8
|
-
...WorkerAdapter,
|
|
9
|
-
|
|
10
|
-
key: 'shop.unchained.worker-plugin.message',
|
|
11
|
-
label: 'Send Message by combining payload with a template and start concrete jobs',
|
|
12
|
-
version: '1.0.0',
|
|
13
|
-
type: 'MESSAGE',
|
|
14
|
-
|
|
15
|
-
doWork: async ({ template, ...payload }, unchainedAPI, workId) => {
|
|
16
|
-
try {
|
|
17
|
-
const templateResolver = MessagingDirector.getTemplate(template);
|
|
18
|
-
|
|
19
|
-
if (!templateResolver) throw new Error(`No template resolver found for template ${template}`);
|
|
20
|
-
|
|
21
|
-
const workConfigurations = await templateResolver(
|
|
22
|
-
{
|
|
23
|
-
template,
|
|
24
|
-
...payload,
|
|
25
|
-
},
|
|
26
|
-
unchainedAPI,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
if (workConfigurations.length > 0) {
|
|
30
|
-
const forked = await Promise.all(
|
|
31
|
-
workConfigurations.map(async (workConfiguration: any) => {
|
|
32
|
-
const work = await unchainedAPI.modules.worker.addWork({
|
|
33
|
-
...workConfiguration,
|
|
34
|
-
originalWorkId: workId,
|
|
35
|
-
});
|
|
36
|
-
delete (work as any).input; // Remove input from returned work for privacy
|
|
37
|
-
return work;
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
return { success: true, result: { forked } };
|
|
41
|
-
}
|
|
42
|
-
return { success: true, result: { forked: [] } };
|
|
43
|
-
} catch (err) {
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
error: {
|
|
47
|
-
name: err.name,
|
|
48
|
-
message: err.message,
|
|
49
|
-
stack: err.stack,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
WorkerDirector.registerAdapter(MessageWorker);
|