@unchainedshop/plugins 3.0.0-alpha7 → 3.0.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/delivery/pick-mup.js +1 -2
- package/lib/delivery/pick-mup.js.map +1 -1
- package/lib/delivery/post.js +2 -1
- package/lib/delivery/post.js.map +1 -1
- package/lib/delivery/send-message.js +2 -1
- package/lib/delivery/send-message.js.map +1 -1
- package/lib/delivery/stores.js +2 -1
- package/lib/delivery/stores.js.map +1 -1
- package/lib/enrollments/licensed.d.ts.map +1 -1
- package/lib/enrollments/licensed.js +1 -1
- package/lib/enrollments/licensed.js.map +1 -1
- package/lib/events/aws-eventbridge.d.ts +2 -0
- package/lib/events/aws-eventbridge.d.ts.map +1 -0
- package/lib/events/aws-eventbridge.js +36 -0
- package/lib/events/aws-eventbridge.js.map +1 -0
- package/lib/events/node-event-emitter.js +1 -2
- package/lib/events/node-event-emitter.js.map +1 -1
- package/lib/events/redis.js +4 -2
- package/lib/events/redis.js.map +1 -1
- package/lib/files/gridfs/gridfs-adapter.d.ts.map +1 -1
- package/lib/files/gridfs/gridfs-adapter.js +14 -5
- package/lib/files/gridfs/gridfs-adapter.js.map +1 -1
- package/lib/files/gridfs/gridfs-webhook.d.ts +1 -1
- package/lib/files/gridfs/gridfs-webhook.d.ts.map +1 -1
- package/lib/files/gridfs/gridfs-webhook.js +25 -6
- package/lib/files/gridfs/gridfs-webhook.js.map +1 -1
- package/lib/files/gridfs/sign.d.ts +1 -1
- package/lib/files/gridfs/sign.d.ts.map +1 -1
- package/lib/files/gridfs/sign.js +8 -7
- package/lib/files/gridfs/sign.js.map +1 -1
- package/lib/files/minio/minio-adapter.d.ts.map +1 -1
- package/lib/files/minio/minio-adapter.js +13 -9
- package/lib/files/minio/minio-adapter.js.map +1 -1
- package/lib/files/minio/minio-webhook.d.ts.map +1 -1
- package/lib/files/minio/minio-webhook.js +4 -3
- package/lib/files/minio/minio-webhook.js.map +1 -1
- package/lib/filters/local-search.d.ts +1 -1
- package/lib/filters/local-search.d.ts.map +1 -1
- package/lib/filters/local-search.js +1 -1
- package/lib/filters/local-search.js.map +1 -1
- package/lib/filters/strict-equal.js +1 -1
- package/lib/filters/strict-equal.js.map +1 -1
- package/lib/payment/apple-iap/adapter.d.ts.map +1 -1
- package/lib/payment/apple-iap/adapter.js +15 -20
- package/lib/payment/apple-iap/adapter.js.map +1 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +1 -1
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +1 -1
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts.map +1 -1
- package/lib/payment/braintree.js +10 -8
- package/lib/payment/braintree.js.map +1 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +1 -1
- package/lib/payment/cryptopay/middleware.d.ts.map +1 -1
- package/lib/payment/cryptopay/middleware.js +4 -4
- package/lib/payment/cryptopay/middleware.js.map +1 -1
- package/lib/payment/cryptopay/plugin.d.ts +1 -1
- package/lib/payment/cryptopay/plugin.d.ts.map +1 -1
- package/lib/payment/cryptopay/plugin.js +8 -9
- package/lib/payment/cryptopay/plugin.js.map +1 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/init.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/init.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +1 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/status.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/api/types.d.ts +260 -0
- package/lib/payment/datatrans-v2/api/types.d.ts.map +1 -0
- package/lib/payment/datatrans-v2/api/types.js +2 -0
- package/lib/payment/datatrans-v2/api/types.js.map +1 -0
- package/lib/payment/datatrans-v2/api/validate.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/generateSignature copy.d.ts +11 -0
- package/lib/payment/datatrans-v2/generateSignature copy.d.ts.map +1 -0
- package/lib/payment/datatrans-v2/generateSignature copy.js +19 -0
- package/lib/payment/datatrans-v2/generateSignature copy.js.map +1 -0
- package/lib/payment/datatrans-v2/generateSignature.d.ts +1 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/generateSignature.js +7 -4
- package/lib/payment/datatrans-v2/generateSignature.js.map +1 -1
- package/lib/payment/datatrans-v2/index.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/index.js +31 -29
- package/lib/payment/datatrans-v2/index.js.map +1 -1
- package/lib/payment/datatrans-v2/middleware.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/middleware.js +7 -5
- package/lib/payment/datatrans-v2/middleware.js.map +1 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -4
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.js +5 -3
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +1 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +6 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +1 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts.map +1 -1
- package/lib/payment/datatrans-v2/splitProperties.js +0 -3
- package/lib/payment/datatrans-v2/splitProperties.js.map +1 -1
- package/lib/payment/invoice-prepaid.js +4 -3
- package/lib/payment/invoice-prepaid.js.map +1 -1
- package/lib/payment/invoice.js +4 -3
- package/lib/payment/invoice.js.map +1 -1
- package/lib/payment/paypal-checkout.js +10 -6
- package/lib/payment/paypal-checkout.js.map +1 -1
- package/lib/payment/payrexx/api/makeFetcher.d.ts.map +1 -1
- package/lib/payment/payrexx/api/makeFetcher.js +2 -3
- package/lib/payment/payrexx/api/makeFetcher.js.map +1 -1
- package/lib/payment/payrexx/index.d.ts.map +1 -1
- package/lib/payment/payrexx/index.js +20 -14
- package/lib/payment/payrexx/index.js.map +1 -1
- package/lib/payment/payrexx/middleware.d.ts.map +1 -1
- package/lib/payment/payrexx/middleware.js +12 -9
- package/lib/payment/payrexx/middleware.js.map +1 -1
- package/lib/payment/postfinance-checkout/index.d.ts.map +1 -1
- package/lib/payment/postfinance-checkout/index.js +18 -13
- package/lib/payment/postfinance-checkout/index.js.map +1 -1
- package/lib/payment/postfinance-checkout/middleware.d.ts.map +1 -1
- package/lib/payment/postfinance-checkout/middleware.js +4 -3
- package/lib/payment/postfinance-checkout/middleware.js.map +1 -1
- package/lib/payment/postfinance-checkout/utils.d.ts +2 -2
- package/lib/payment/postfinance-checkout/utils.d.ts.map +1 -1
- package/lib/payment/postfinance-checkout/utils.js +6 -2
- package/lib/payment/postfinance-checkout/utils.js.map +1 -1
- package/lib/payment/saferpay/adapter.d.ts +1 -1
- package/lib/payment/saferpay/adapter.d.ts.map +1 -1
- package/lib/payment/saferpay/adapter.js +17 -11
- package/lib/payment/saferpay/adapter.js.map +1 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts.map +1 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js.map +1 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts +1 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts.map +1 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +1 -1
- package/lib/payment/saferpay/middleware.d.ts.map +1 -1
- package/lib/payment/saferpay/middleware.js +4 -4
- package/lib/payment/saferpay/middleware.js.map +1 -1
- package/lib/payment/stripe/index.d.ts.map +1 -1
- package/lib/payment/stripe/index.js +17 -11
- package/lib/payment/stripe/index.js.map +1 -1
- package/lib/payment/stripe/middleware.d.ts.map +1 -1
- package/lib/payment/stripe/middleware.js +10 -10
- package/lib/payment/stripe/middleware.js.map +1 -1
- package/lib/payment/stripe/stripe.d.ts +3 -4
- package/lib/payment/stripe/stripe.d.ts.map +1 -1
- package/lib/payment/stripe/stripe.js +3 -1
- package/lib/payment/stripe/stripe.js.map +1 -1
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -1
- package/lib/pricing/delivery-swiss-tax.d.ts.map +1 -1
- package/lib/pricing/delivery-swiss-tax.js +1 -2
- package/lib/pricing/delivery-swiss-tax.js.map +1 -1
- package/lib/pricing/discount-100-off.d.ts +2 -3
- package/lib/pricing/discount-100-off.d.ts.map +1 -1
- package/lib/pricing/discount-100-off.js +1 -1
- package/lib/pricing/discount-100-off.js.map +1 -1
- package/lib/pricing/discount-half-price-manual.d.ts +2 -3
- package/lib/pricing/discount-half-price-manual.d.ts.map +1 -1
- package/lib/pricing/discount-half-price-manual.js +1 -1
- package/lib/pricing/discount-half-price-manual.js.map +1 -1
- package/lib/pricing/discount-half-price.d.ts +2 -3
- package/lib/pricing/discount-half-price.d.ts.map +1 -1
- package/lib/pricing/discount-half-price.js +1 -1
- package/lib/pricing/discount-half-price.js.map +1 -1
- package/lib/pricing/free-delivery.d.ts +1 -1
- package/lib/pricing/free-delivery.d.ts.map +1 -1
- package/lib/pricing/free-delivery.js +1 -1
- package/lib/pricing/free-delivery.js.map +1 -1
- package/lib/pricing/free-payment.d.ts +1 -1
- package/lib/pricing/free-payment.d.ts.map +1 -1
- package/lib/pricing/free-payment.js +1 -1
- package/lib/pricing/free-payment.js.map +1 -1
- package/lib/pricing/order-delivery.d.ts +1 -1
- package/lib/pricing/order-delivery.d.ts.map +1 -1
- package/lib/pricing/order-delivery.js +6 -3
- package/lib/pricing/order-delivery.js.map +1 -1
- package/lib/pricing/order-discount.d.ts +1 -2
- package/lib/pricing/order-discount.d.ts.map +1 -1
- package/lib/pricing/order-discount.js +15 -8
- package/lib/pricing/order-discount.js.map +1 -1
- package/lib/pricing/order-items-discount.js +7 -4
- package/lib/pricing/order-items-discount.js.map +1 -1
- package/lib/pricing/order-items.js +7 -3
- package/lib/pricing/order-items.js.map +1 -1
- package/lib/pricing/order-payment.js +6 -3
- package/lib/pricing/order-payment.js.map +1 -1
- package/lib/pricing/order-round.d.ts +1 -1
- package/lib/pricing/order-round.d.ts.map +1 -1
- package/lib/pricing/order-round.js +1 -2
- package/lib/pricing/order-round.js.map +1 -1
- package/lib/pricing/product-catalog-price.d.ts +2 -2
- package/lib/pricing/product-catalog-price.d.ts.map +1 -1
- package/lib/pricing/product-catalog-price.js +7 -6
- package/lib/pricing/product-catalog-price.js.map +1 -1
- package/lib/pricing/product-discount.js +1 -2
- package/lib/pricing/product-discount.js.map +1 -1
- package/lib/pricing/product-price-rateconversion.d.ts +1 -1
- package/lib/pricing/product-price-rateconversion.d.ts.map +1 -1
- package/lib/pricing/product-price-rateconversion.js +1 -1
- package/lib/pricing/product-price-rateconversion.js.map +1 -1
- package/lib/pricing/product-round.d.ts +1 -1
- package/lib/pricing/product-round.d.ts.map +1 -1
- package/lib/pricing/product-round.js +1 -1
- package/lib/pricing/product-round.js.map +1 -1
- package/lib/pricing/product-swiss-tax.d.ts +4 -3
- package/lib/pricing/product-swiss-tax.d.ts.map +1 -1
- package/lib/pricing/product-swiss-tax.js +1 -2
- package/lib/pricing/product-swiss-tax.js.map +1 -1
- package/lib/quotations/manual.js +1 -1
- package/lib/quotations/manual.js.map +1 -1
- package/lib/warehousing/eth-minter.js +7 -4
- package/lib/warehousing/eth-minter.js.map +1 -1
- package/lib/warehousing/store.js +2 -1
- package/lib/warehousing/store.js.map +1 -1
- package/lib/worker/BaseWorker.d.ts +30 -0
- package/lib/worker/BaseWorker.d.ts.map +1 -0
- package/lib/worker/BaseWorker.js +81 -0
- package/lib/worker/BaseWorker.js.map +1 -0
- package/lib/worker/EventListenerWorker.d.ts +6 -0
- package/lib/worker/EventListenerWorker.d.ts.map +1 -0
- package/lib/worker/EventListenerWorker.js +46 -0
- package/lib/worker/EventListenerWorker.js.map +1 -0
- package/lib/worker/FailedRescheduler.d.ts +15 -0
- package/lib/worker/FailedRescheduler.d.ts.map +1 -0
- package/lib/worker/FailedRescheduler.js +45 -0
- package/lib/worker/FailedRescheduler.js.map +1 -0
- package/lib/worker/IntervalWorker.d.ts +10 -0
- package/lib/worker/IntervalWorker.d.ts.map +1 -0
- package/lib/worker/IntervalWorker.js +37 -0
- package/lib/worker/IntervalWorker.js.map +1 -0
- package/lib/worker/bulk-import.d.ts +1 -1
- package/lib/worker/bulk-import.d.ts.map +1 -1
- package/lib/worker/bulk-import.js +7 -8
- package/lib/worker/bulk-import.js.map +1 -1
- package/lib/worker/email.d.ts.map +1 -1
- package/lib/worker/email.js +1 -5
- package/lib/worker/email.js.map +1 -1
- package/lib/worker/enrollment-order-generator.d.ts.map +1 -1
- package/lib/worker/enrollment-order-generator.js +17 -15
- package/lib/worker/enrollment-order-generator.js.map +1 -1
- package/lib/worker/error-notifications.d.ts +1 -1
- package/lib/worker/error-notifications.d.ts.map +1 -1
- package/lib/worker/error-notifications.js +1 -1
- package/lib/worker/error-notifications.js.map +1 -1
- package/lib/worker/export-token.d.ts +1 -2
- package/lib/worker/export-token.d.ts.map +1 -1
- package/lib/worker/export-token.js +2 -1
- package/lib/worker/export-token.js.map +1 -1
- package/lib/worker/external.d.ts +1 -1
- package/lib/worker/external.d.ts.map +1 -1
- package/lib/worker/external.js +1 -1
- package/lib/worker/external.js.map +1 -1
- package/lib/worker/heartbeat.js +1 -1
- package/lib/worker/heartbeat.js.map +1 -1
- package/lib/worker/http-request.d.ts +1 -1
- package/lib/worker/http-request.d.ts.map +1 -1
- package/lib/worker/http-request.js +1 -5
- package/lib/worker/http-request.js.map +1 -1
- package/lib/worker/message.d.ts +2 -2
- package/lib/worker/message.d.ts.map +1 -1
- package/lib/worker/message.js +1 -5
- package/lib/worker/message.js.map +1 -1
- package/lib/worker/push-notification.js +1 -4
- package/lib/worker/push-notification.js.map +1 -1
- package/lib/worker/sms.js +1 -4
- package/lib/worker/sms.js.map +1 -1
- package/lib/worker/update-coinbase-rates.js +1 -1
- package/lib/worker/update-coinbase-rates.js.map +1 -1
- package/lib/worker/update-ecb-rates.js +1 -1
- package/lib/worker/update-ecb-rates.js.map +1 -1
- package/lib/worker/update-token-ownership.d.ts +1 -1
- package/lib/worker/update-token-ownership.d.ts.map +1 -1
- package/lib/worker/update-token-ownership.js +1 -1
- package/lib/worker/update-token-ownership.js.map +1 -1
- package/lib/worker/zombie-killer.d.ts +8 -2
- package/lib/worker/zombie-killer.d.ts.map +1 -1
- package/lib/worker/zombie-killer.js +12 -9
- package/lib/worker/zombie-killer.js.map +1 -1
- package/package.json +37 -82
- package/src/delivery/pick-mup.ts +2 -3
- package/src/delivery/post.ts +2 -2
- package/src/delivery/send-message.ts +2 -2
- package/src/delivery/stores.ts +2 -2
- package/src/enrollments/licensed.ts +1 -2
- package/src/events/aws-eventbridge.ts +43 -0
- package/src/events/node-event-emitter.ts +1 -2
- package/src/events/redis.ts +4 -2
- package/src/files/gridfs/gridfs-adapter.ts +15 -5
- package/src/files/gridfs/gridfs-webhook.ts +29 -9
- package/src/files/gridfs/sign.ts +20 -8
- package/src/files/minio/minio-adapter.ts +14 -11
- package/src/files/minio/minio-webhook.ts +5 -3
- package/src/filters/local-search.ts +1 -2
- package/src/filters/strict-equal.ts +1 -2
- package/src/payment/apple-iap/adapter.ts +22 -40
- package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
- package/src/payment/apple-iap/module/configureAppleTransactionsModule.ts +1 -1
- package/src/payment/braintree.ts +16 -9
- package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
- package/src/payment/cryptopay/middleware.ts +11 -8
- package/src/payment/cryptopay/plugin.ts +14 -11
- package/src/payment/datatrans-v2/api/authorize.ts +1 -1
- package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +1 -1
- package/src/payment/datatrans-v2/api/cancel.ts +1 -1
- package/src/payment/datatrans-v2/api/init.ts +1 -1
- package/src/payment/datatrans-v2/api/makeFetcher.ts +0 -1
- package/src/payment/datatrans-v2/api/secureFields.ts +1 -1
- package/src/payment/datatrans-v2/api/settle.ts +1 -1
- package/src/payment/datatrans-v2/api/status.ts +1 -1
- package/src/payment/datatrans-v2/api/validate.ts +1 -1
- package/src/payment/datatrans-v2/generateSignature.test.ts +15 -0
- package/src/payment/datatrans-v2/generateSignature.ts +18 -6
- package/src/payment/datatrans-v2/index.ts +41 -36
- package/src/payment/datatrans-v2/middleware.ts +8 -12
- package/src/payment/datatrans-v2/parseRegistrationData.ts +7 -5
- package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +6 -6
- package/src/payment/datatrans-v2/splitProperties.ts +0 -5
- package/src/payment/invoice-prepaid.ts +4 -4
- package/src/payment/invoice.ts +4 -4
- package/src/payment/paypal-checkout.ts +16 -7
- package/src/payment/payrexx/api/makeFetcher.ts +2 -3
- package/src/payment/payrexx/index.ts +26 -15
- package/src/payment/payrexx/middleware.ts +14 -19
- package/src/payment/postfinance-checkout/index.ts +26 -17
- package/src/payment/postfinance-checkout/middleware.ts +6 -9
- package/src/payment/postfinance-checkout/utils.ts +6 -3
- package/src/payment/saferpay/adapter.ts +23 -13
- package/src/payment/saferpay/api/api/SaferpayConnection.ts +0 -1
- package/src/payment/saferpay/api/models/TransactionCapture.ts +1 -1
- package/src/payment/saferpay/db/SaferpayTransactionsCollection.ts +1 -1
- package/src/payment/saferpay/middleware.ts +6 -10
- package/src/payment/stripe/index.ts +23 -12
- package/src/payment/stripe/middleware.ts +15 -23
- package/src/payment/stripe/stripe.ts +6 -5
- package/src/pricing/delivery-swiss-tax.ts +6 -2
- package/src/pricing/discount-100-off.ts +4 -3
- package/src/pricing/discount-half-price-manual.ts +9 -5
- package/src/pricing/discount-half-price.ts +9 -5
- package/src/pricing/free-delivery.ts +1 -1
- package/src/pricing/free-payment.ts +1 -1
- package/src/pricing/order-delivery.ts +11 -8
- package/src/pricing/order-discount.ts +26 -11
- package/src/pricing/order-items-discount.ts +12 -5
- package/src/pricing/order-items.ts +12 -8
- package/src/pricing/order-payment.ts +11 -8
- package/src/pricing/order-round.ts +6 -2
- package/src/pricing/product-catalog-price.ts +12 -7
- package/src/pricing/product-discount.ts +5 -4
- package/src/pricing/product-price-rateconversion.ts +5 -2
- package/src/pricing/product-round.ts +5 -2
- package/src/pricing/product-swiss-tax.ts +5 -3
- package/src/quotations/manual.ts +1 -2
- package/src/warehousing/eth-minter.ts +11 -10
- package/src/warehousing/store.ts +2 -6
- package/src/worker/BaseWorker.ts +119 -0
- package/src/worker/EventListenerWorker.ts +61 -0
- package/src/worker/FailedRescheduler.ts +80 -0
- package/src/worker/IntervalWorker.ts +54 -0
- package/src/worker/bulk-import.ts +12 -13
- package/src/worker/email.ts +1 -8
- package/src/worker/enrollment-order-generator.ts +25 -34
- package/src/worker/error-notifications.ts +2 -2
- package/src/worker/export-token.ts +2 -8
- package/src/worker/external.ts +1 -2
- package/src/worker/heartbeat.ts +1 -2
- package/src/worker/http-request.ts +1 -8
- package/src/worker/message.ts +2 -6
- package/src/worker/push-notification.ts +1 -6
- package/src/worker/sms.ts +1 -7
- package/src/worker/update-coinbase-rates.ts +1 -3
- package/src/worker/update-ecb-rates.ts +1 -3
- package/src/worker/update-token-ownership.ts +1 -2
- package/src/worker/zombie-killer.ts +23 -23
- package/tsconfig.json +4 -5
- /package/src/payment/datatrans-v2/api/{types.d.ts → types.ts} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
1
2
|
import {
|
|
3
|
+
OrderPricingSheet,
|
|
2
4
|
IPaymentActions,
|
|
3
5
|
IPaymentAdapter,
|
|
6
|
+
PaymentAdapter,
|
|
4
7
|
PaymentChargeActionResult,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
PaymentDirector,
|
|
9
|
+
PaymentError,
|
|
10
|
+
} from '@unchainedshop/core';
|
|
9
11
|
import * as pf from 'postfinancecheckout';
|
|
12
|
+
|
|
10
13
|
import {
|
|
11
14
|
confirmDeferredTransaction,
|
|
12
15
|
createTransaction,
|
|
@@ -52,17 +55,15 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
52
55
|
return type === 'GENERIC';
|
|
53
56
|
},
|
|
54
57
|
|
|
55
|
-
actions: (
|
|
56
|
-
const { modules } = params.context;
|
|
57
|
-
|
|
58
|
+
actions: (config, context) => {
|
|
58
59
|
const adapter: IPaymentActions & {
|
|
59
60
|
getCompletionMode: () => CompletionModes;
|
|
60
61
|
} = {
|
|
61
|
-
...PaymentAdapter.actions(
|
|
62
|
+
...PaymentAdapter.actions(config, context),
|
|
62
63
|
|
|
63
64
|
getCompletionMode() {
|
|
64
65
|
return (
|
|
65
|
-
(
|
|
66
|
+
(config.find((item) => item.key === 'completionMode')?.value as CompletionModes) ||
|
|
66
67
|
CompletionModes.Deferred
|
|
67
68
|
);
|
|
68
69
|
},
|
|
@@ -99,15 +100,19 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
99
100
|
},
|
|
100
101
|
|
|
101
102
|
sign: async (transactionContext: any = {}) => {
|
|
102
|
-
const { orderPayment, order } =
|
|
103
|
+
const { orderPayment, order } = context;
|
|
103
104
|
|
|
104
105
|
const { integrationMode = IntegrationModes.PaymentPage }: { integrationMode: IntegrationModes } =
|
|
105
106
|
transactionContext;
|
|
106
107
|
const completionMode = adapter.getCompletionMode();
|
|
107
|
-
const pricing =
|
|
108
|
+
const pricing = OrderPricingSheet({
|
|
109
|
+
calculation: order.calculation,
|
|
110
|
+
currency: order.currency,
|
|
111
|
+
});
|
|
112
|
+
|
|
108
113
|
const totalAmount = pricing?.total({ useNetPrice: false }).amount;
|
|
109
114
|
const transaction = new PostFinanceCheckout.model.TransactionCreate();
|
|
110
|
-
const userId = order?.userId ||
|
|
115
|
+
const userId = order?.userId || context?.userId;
|
|
111
116
|
transaction.currency = order.currency;
|
|
112
117
|
transaction.metaData = {
|
|
113
118
|
orderPaymentId: orderPayment._id,
|
|
@@ -177,7 +182,7 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
177
182
|
});
|
|
178
183
|
}
|
|
179
184
|
|
|
180
|
-
const isPaid = await orderIsPaid(
|
|
185
|
+
const isPaid = await orderIsPaid(context.order, transaction);
|
|
181
186
|
if (!isPaid) {
|
|
182
187
|
logger.error(`Transaction #${transactionId}: Invalid state / Amount incorrect`);
|
|
183
188
|
throw newError({
|
|
@@ -186,7 +191,7 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
186
191
|
});
|
|
187
192
|
}
|
|
188
193
|
|
|
189
|
-
if (transaction.metaData.orderPaymentId !==
|
|
194
|
+
if (transaction.metaData.orderPaymentId !== context.orderPayment._id) {
|
|
190
195
|
logger.error(`Transaction #${transactionId}: Invalid state / Amount incorrect`);
|
|
191
196
|
throw newError({
|
|
192
197
|
code: `TRANSACTION_ALREADY_USED`,
|
|
@@ -207,14 +212,18 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
207
212
|
},
|
|
208
213
|
|
|
209
214
|
cancel: async () => {
|
|
210
|
-
const { orderPayment, order } =
|
|
215
|
+
const { orderPayment, order } = context;
|
|
211
216
|
const { transactionId } = orderPayment;
|
|
212
217
|
if (!transactionId) {
|
|
213
218
|
return false;
|
|
214
219
|
}
|
|
215
220
|
const transaction = await getTransaction(transactionId);
|
|
216
221
|
const refund = transaction.state === PostFinanceCheckout.model.TransactionState.FULFILL;
|
|
217
|
-
const pricing =
|
|
222
|
+
const pricing = OrderPricingSheet({
|
|
223
|
+
calculation: order.calculation,
|
|
224
|
+
currency: order.currency,
|
|
225
|
+
});
|
|
226
|
+
|
|
218
227
|
const totalAmount = pricing?.total({ useNetPrice: false }).amount;
|
|
219
228
|
// For immediate settlements, try refunding. For deferred settlements, void the transaction.
|
|
220
229
|
return (
|
|
@@ -224,7 +233,7 @@ const PostfinanceCheckout: IPaymentAdapter = {
|
|
|
224
233
|
},
|
|
225
234
|
|
|
226
235
|
confirm: async () => {
|
|
227
|
-
const { orderPayment } =
|
|
236
|
+
const { orderPayment } = context;
|
|
228
237
|
const { transactionId } = orderPayment;
|
|
229
238
|
if (!transactionId) {
|
|
230
239
|
return false;
|
|
@@ -7,6 +7,7 @@ const logger = createLogger('unchained:core-payment:postfinance-checkout');
|
|
|
7
7
|
|
|
8
8
|
export const postfinanceCheckoutHandler = async (req, res) => {
|
|
9
9
|
const context = req.unchainedContext as Context;
|
|
10
|
+
const { services, modules } = context;
|
|
10
11
|
const data = req.body as WebhookData;
|
|
11
12
|
if (data.listenerEntityTechnicalName === 'TransactionCompletion') {
|
|
12
13
|
try {
|
|
@@ -15,20 +16,16 @@ export const postfinanceCheckoutHandler = async (req, res) => {
|
|
|
15
16
|
transactionCompletion.linkedTransaction as unknown as string,
|
|
16
17
|
);
|
|
17
18
|
const { orderPaymentId } = transaction.metaData as { orderPaymentId: string };
|
|
18
|
-
const orderPayment = await
|
|
19
|
+
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
19
20
|
orderPaymentId,
|
|
20
21
|
});
|
|
21
22
|
if (!orderPayment) throw new Error('Order Payment not found');
|
|
22
23
|
|
|
23
|
-
const order = await
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
paymentContext: {
|
|
27
|
-
transactionId: transactionCompletion.linkedTransaction,
|
|
28
|
-
},
|
|
24
|
+
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
25
|
+
paymentContext: {
|
|
26
|
+
transactionId: transactionCompletion.linkedTransaction,
|
|
29
27
|
},
|
|
30
|
-
|
|
31
|
-
);
|
|
28
|
+
});
|
|
32
29
|
logger.info(
|
|
33
30
|
`PostFinance Checkout Webhook: Transaction ${transactionCompletion.linkedTransaction} marked order payment ID ${transaction.metaData.orderPaymentId} as paid`,
|
|
34
31
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OrderPricingSheet } from '@unchainedshop/core';
|
|
2
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
2
3
|
import * as pf from 'postfinancecheckout';
|
|
3
4
|
|
|
4
5
|
const { PostFinanceCheckout } = pf;
|
|
@@ -28,9 +29,11 @@ export const transactionIsPaid = async (
|
|
|
28
29
|
export const orderIsPaid = async (
|
|
29
30
|
order: Order,
|
|
30
31
|
transaction: pf.PostFinanceCheckout.model.Transaction,
|
|
31
|
-
orderModule: OrdersModule,
|
|
32
32
|
): Promise<boolean> => {
|
|
33
|
-
const pricing =
|
|
33
|
+
const pricing = OrderPricingSheet({
|
|
34
|
+
calculation: order.calculation,
|
|
35
|
+
currency: order.currency,
|
|
36
|
+
});
|
|
34
37
|
const totalAmount = pricing.total({ useNetPrice: false }).amount / 100;
|
|
35
38
|
return transactionIsPaid(transaction, order.currency, totalAmount);
|
|
36
39
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/core-payment';
|
|
2
|
-
import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
|
|
3
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
4
1
|
import { mongodb } from '@unchainedshop/mongodb';
|
|
5
2
|
import { PaymentPageInitializeInput, SaferpayClient } from './api/index.js';
|
|
6
3
|
import { buildSignature } from './buildSignature.js';
|
|
7
4
|
import { SaferpayTransactionsModule } from './module/configureSaferpayTransactionsModule.js';
|
|
5
|
+
import {
|
|
6
|
+
OrderPricingSheet,
|
|
7
|
+
IPaymentAdapter,
|
|
8
|
+
PaymentAdapter,
|
|
9
|
+
PaymentDirector,
|
|
10
|
+
PaymentError,
|
|
11
|
+
} from '@unchainedshop/core';
|
|
8
12
|
|
|
9
13
|
export * from './middleware.js';
|
|
10
14
|
|
|
@@ -42,8 +46,8 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
42
46
|
return type === 'GENERIC';
|
|
43
47
|
},
|
|
44
48
|
|
|
45
|
-
actions: (
|
|
46
|
-
const { modules } =
|
|
49
|
+
actions: (config, context) => {
|
|
50
|
+
const { modules } = context as typeof context & {
|
|
47
51
|
modules: { saferpayTransactions: SaferpayTransactionsModule };
|
|
48
52
|
};
|
|
49
53
|
|
|
@@ -60,10 +64,10 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
const adapter = {
|
|
63
|
-
...PaymentAdapter.actions(
|
|
67
|
+
...PaymentAdapter.actions(config, context),
|
|
64
68
|
|
|
65
69
|
getTerminalId() {
|
|
66
|
-
return
|
|
70
|
+
return config.find((item) => item.key === 'terminalId')?.value;
|
|
67
71
|
},
|
|
68
72
|
|
|
69
73
|
// eslint-disable-next-line
|
|
@@ -91,12 +95,15 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
91
95
|
},
|
|
92
96
|
|
|
93
97
|
sign: async (transactionContext: any = {}) => {
|
|
94
|
-
const { orderPayment, order } =
|
|
98
|
+
const { orderPayment, order } = context;
|
|
95
99
|
|
|
96
100
|
if (!orderPayment || !order) {
|
|
97
101
|
throw new Error('orderPayment or order not found');
|
|
98
102
|
}
|
|
99
|
-
const pricing =
|
|
103
|
+
const pricing = OrderPricingSheet({
|
|
104
|
+
calculation: order.calculation,
|
|
105
|
+
currency: order.currency,
|
|
106
|
+
});
|
|
100
107
|
const totalAmount = pricing?.total({ useNetPrice: false }).amount;
|
|
101
108
|
|
|
102
109
|
const saferpayTransactionId = await modules.saferpayTransactions.createTransaction(
|
|
@@ -148,12 +155,15 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
148
155
|
},
|
|
149
156
|
|
|
150
157
|
charge: async ({ transactionId }: { transactionId: string }) => {
|
|
151
|
-
const { orderPayment, order } =
|
|
158
|
+
const { orderPayment, order } = context;
|
|
152
159
|
|
|
153
160
|
if (!orderPayment || !order) {
|
|
154
161
|
throw new Error('orderPayment or order not found');
|
|
155
162
|
}
|
|
156
|
-
const pricing =
|
|
163
|
+
const pricing = OrderPricingSheet({
|
|
164
|
+
calculation: order.calculation,
|
|
165
|
+
currency: order.currency,
|
|
166
|
+
});
|
|
157
167
|
const totalAmount = pricing.total({ useNetPrice: false }).amount;
|
|
158
168
|
|
|
159
169
|
const saferpayTransaction = await modules.saferpayTransactions.findTransactionById(
|
|
@@ -187,7 +197,7 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
187
197
|
},
|
|
188
198
|
|
|
189
199
|
async confirm() {
|
|
190
|
-
const { orderPayment } =
|
|
200
|
+
const { orderPayment } = context;
|
|
191
201
|
|
|
192
202
|
if (!orderPayment) {
|
|
193
203
|
throw new Error('orderPayment not found');
|
|
@@ -217,7 +227,7 @@ export const WordlineSaferpay: IPaymentAdapter = {
|
|
|
217
227
|
},
|
|
218
228
|
|
|
219
229
|
cancel: async () => {
|
|
220
|
-
const { orderPayment } =
|
|
230
|
+
const { orderPayment } = context;
|
|
221
231
|
|
|
222
232
|
if (!orderPayment) {
|
|
223
233
|
throw new Error('orderPayment not found');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Response } from './Response.js';
|
|
2
2
|
import { Request } from './Request.js';
|
|
3
|
-
import
|
|
3
|
+
import { TransactionAmount } from './Transaction.js';
|
|
4
4
|
|
|
5
5
|
export interface TransactionCaptureInput extends Request {
|
|
6
6
|
TransactionReference: {
|
|
@@ -9,7 +9,7 @@ export const saferpayHandler = async (request, response) => {
|
|
|
9
9
|
const resolvedContext = request.unchainedContext as Context & {
|
|
10
10
|
modules: { saferpayTransactions: SaferpayTransactionsModule };
|
|
11
11
|
};
|
|
12
|
-
const { modules } = resolvedContext;
|
|
12
|
+
const { modules, services } = resolvedContext;
|
|
13
13
|
|
|
14
14
|
const { orderPaymentId, signature, transactionId } = request.query;
|
|
15
15
|
const isValidRequest =
|
|
@@ -28,7 +28,7 @@ export const saferpayHandler = async (request, response) => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
|
-
logger.
|
|
31
|
+
logger.info(`checkout with orderPaymentId: ${orderPaymentId}`);
|
|
32
32
|
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
33
33
|
orderPaymentId,
|
|
34
34
|
});
|
|
@@ -42,15 +42,11 @@ export const saferpayHandler = async (request, response) => {
|
|
|
42
42
|
throw new Error('Invalid signature');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const order = await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
paymentContext: {
|
|
49
|
-
transactionId,
|
|
50
|
-
},
|
|
45
|
+
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
46
|
+
paymentContext: {
|
|
47
|
+
transactionId,
|
|
51
48
|
},
|
|
52
|
-
|
|
53
|
-
);
|
|
49
|
+
});
|
|
54
50
|
logger.info(`checkout successful`, {
|
|
55
51
|
orderPaymentId,
|
|
56
52
|
orderId: order._id,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/core-payment';
|
|
2
|
-
import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
|
|
3
1
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
2
|
import stripeClient, { createOrderPaymentIntent, createRegistrationIntent } from './stripe.js';
|
|
3
|
+
import {
|
|
4
|
+
OrderPricingSheet,
|
|
5
|
+
IPaymentAdapter,
|
|
6
|
+
PaymentAdapter,
|
|
7
|
+
PaymentDirector,
|
|
8
|
+
PaymentError,
|
|
9
|
+
} from '@unchainedshop/core';
|
|
5
10
|
|
|
6
11
|
export * from './middleware.js';
|
|
7
12
|
|
|
@@ -18,13 +23,13 @@ const Stripe: IPaymentAdapter = {
|
|
|
18
23
|
return type === 'GENERIC';
|
|
19
24
|
},
|
|
20
25
|
|
|
21
|
-
actions: (
|
|
22
|
-
const { modules } =
|
|
26
|
+
actions: (config, context) => {
|
|
27
|
+
const { modules } = context;
|
|
23
28
|
|
|
24
|
-
const descriptorPrefix =
|
|
29
|
+
const descriptorPrefix = config.find(({ key }) => key === 'descriptorPrefix')?.value;
|
|
25
30
|
|
|
26
31
|
const getUserData = async (forcedUserId) => {
|
|
27
|
-
const userId = forcedUserId ||
|
|
32
|
+
const userId = forcedUserId || context?.userId;
|
|
28
33
|
const user = await modules.users.findUserById(userId);
|
|
29
34
|
const email = modules.users.primaryEmail(user)?.address;
|
|
30
35
|
const name = user.profile.displayName || user.username || email;
|
|
@@ -35,7 +40,7 @@ const Stripe: IPaymentAdapter = {
|
|
|
35
40
|
};
|
|
36
41
|
};
|
|
37
42
|
const adapterActions = {
|
|
38
|
-
...PaymentAdapter.actions(
|
|
43
|
+
...PaymentAdapter.actions(config, context),
|
|
39
44
|
|
|
40
45
|
configurationError() {
|
|
41
46
|
const stripe = stripeClient();
|
|
@@ -82,10 +87,13 @@ const Stripe: IPaymentAdapter = {
|
|
|
82
87
|
},
|
|
83
88
|
|
|
84
89
|
sign: async (transactionContext = {}) => {
|
|
85
|
-
const { orderPayment, order, paymentProviderId } =
|
|
90
|
+
const { orderPayment, order, paymentProviderId } = context;
|
|
86
91
|
|
|
87
92
|
if (orderPayment) {
|
|
88
|
-
const pricing =
|
|
93
|
+
const pricing = OrderPricingSheet({
|
|
94
|
+
calculation: order.calculation,
|
|
95
|
+
currency: order.currency,
|
|
96
|
+
});
|
|
89
97
|
const { userId, name, email } = await getUserData(order?.userId);
|
|
90
98
|
const paymentIntent = await createOrderPaymentIntent(
|
|
91
99
|
{ userId, name, email, order, orderPayment, pricing, descriptorPrefix },
|
|
@@ -108,12 +116,15 @@ const Stripe: IPaymentAdapter = {
|
|
|
108
116
|
throw new Error('You have to provide paymentIntentId or paymentCredentials');
|
|
109
117
|
}
|
|
110
118
|
|
|
111
|
-
const { order } =
|
|
119
|
+
const { order } = context;
|
|
112
120
|
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
113
121
|
orderPaymentId: order.paymentId,
|
|
114
122
|
});
|
|
115
123
|
const { userId, name, email } = await getUserData(order?.userId);
|
|
116
|
-
const pricing =
|
|
124
|
+
const pricing = OrderPricingSheet({
|
|
125
|
+
calculation: order.calculation,
|
|
126
|
+
currency: order.currency,
|
|
127
|
+
});
|
|
117
128
|
|
|
118
129
|
const paymentIntentObject = paymentIntentId
|
|
119
130
|
? await stripe.paymentIntents.retrieve(paymentIntentId)
|
|
@@ -144,7 +155,7 @@ const Stripe: IPaymentAdapter = {
|
|
|
144
155
|
return paymentIntentObject;
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
logger.
|
|
158
|
+
logger.info('Charge postponed because paymentIntent has wrong status', {
|
|
148
159
|
orderPaymentId: paymentIntentObject.id,
|
|
149
160
|
});
|
|
150
161
|
|
|
@@ -11,7 +11,7 @@ export const WebhookEventTypes = {
|
|
|
11
11
|
|
|
12
12
|
export const stripeHandler = async (request, response) => {
|
|
13
13
|
const resolvedContext = request.unchainedContext as Context;
|
|
14
|
-
const { modules } = resolvedContext;
|
|
14
|
+
const { modules, services } = resolvedContext;
|
|
15
15
|
|
|
16
16
|
let event;
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ export const stripeHandler = async (request, response) => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (!Object.values(WebhookEventTypes).includes(event.type)) {
|
|
30
|
-
logger.
|
|
30
|
+
logger.info(`unhandled event type`, {
|
|
31
31
|
type: event.type,
|
|
32
32
|
});
|
|
33
33
|
response.writeHead(200);
|
|
@@ -43,7 +43,7 @@ export const stripeHandler = async (request, response) => {
|
|
|
43
43
|
const environmentInMetadata = event.data?.object?.metadata?.environment || '';
|
|
44
44
|
const environmentInEnv = process.env.STRIPE_WEBHOOK_ENVIRONMENT || '';
|
|
45
45
|
if (environmentInMetadata !== environmentInEnv) {
|
|
46
|
-
logger.
|
|
46
|
+
logger.info(`unhandled event environment`, {
|
|
47
47
|
type: event.type,
|
|
48
48
|
environment: environmentInMetadata,
|
|
49
49
|
});
|
|
@@ -57,7 +57,7 @@ export const stripeHandler = async (request, response) => {
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
logger.
|
|
60
|
+
logger.info(`Processing event`, {
|
|
61
61
|
type: event.type,
|
|
62
62
|
});
|
|
63
63
|
try {
|
|
@@ -65,7 +65,7 @@ export const stripeHandler = async (request, response) => {
|
|
|
65
65
|
const paymentIntent = event.data.object;
|
|
66
66
|
const { orderPaymentId } = paymentIntent.metadata || {};
|
|
67
67
|
|
|
68
|
-
logger.
|
|
68
|
+
logger.info(`checkout with orderPaymentId: ${orderPaymentId}`, {
|
|
69
69
|
type: event.type,
|
|
70
70
|
});
|
|
71
71
|
|
|
@@ -78,15 +78,11 @@ export const stripeHandler = async (request, response) => {
|
|
|
78
78
|
throw new Error(`order payment not found with orderPaymentId: ${orderPaymentId}`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const order = await
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
paymentContext: {
|
|
85
|
-
paymentIntentId: paymentIntent.id,
|
|
86
|
-
},
|
|
81
|
+
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
82
|
+
paymentContext: {
|
|
83
|
+
paymentIntentId: paymentIntent.id,
|
|
87
84
|
},
|
|
88
|
-
|
|
89
|
-
);
|
|
85
|
+
});
|
|
90
86
|
|
|
91
87
|
logger.info(`checkout successful`, {
|
|
92
88
|
orderPaymentId,
|
|
@@ -104,21 +100,17 @@ export const stripeHandler = async (request, response) => {
|
|
|
104
100
|
const setupIntent = event.data.object;
|
|
105
101
|
const { paymentProviderId, userId } = setupIntent.metadata || {};
|
|
106
102
|
|
|
107
|
-
logger.
|
|
103
|
+
logger.info(`registered payment credential with paymentProviderId: ${paymentProviderId}`, {
|
|
108
104
|
type: event.type,
|
|
109
105
|
userId,
|
|
110
106
|
});
|
|
111
107
|
|
|
112
|
-
const paymentCredentials = await
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
transactionContext: {
|
|
116
|
-
setupIntentId: setupIntent.id,
|
|
117
|
-
},
|
|
118
|
-
userId,
|
|
108
|
+
const paymentCredentials = await services.orders.registerPaymentCredentials(paymentProviderId, {
|
|
109
|
+
transactionContext: {
|
|
110
|
+
setupIntentId: setupIntent.id,
|
|
119
111
|
},
|
|
120
|
-
|
|
121
|
-
);
|
|
112
|
+
userId,
|
|
113
|
+
});
|
|
122
114
|
|
|
123
115
|
logger.info(`payment credentials registration successful`, {
|
|
124
116
|
userId,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OrderPayment } from '@unchainedshop/core-orders';
|
|
3
|
-
import { IOrderPricingSheet } from '@unchainedshop/core-orders';
|
|
1
|
+
import { IOrderPricingSheet } from '@unchainedshop/core';
|
|
2
|
+
import { Order, OrderPayment } from '@unchainedshop/core-orders';
|
|
4
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
5
|
-
import
|
|
4
|
+
import { Stripe as StripeType } from 'stripe';
|
|
6
5
|
|
|
7
6
|
const logger = createLogger('unchained:plugins:payment:stripe');
|
|
8
7
|
|
|
@@ -15,9 +14,11 @@ export const initStripeClient = async (): Promise<StripeType> => {
|
|
|
15
14
|
logger.warn('STRIPE_SECRET is not set, skipping initialization');
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
17
|
+
// eslint-disable-next-line
|
|
18
|
+
// @ts-ignore
|
|
18
19
|
const { default: Stripe } = await import('stripe');
|
|
19
20
|
stripe = new Stripe(STRIPE_SECRET, {
|
|
20
|
-
apiVersion: '2024-
|
|
21
|
+
apiVersion: '2024-11-20.acacia',
|
|
21
22
|
});
|
|
22
23
|
return stripe;
|
|
23
24
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
DeliveryPricingRowCategory,
|
|
3
|
+
IDeliveryPricingAdapter,
|
|
4
|
+
DeliveryPricingAdapter,
|
|
5
|
+
DeliveryPricingDirector,
|
|
6
|
+
} from '@unchainedshop/core';
|
|
3
7
|
|
|
4
8
|
import { Order } from '@unchainedshop/core-orders';
|
|
5
9
|
import { DeliveryProvider } from '@unchainedshop/core-delivery';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IDiscountAdapter } from '@unchainedshop/utils';
|
|
2
1
|
import {
|
|
3
2
|
OrderDiscountDirector,
|
|
4
3
|
OrderDiscountAdapter,
|
|
5
4
|
OrderDiscountConfiguration,
|
|
6
|
-
|
|
5
|
+
UnchainedCore,
|
|
6
|
+
IDiscountAdapter,
|
|
7
|
+
} from '@unchainedshop/core';
|
|
7
8
|
|
|
8
|
-
export const HundredOff: IDiscountAdapter<OrderDiscountConfiguration> = {
|
|
9
|
+
export const HundredOff: IDiscountAdapter<OrderDiscountConfiguration, UnchainedCore> = {
|
|
9
10
|
...OrderDiscountAdapter,
|
|
10
11
|
|
|
11
12
|
key: 'shop.unchained.discount.100-off',
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
OrderDiscountDirector,
|
|
3
|
+
OrderDiscountAdapter,
|
|
4
|
+
ProductDiscountConfiguration,
|
|
5
|
+
UnchainedCore,
|
|
6
|
+
IDiscountAdapter,
|
|
7
|
+
} from '@unchainedshop/core';
|
|
8
|
+
|
|
9
|
+
export const HalfPriceManual: IDiscountAdapter<ProductDiscountConfiguration, UnchainedCore> = {
|
|
6
10
|
...OrderDiscountAdapter,
|
|
7
11
|
|
|
8
12
|
key: 'shop.unchained.discount.half-price-manual',
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
OrderDiscountDirector,
|
|
3
|
+
OrderDiscountAdapter,
|
|
4
|
+
ProductDiscountConfiguration,
|
|
5
|
+
IDiscountAdapter,
|
|
6
|
+
UnchainedCore,
|
|
7
|
+
} from '@unchainedshop/core';
|
|
8
|
+
|
|
9
|
+
export const HalfPrice: IDiscountAdapter<ProductDiscountConfiguration, UnchainedCore> = {
|
|
6
10
|
...OrderDiscountAdapter,
|
|
7
11
|
|
|
8
12
|
key: 'shop.unchained.discount.half-price',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
IOrderPricingAdapter,
|
|
3
|
+
OrderPricingDirector,
|
|
4
|
+
OrderPricingAdapter,
|
|
5
|
+
DeliveryPricingSheet,
|
|
6
|
+
} from '@unchainedshop/core';
|
|
3
7
|
|
|
4
8
|
export const OrderDelivery: IOrderPricingAdapter = {
|
|
5
9
|
...OrderPricingAdapter,
|
|
@@ -15,7 +19,7 @@ export const OrderDelivery: IOrderPricingAdapter = {
|
|
|
15
19
|
|
|
16
20
|
actions: (params) => {
|
|
17
21
|
const pricingAdapter = OrderPricingAdapter.actions(params);
|
|
18
|
-
const { order, orderDelivery
|
|
22
|
+
const { order, orderDelivery } = params.context;
|
|
19
23
|
|
|
20
24
|
return {
|
|
21
25
|
...pricingAdapter,
|
|
@@ -23,11 +27,10 @@ export const OrderDelivery: IOrderPricingAdapter = {
|
|
|
23
27
|
calculate: async () => {
|
|
24
28
|
// just add tax + net price to order pricing
|
|
25
29
|
if (!orderDelivery) return null;
|
|
26
|
-
const pricing =
|
|
27
|
-
orderDelivery,
|
|
28
|
-
order.currency,
|
|
29
|
-
|
|
30
|
-
);
|
|
30
|
+
const pricing = DeliveryPricingSheet({
|
|
31
|
+
calculation: orderDelivery.calculation,
|
|
32
|
+
currency: order.currency,
|
|
33
|
+
});
|
|
31
34
|
const tax = pricing.taxSum();
|
|
32
35
|
const shipping = pricing.gross();
|
|
33
36
|
|