@unchainedshop/plugins 4.3.5 → 4.5.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 +8 -20
- 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 +2 -3
- 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 +2 -4
- 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 +3 -6
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.js +2 -6
- package/lib/worker/update-token-ownership.d.ts +1 -2
- package/lib/worker/update-token-ownership.js +4 -6
- package/lib/worker/zombie-killer.d.ts +1 -2
- package/lib/worker/zombie-killer.js +2 -9
- package/package.json +20 -25
- 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
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import { mapOrderDataToGatewayObject, mapUserToGatewayObject } from './payrexx.js';
|
|
3
|
-
import createPayrexxAPI, { GatewayObjectStatus } from './api/index.js';
|
|
4
|
-
import {
|
|
5
|
-
OrderPricingSheet,
|
|
6
|
-
IPaymentAdapter,
|
|
7
|
-
PaymentAdapter,
|
|
8
|
-
PaymentDirector,
|
|
9
|
-
PaymentError,
|
|
10
|
-
} from '@unchainedshop/core';
|
|
11
|
-
|
|
12
|
-
const logger = createLogger('unchained:payrexx');
|
|
13
|
-
|
|
14
|
-
const Payrexx: IPaymentAdapter = {
|
|
15
|
-
...PaymentAdapter,
|
|
16
|
-
|
|
17
|
-
key: 'shop.unchained.payment.payrexx',
|
|
18
|
-
label: 'Payrexx',
|
|
19
|
-
version: '1.0.0',
|
|
20
|
-
|
|
21
|
-
typeSupported(type) {
|
|
22
|
-
return type === 'GENERIC';
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
actions: (config, context) => {
|
|
26
|
-
const { modules } = context;
|
|
27
|
-
|
|
28
|
-
const instance = config.find((c) => c.key === 'instance')?.value;
|
|
29
|
-
|
|
30
|
-
const adapterActions = {
|
|
31
|
-
...PaymentAdapter.actions(config, context),
|
|
32
|
-
|
|
33
|
-
configurationError() {
|
|
34
|
-
if (!process.env.PAYREXX_SECRET) {
|
|
35
|
-
return PaymentError.INCOMPLETE_CONFIGURATION;
|
|
36
|
-
}
|
|
37
|
-
if (!instance) {
|
|
38
|
-
return PaymentError.INCOMPLETE_CONFIGURATION;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
isActive: () => {
|
|
44
|
-
if (adapterActions.configurationError() === null) return true;
|
|
45
|
-
return false;
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
isPayLaterAllowed() {
|
|
49
|
-
return false;
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
sign: async (transactionContext = {}) => {
|
|
53
|
-
const { orderPayment, userId, order } = context;
|
|
54
|
-
|
|
55
|
-
if (!order) throw new Error('No order in context, can only sign with order context');
|
|
56
|
-
|
|
57
|
-
const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
|
|
58
|
-
|
|
59
|
-
if (orderPayment) {
|
|
60
|
-
// Order Checkout signing (One-time payment)
|
|
61
|
-
const pricing = OrderPricingSheet({
|
|
62
|
-
calculation: order.calculation,
|
|
63
|
-
currencyCode: order.currencyCode,
|
|
64
|
-
});
|
|
65
|
-
const gatewayObject = mapOrderDataToGatewayObject(
|
|
66
|
-
{ order, orderPayment, pricing },
|
|
67
|
-
transactionContext,
|
|
68
|
-
);
|
|
69
|
-
const gateway = await api.createGateway(gatewayObject);
|
|
70
|
-
return JSON.stringify(gateway);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Payment Credential Registration signing
|
|
74
|
-
|
|
75
|
-
const user = userId && (await modules.users.findUserById(userId));
|
|
76
|
-
if (!user) throw new Error('User not found, can only sign registrations with user context');
|
|
77
|
-
|
|
78
|
-
const emailAddress = modules.users.primaryEmail(user)?.address;
|
|
79
|
-
const gateway = await api.createGateway(
|
|
80
|
-
mapUserToGatewayObject({
|
|
81
|
-
userId,
|
|
82
|
-
emailAddress,
|
|
83
|
-
currencyCode: order?.currencyCode,
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
return JSON.stringify(gateway);
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
// async validate(credentials) {
|
|
90
|
-
// if (!credentials.meta) return false;
|
|
91
|
-
// const { objectKey, currency } = credentials.meta;
|
|
92
|
-
// const result = await api().validate({
|
|
93
|
-
// refno: Buffer.from(`valid-${new Date().getTime()}`, 'hex').toString('base64'),
|
|
94
|
-
// currency,
|
|
95
|
-
// [objectKey]: JSON.parse(credentials.token),
|
|
96
|
-
// });
|
|
97
|
-
// return Boolean((result as ValidateResponseSuccess)?.transactionId);
|
|
98
|
-
// },
|
|
99
|
-
|
|
100
|
-
async register(/* transactionResponse */) {
|
|
101
|
-
// const { transactionId } = transactionResponse;
|
|
102
|
-
throw new Error('Not implemented');
|
|
103
|
-
// const result = (await api().status({
|
|
104
|
-
// transactionId,
|
|
105
|
-
// })) as StatusResponseSuccess;
|
|
106
|
-
// if (result.transactionId) {
|
|
107
|
-
// return await parseRegistrationData(result);
|
|
108
|
-
// }
|
|
109
|
-
return null;
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
async confirm() {
|
|
113
|
-
const { orderPayment } = context;
|
|
114
|
-
|
|
115
|
-
if (!orderPayment?.transactionId) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
const { transactionId } = orderPayment;
|
|
119
|
-
|
|
120
|
-
const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
|
|
121
|
-
|
|
122
|
-
const gatewayObject = await api.getGateway(transactionId);
|
|
123
|
-
|
|
124
|
-
if (!gatewayObject) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
// gatewayObject.status === GatewayObjectStatus.authorized || // authorized is only used for tokenization!
|
|
130
|
-
gatewayObject.status === GatewayObjectStatus.reserved
|
|
131
|
-
) {
|
|
132
|
-
const allTransactions = gatewayObject.invoices?.flatMap((invoice) => invoice.transactions);
|
|
133
|
-
await Promise.all(
|
|
134
|
-
allTransactions.map(async (transaction) =>
|
|
135
|
-
api.chargePreAuthorized(transaction.id, { referenceId: '__IGNORE_WEBHOOK__' }),
|
|
136
|
-
),
|
|
137
|
-
);
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (gatewayObject.status === GatewayObjectStatus.confirmed) {
|
|
142
|
-
return true; // already confirmed, no need to confirm
|
|
143
|
-
}
|
|
144
|
-
return false; // some other status with refund or anything, can't confirm!
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
async cancel() {
|
|
148
|
-
const { orderPayment } = context;
|
|
149
|
-
if (!orderPayment?.transactionId) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
const { transactionId } = orderPayment;
|
|
153
|
-
|
|
154
|
-
const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
|
|
155
|
-
|
|
156
|
-
const gatewayObject = await api.getGateway(transactionId);
|
|
157
|
-
|
|
158
|
-
if (!gatewayObject) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (gatewayObject.status === GatewayObjectStatus.reserved) {
|
|
163
|
-
const allTransactions = gatewayObject.invoices?.flatMap((invoice) => invoice.transactions);
|
|
164
|
-
await Promise.all(
|
|
165
|
-
allTransactions.map(async (transaction) => api.deleteReservation(transaction.id)),
|
|
166
|
-
);
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (gatewayObject.status === GatewayObjectStatus.confirmed) {
|
|
171
|
-
return false; // already confirmed, can't cancel anymore
|
|
172
|
-
}
|
|
173
|
-
return true; // some other status with refund or anything, no need to cancel
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
charge: async ({ gatewayId, paymentCredentials }) => {
|
|
177
|
-
if (!gatewayId && !paymentCredentials) {
|
|
178
|
-
throw new Error('You have to provide gatewayId or paymentCredentials');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const { order, orderPayment } = context;
|
|
182
|
-
|
|
183
|
-
if (!order) throw new Error('No order in context, can only charge with order context');
|
|
184
|
-
if (!orderPayment) throw new Error('Order payment not found');
|
|
185
|
-
|
|
186
|
-
const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
|
|
187
|
-
|
|
188
|
-
const gatewayObject = await api.getGateway(gatewayId);
|
|
189
|
-
|
|
190
|
-
if (!gatewayObject) {
|
|
191
|
-
throw new Error('Could not load gateway from the Payrexx API');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const pricing = OrderPricingSheet({
|
|
195
|
-
calculation: order.calculation,
|
|
196
|
-
currencyCode: order.currencyCode,
|
|
197
|
-
});
|
|
198
|
-
const { currencyCode, amount } = pricing.total({ useNetPrice: false });
|
|
199
|
-
|
|
200
|
-
if (
|
|
201
|
-
// gatewayObject.status === 'authorized' || // authorized is only used for tokenization!
|
|
202
|
-
gatewayObject.status === 'reserved' ||
|
|
203
|
-
gatewayObject.status === 'confirmed'
|
|
204
|
-
) {
|
|
205
|
-
try {
|
|
206
|
-
if (
|
|
207
|
-
gatewayObject.currency !== currencyCode.toUpperCase() ||
|
|
208
|
-
gatewayObject.amount !== Math.round(amount)
|
|
209
|
-
) {
|
|
210
|
-
throw new Error('The price has changed since the intent has been created');
|
|
211
|
-
}
|
|
212
|
-
if (gatewayObject.referenceId !== orderPayment?._id) {
|
|
213
|
-
throw new Error('The order payment is different from the initiating intent');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// confirm will do the transition, to do a checkout those stati above are fine
|
|
217
|
-
logger.info(`Mark as charged, status is ${gatewayObject.status}`, {
|
|
218
|
-
orderPaymentId: gatewayObject.referenceId,
|
|
219
|
-
});
|
|
220
|
-
return {
|
|
221
|
-
transactionId: gatewayId,
|
|
222
|
-
gatewayObject,
|
|
223
|
-
};
|
|
224
|
-
} catch (e) {
|
|
225
|
-
if (gatewayObject.status === GatewayObjectStatus.reserved) {
|
|
226
|
-
// Cancel the reservation if it's reserved and the order has been manipulated
|
|
227
|
-
const allTransactions = gatewayObject.invoices?.flatMap((invoice) => invoice.transactions);
|
|
228
|
-
await Promise.all(
|
|
229
|
-
allTransactions.map(async (transaction) => api.deleteReservation(transaction.id)),
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
throw e;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
logger.info('Charge not possible', {
|
|
237
|
-
orderPaymentId: gatewayObject.referenceId,
|
|
238
|
-
status: gatewayObject.status,
|
|
239
|
-
});
|
|
240
|
-
throw new Error(`Gateway Status ${gatewayObject.status} does not allow checkout`);
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
return adapterActions;
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
PaymentDirector.registerAdapter(Payrexx);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const getRedirects = () => {
|
|
2
|
-
const {
|
|
3
|
-
EMAIL_WEBSITE_URL,
|
|
4
|
-
DATATRANS_SUCCESS_PATH = '/payrexx/success',
|
|
5
|
-
DATATRANS_ERROR_PATH = '/payrexx/error',
|
|
6
|
-
DATATRANS_CANCEL_PATH = '/payrexx/cancel',
|
|
7
|
-
} = process.env;
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
successRedirectUrl: `${EMAIL_WEBSITE_URL}${DATATRANS_SUCCESS_PATH}`,
|
|
11
|
-
failedRedirectUrl: `${EMAIL_WEBSITE_URL}${DATATRANS_ERROR_PATH}`,
|
|
12
|
-
cancelRedirectUrl: `${EMAIL_WEBSITE_URL}${DATATRANS_CANCEL_PATH}`,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const mapOrderDataToGatewayObject = ({ order, orderPayment, pricing }, options = {}) => {
|
|
17
|
-
const { currencyCode, amount } = pricing.total({ useNetPrice: false });
|
|
18
|
-
|
|
19
|
-
const customerData = {};
|
|
20
|
-
if (order.contact?.emailAddress) {
|
|
21
|
-
customerData['fields[email][value]'] = order.contact?.emailAddress;
|
|
22
|
-
}
|
|
23
|
-
if (order.billingAddress?.firstName) {
|
|
24
|
-
customerData['fields[forename][value]'] = order.billingAddress?.firstName;
|
|
25
|
-
}
|
|
26
|
-
if (order.billingAddress?.lastName) {
|
|
27
|
-
customerData['fields[surname][value]'] = order.billingAddress?.lastName;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const gatewayObject = {
|
|
31
|
-
amount: Math.round(amount),
|
|
32
|
-
currency: currencyCode.toUpperCase(),
|
|
33
|
-
purpose: encodeURIComponent(`${process.env.EMAIL_WEBSITE_NAME || 'Unchained'} #${order._id}`),
|
|
34
|
-
reservation: true,
|
|
35
|
-
skipResultPage: true,
|
|
36
|
-
...getRedirects(),
|
|
37
|
-
referenceId: orderPayment._id,
|
|
38
|
-
...customerData,
|
|
39
|
-
...options,
|
|
40
|
-
};
|
|
41
|
-
return gatewayObject;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const mapUserToGatewayObject = ({ userId, emailAddress, currencyCode }, options = {}) => {
|
|
45
|
-
const customerData = {};
|
|
46
|
-
|
|
47
|
-
if (emailAddress) {
|
|
48
|
-
customerData['fields[email][value]'] = emailAddress;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
customerData['fields[custom_field_1][name][0]'] = 'userId';
|
|
52
|
-
customerData['fields[custom_field_1][value]'] = userId;
|
|
53
|
-
|
|
54
|
-
const gatewayObject = {
|
|
55
|
-
amount: Math.round(0),
|
|
56
|
-
currency: currencyCode,
|
|
57
|
-
purpose: encodeURIComponent(`${process.env.EMAIL_WEBSITE_NAME || 'Unchained'} ${userId}`),
|
|
58
|
-
preAuthorization: true,
|
|
59
|
-
skipResultPage: true,
|
|
60
|
-
...getRedirects(),
|
|
61
|
-
referenceId: userId,
|
|
62
|
-
...options,
|
|
63
|
-
};
|
|
64
|
-
return gatewayObject;
|
|
65
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
const API_BASE_URL = 'https://checkout.postfinance.ch/api';
|
|
2
|
-
|
|
3
|
-
interface ApiConfig {
|
|
4
|
-
spaceId: number;
|
|
5
|
-
userId: number;
|
|
6
|
-
apiSecret: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface MacHeaders {
|
|
10
|
-
'x-mac-version': string;
|
|
11
|
-
'x-mac-userid': string;
|
|
12
|
-
'x-mac-timestamp': string;
|
|
13
|
-
'x-mac-value': string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class PostFinanceApiClient {
|
|
17
|
-
private config: ApiConfig;
|
|
18
|
-
|
|
19
|
-
constructor(config: ApiConfig) {
|
|
20
|
-
this.config = config;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private async generateMacHeaders(method: string, path: string): Promise<MacHeaders> {
|
|
24
|
-
const version = '1';
|
|
25
|
-
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
26
|
-
const userId = this.config.userId.toString();
|
|
27
|
-
|
|
28
|
-
// Use path as-is since it already includes /api from the URL
|
|
29
|
-
const resourcePath = path;
|
|
30
|
-
|
|
31
|
-
const dataToSign = [version, userId, timestamp, method, resourcePath].join('|');
|
|
32
|
-
|
|
33
|
-
// Use Web Crypto API instead of crypto.createHmac
|
|
34
|
-
const secretBytes = Uint8Array.from(atob(this.config.apiSecret), (c) => c.charCodeAt(0));
|
|
35
|
-
const key = await crypto.subtle.importKey(
|
|
36
|
-
'raw',
|
|
37
|
-
secretBytes,
|
|
38
|
-
{ name: 'HMAC', hash: 'SHA-512' },
|
|
39
|
-
false,
|
|
40
|
-
['sign'],
|
|
41
|
-
);
|
|
42
|
-
const signature = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(dataToSign));
|
|
43
|
-
const macValue = btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
'x-mac-version': version,
|
|
47
|
-
'x-mac-userid': userId,
|
|
48
|
-
'x-mac-timestamp': timestamp,
|
|
49
|
-
'x-mac-value': macValue,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async request<T>(method: string, endpoint: string, body?: any): Promise<T> {
|
|
54
|
-
const url = `${API_BASE_URL}${endpoint}`;
|
|
55
|
-
const urlObj = new URL(url);
|
|
56
|
-
// Include both pathname and search (query parameters) for MAC signature
|
|
57
|
-
const pathWithQuery = urlObj.pathname + urlObj.search;
|
|
58
|
-
const macHeaders = await this.generateMacHeaders(method, pathWithQuery);
|
|
59
|
-
|
|
60
|
-
const headers: Record<string, string> = {
|
|
61
|
-
...macHeaders,
|
|
62
|
-
'Content-Type': 'application/json',
|
|
63
|
-
Accept: 'application/json',
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const options: RequestInit = {
|
|
67
|
-
method,
|
|
68
|
-
headers,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
if (body && method !== 'GET') {
|
|
72
|
-
options.body = JSON.stringify(body);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const response = await fetch(url, options);
|
|
76
|
-
|
|
77
|
-
if (!response.ok) {
|
|
78
|
-
const errorData = await response.json().catch(() => ({}));
|
|
79
|
-
throw new Error(
|
|
80
|
-
`PostFinance API error: ${response.status} ${response.statusText} ${JSON.stringify(errorData)}`,
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const responseText = await response.text();
|
|
85
|
-
const contentType = response.headers.get('content-type');
|
|
86
|
-
|
|
87
|
-
if (contentType && contentType.includes('application/json')) {
|
|
88
|
-
try {
|
|
89
|
-
return JSON.parse(responseText);
|
|
90
|
-
} catch {
|
|
91
|
-
// If JSON parsing fails but content-type is json, return as text
|
|
92
|
-
// This handles PostFinance's payment-page-url endpoint that returns plain text with json content-type
|
|
93
|
-
return responseText as any;
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
return responseText as any;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
get<T>(endpoint: string): Promise<T> {
|
|
101
|
-
return this.request<T>('GET', endpoint);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
post<T>(endpoint: string, body: any): Promise<T> {
|
|
105
|
-
return this.request<T>('POST', endpoint, body);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
patch<T>(endpoint: string, body: any): Promise<T> {
|
|
109
|
-
return this.request<T>('PATCH', endpoint, body);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// PostFinance Checkout API Types
|
|
2
|
-
|
|
3
|
-
export enum TransactionState {
|
|
4
|
-
CREATE = 'CREATE',
|
|
5
|
-
PENDING = 'PENDING',
|
|
6
|
-
CONFIRMED = 'CONFIRMED',
|
|
7
|
-
PROCESSING = 'PROCESSING',
|
|
8
|
-
FAILED = 'FAILED',
|
|
9
|
-
AUTHORIZED = 'AUTHORIZED',
|
|
10
|
-
VOIDED = 'VOIDED',
|
|
11
|
-
COMPLETED = 'COMPLETED',
|
|
12
|
-
FULFILL = 'FULFILL',
|
|
13
|
-
DECLINE = 'DECLINE',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum TokenizationMode {
|
|
17
|
-
FORCE_UPDATE = 'FORCE_UPDATE',
|
|
18
|
-
ALLOW = 'ALLOW',
|
|
19
|
-
ALLOW_ONE_CLICK_PAYMENT = 'ALLOW_ONE_CLICK_PAYMENT',
|
|
20
|
-
DENY = 'DENY',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export enum TransactionCompletionBehavior {
|
|
24
|
-
COMPLETE_IMMEDIATELY = 'COMPLETE_IMMEDIATELY',
|
|
25
|
-
COMPLETE_DEFERRED = 'COMPLETE_DEFERRED',
|
|
26
|
-
USE_CONFIGURATION = 'USE_CONFIGURATION',
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export enum LineItemType {
|
|
30
|
-
SHIPPING = 'SHIPPING',
|
|
31
|
-
DISCOUNT = 'DISCOUNT',
|
|
32
|
-
FEE = 'FEE',
|
|
33
|
-
PRODUCT = 'PRODUCT',
|
|
34
|
-
TIP = 'TIP',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export enum RefundType {
|
|
38
|
-
MERCHANT_INITIATED_ONLINE = 'MERCHANT_INITIATED_ONLINE',
|
|
39
|
-
MERCHANT_INITIATED_OFFLINE = 'MERCHANT_INITIATED_OFFLINE',
|
|
40
|
-
CUSTOMER_INITIATED_AUTOMATIC = 'CUSTOMER_INITIATED_AUTOMATIC',
|
|
41
|
-
CUSTOMER_INITIATED_MANUAL = 'CUSTOMER_INITIATED_MANUAL',
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export enum CreationEntityState {
|
|
45
|
-
CREATE = 'CREATE',
|
|
46
|
-
ACTIVE = 'ACTIVE',
|
|
47
|
-
INACTIVE = 'INACTIVE',
|
|
48
|
-
DELETING = 'DELETING',
|
|
49
|
-
DELETED = 'DELETED',
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface LineItem {
|
|
53
|
-
name: string;
|
|
54
|
-
type: LineItemType;
|
|
55
|
-
quantity: number;
|
|
56
|
-
uniqueId: string;
|
|
57
|
-
amountIncludingTax: number;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface TransactionCreate {
|
|
61
|
-
currency: string;
|
|
62
|
-
customerId?: string;
|
|
63
|
-
tokenizationMode?: TokenizationMode;
|
|
64
|
-
completionBehavior?: TransactionCompletionBehavior;
|
|
65
|
-
lineItems?: LineItem[];
|
|
66
|
-
successUrl?: string;
|
|
67
|
-
failedUrl?: string;
|
|
68
|
-
metaData?: Record<string, any>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface Transaction {
|
|
72
|
-
id: number;
|
|
73
|
-
state: TransactionState;
|
|
74
|
-
currency: string;
|
|
75
|
-
completedAmount?: number;
|
|
76
|
-
authorizationAmount?: number;
|
|
77
|
-
metaData?: Record<string, any>;
|
|
78
|
-
token?: {
|
|
79
|
-
id: number;
|
|
80
|
-
[key: string]: any;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface TransactionCompletion {
|
|
85
|
-
id: number;
|
|
86
|
-
state: string;
|
|
87
|
-
transaction: number;
|
|
88
|
-
linkedTransaction?: number;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface Token {
|
|
92
|
-
id: number;
|
|
93
|
-
state: CreationEntityState;
|
|
94
|
-
name?: string;
|
|
95
|
-
customerId?: string;
|
|
96
|
-
enabledForOneClickPayment?: boolean;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface RefundCreate {
|
|
100
|
-
transaction: number;
|
|
101
|
-
externalId: string;
|
|
102
|
-
amount: number;
|
|
103
|
-
type: RefundType;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface Refund {
|
|
107
|
-
id: number;
|
|
108
|
-
state: string;
|
|
109
|
-
amount: number;
|
|
110
|
-
transaction: number;
|
|
111
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { PostFinanceApiClient } from './api-client.js';
|
|
2
|
-
import {
|
|
3
|
-
Transaction,
|
|
4
|
-
TransactionCreate,
|
|
5
|
-
TransactionCompletion,
|
|
6
|
-
Token,
|
|
7
|
-
RefundCreate,
|
|
8
|
-
RefundType,
|
|
9
|
-
} from './api-types.js';
|
|
10
|
-
|
|
11
|
-
const { PFCHECKOUT_SPACE_ID, PFCHECKOUT_USER_ID, PFCHECKOUT_SECRET } = process.env;
|
|
12
|
-
const SPACE_ID = parseInt(PFCHECKOUT_SPACE_ID as string, 10);
|
|
13
|
-
const USER_ID = parseInt(PFCHECKOUT_USER_ID as string, 10);
|
|
14
|
-
|
|
15
|
-
let apiClient: PostFinanceApiClient;
|
|
16
|
-
|
|
17
|
-
const getApiClient = () => {
|
|
18
|
-
if (!apiClient) {
|
|
19
|
-
apiClient = new PostFinanceApiClient({
|
|
20
|
-
spaceId: SPACE_ID,
|
|
21
|
-
userId: USER_ID,
|
|
22
|
-
apiSecret: PFCHECKOUT_SECRET as string,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return apiClient;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const getTransaction = async (transactionId: string): Promise<Transaction> => {
|
|
29
|
-
const client = getApiClient();
|
|
30
|
-
return client.get<Transaction>(`/transaction/read?spaceId=${SPACE_ID}&id=${transactionId}`);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getTransactionCompletion = async (id: string): Promise<TransactionCompletion> => {
|
|
34
|
-
const client = getApiClient();
|
|
35
|
-
return client.get<TransactionCompletion>(`/transaction-completion/read?spaceId=${SPACE_ID}&id=${id}`);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const getToken = async (spaceId: number, tokenId: number): Promise<Token> => {
|
|
39
|
-
const client = getApiClient();
|
|
40
|
-
return client.get<Token>(`/token/read?spaceId=${spaceId || SPACE_ID}&id=${tokenId}`);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const createTransaction = async (transaction: TransactionCreate): Promise<number | null> => {
|
|
44
|
-
const client = getApiClient();
|
|
45
|
-
const result = await client.post<Transaction>(`/transaction/create?spaceId=${SPACE_ID}`, transaction);
|
|
46
|
-
return result.id || null;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const voidTransaction = async (transactionId: string): Promise<boolean> => {
|
|
50
|
-
const client = getApiClient();
|
|
51
|
-
try {
|
|
52
|
-
await client.post(`/transaction-void/voidOnline?spaceId=${SPACE_ID}&id=${transactionId}`, {});
|
|
53
|
-
return true;
|
|
54
|
-
} catch {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const refundTransaction = async (
|
|
60
|
-
transactionId: string,
|
|
61
|
-
orderId: string,
|
|
62
|
-
amount: number,
|
|
63
|
-
): Promise<boolean> => {
|
|
64
|
-
const client = getApiClient();
|
|
65
|
-
const refund: RefundCreate = {
|
|
66
|
-
transaction: parseInt(transactionId, 10),
|
|
67
|
-
externalId: orderId,
|
|
68
|
-
amount,
|
|
69
|
-
type: RefundType.MERCHANT_INITIATED_ONLINE,
|
|
70
|
-
};
|
|
71
|
-
try {
|
|
72
|
-
await client.post(`/refund/refund?spaceId=${SPACE_ID}`, refund);
|
|
73
|
-
return true;
|
|
74
|
-
} catch {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const confirmDeferredTransaction = async (transactionId: string): Promise<boolean> => {
|
|
80
|
-
const client = getApiClient();
|
|
81
|
-
try {
|
|
82
|
-
await client.post(
|
|
83
|
-
`/transaction-completion/completeOnline?spaceId=${SPACE_ID}&transactionId=${transactionId}`,
|
|
84
|
-
{},
|
|
85
|
-
);
|
|
86
|
-
return true;
|
|
87
|
-
} catch {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const getPaymentPageUrl = async (transactionId: number): Promise<string> => {
|
|
93
|
-
const client = getApiClient();
|
|
94
|
-
const result = await client.get<string>(
|
|
95
|
-
`/transaction-payment-page/payment-page-url?spaceId=${SPACE_ID}&id=${transactionId}`,
|
|
96
|
-
);
|
|
97
|
-
return result;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const getLightboxJavascriptUrl = async (transactionId: number): Promise<string> => {
|
|
101
|
-
const client = getApiClient();
|
|
102
|
-
const result = await client.get<string>(
|
|
103
|
-
`/transaction-lightbox/javascript-url?spaceId=${SPACE_ID}&id=${transactionId}`,
|
|
104
|
-
);
|
|
105
|
-
return result;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export const getIframeJavascriptUrl = async (transactionId: number): Promise<string> => {
|
|
109
|
-
const client = getApiClient();
|
|
110
|
-
const result = await client.get<string>(
|
|
111
|
-
`/transaction-iframe/javascript-url?spaceId=${SPACE_ID}&id=${transactionId}`,
|
|
112
|
-
);
|
|
113
|
-
return result;
|
|
114
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Context } from '@unchainedshop/api';
|
|
2
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
3
|
-
import { WebhookData } from './types.js';
|
|
4
|
-
import { getTransaction, getTransactionCompletion } from './api.js';
|
|
5
|
-
|
|
6
|
-
const logger = createLogger('unchained:postfinance-checkout:handler');
|
|
7
|
-
|
|
8
|
-
export const postfinanceCheckoutHandler = async (req, res) => {
|
|
9
|
-
const context = req.unchainedContext as Context;
|
|
10
|
-
const { services, modules } = context;
|
|
11
|
-
const data = req.body as WebhookData;
|
|
12
|
-
if (data.listenerEntityTechnicalName === 'TransactionCompletion') {
|
|
13
|
-
try {
|
|
14
|
-
const transactionCompletion = await getTransactionCompletion(data.entityId as unknown as string);
|
|
15
|
-
const transaction = await getTransaction(
|
|
16
|
-
transactionCompletion ? (transactionCompletion as any).linkedTransaction : data.entityId,
|
|
17
|
-
);
|
|
18
|
-
const { orderPaymentId } = transaction.metaData as { orderPaymentId: string };
|
|
19
|
-
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
20
|
-
orderPaymentId,
|
|
21
|
-
});
|
|
22
|
-
if (!orderPayment) throw new Error('Order Payment not found');
|
|
23
|
-
|
|
24
|
-
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
25
|
-
paymentContext: {
|
|
26
|
-
transactionId: transactionCompletion.linkedTransaction,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
if (!order) throw new Error(`Order with id ${orderPayment.orderId} not found`);
|
|
31
|
-
|
|
32
|
-
logger.info(
|
|
33
|
-
`Transaction ${transactionCompletion.linkedTransaction} marked order payment ID ${transaction.metaData?.orderPaymentId} as paid`,
|
|
34
|
-
);
|
|
35
|
-
res.status(200).send(`Order marked as paid: ${order.orderNumber}`);
|
|
36
|
-
} catch (e) {
|
|
37
|
-
logger.error(e);
|
|
38
|
-
res.status(500).send({ name: e.name, code: e.code, message: e.message });
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
logger.error(`Received unknown listenerEntityTechnicalName ${data.listenerEntityTechnicalName}`);
|
|
42
|
-
res.status(404).end();
|
|
43
|
-
}
|
|
44
|
-
};
|