@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,147 +0,0 @@
|
|
|
1
|
-
import { Context } from '@unchainedshop/api';
|
|
2
|
-
import { EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
3
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
4
|
-
import { fixPeriods } from './fix-periods.js';
|
|
5
|
-
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
6
|
-
import { AppleTransactionsModule } from './module.js';
|
|
7
|
-
|
|
8
|
-
const logger = createLogger('unchained:apple-iap:handler');
|
|
9
|
-
|
|
10
|
-
const { APPLE_IAP_SHARED_SECRET } = process.env;
|
|
11
|
-
|
|
12
|
-
const AppleNotificationTypes = {
|
|
13
|
-
INITIAL_BUY: 'INITIAL_BUY',
|
|
14
|
-
DID_RECOVER: 'DID_RECOVER',
|
|
15
|
-
DID_CHANGE_RENEWAL_STATUS: 'DID_CHANGE_RENEWAL_STATUS',
|
|
16
|
-
DID_FAIL_TO_RENEW: 'DID_FAIL_TO_RENEW',
|
|
17
|
-
DID_CHANGE_RENEWAL_PREF: 'DID_CHANGE_RENEWAL_PREF',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const appleIAPHandler: RouteHandlerMethod = async (
|
|
21
|
-
req: FastifyRequest & {
|
|
22
|
-
unchainedContext: Context & {
|
|
23
|
-
modules: AppleTransactionsModule;
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
reply,
|
|
27
|
-
) => {
|
|
28
|
-
try {
|
|
29
|
-
const resolvedContext = req.unchainedContext as Context;
|
|
30
|
-
const { modules, services } = resolvedContext;
|
|
31
|
-
const responseBody: Record<string, any> = req.body || {};
|
|
32
|
-
if (responseBody.password !== APPLE_IAP_SHARED_SECRET) {
|
|
33
|
-
throw new Error('shared secret not valid');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const transactions = responseBody?.unified_receipt?.latest_receipt_info;
|
|
37
|
-
const latestTransaction = transactions[0];
|
|
38
|
-
|
|
39
|
-
if (responseBody.notification_type === AppleNotificationTypes.INITIAL_BUY) {
|
|
40
|
-
// Find the cart to checkout
|
|
41
|
-
const orderPayment = await modules.orders.payments.findOrderPaymentByContextData({
|
|
42
|
-
context: {
|
|
43
|
-
'meta.transactionIdentifier': latestTransaction.transaction_id,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
if (!orderPayment) throw new Error('Could not find any matching order payment');
|
|
48
|
-
|
|
49
|
-
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
50
|
-
paymentContext: {
|
|
51
|
-
receiptData: responseBody?.unified_receipt?.latest_receipt,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (!order) throw new Error(`Order with id ${orderPayment.orderId} not found`);
|
|
56
|
-
|
|
57
|
-
const orderId = order._id;
|
|
58
|
-
const enrollment = await modules.enrollments.findEnrollment({
|
|
59
|
-
orderId,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (!enrollment) throw new Error('Enrollent not found');
|
|
63
|
-
|
|
64
|
-
await fixPeriods(
|
|
65
|
-
{
|
|
66
|
-
transactionId: latestTransaction.original_transaction_id,
|
|
67
|
-
transactions,
|
|
68
|
-
enrollmentId: enrollment._id,
|
|
69
|
-
orderId,
|
|
70
|
-
},
|
|
71
|
-
resolvedContext,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
logger.info(`Webhook confirmed checkout for order ${order.orderNumber}`, {
|
|
75
|
-
orderId: order._id,
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
// Just store payment credentials, use the enrollments paymentProvider reference and
|
|
79
|
-
// let the job do the rest
|
|
80
|
-
const originalOrderPayment = await modules.orders.payments.findOrderPaymentByContextData({
|
|
81
|
-
context: {
|
|
82
|
-
'meta.transactionIdentifier': latestTransaction.original_transaction_id,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
if (!originalOrderPayment) throw new Error('Could not find any matching order payment');
|
|
86
|
-
const originalOrder = await modules.orders.findOrder({
|
|
87
|
-
orderId: originalOrderPayment.orderId,
|
|
88
|
-
});
|
|
89
|
-
const enrollment =
|
|
90
|
-
originalOrder &&
|
|
91
|
-
(await modules.enrollments.findEnrollment({
|
|
92
|
-
orderId: originalOrder._id,
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
if (!enrollment?.payment) throw new Error('Could not find a valid enrollment payment method');
|
|
96
|
-
|
|
97
|
-
await services.orders.registerPaymentCredentials(enrollment.payment.paymentProviderId, {
|
|
98
|
-
transactionContext: {
|
|
99
|
-
receiptData: responseBody?.unified_receipt?.latest_receipt,
|
|
100
|
-
},
|
|
101
|
-
userId: enrollment.userId,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
await fixPeriods(
|
|
105
|
-
{
|
|
106
|
-
transactionId: latestTransaction.original_transaction_id,
|
|
107
|
-
transactions,
|
|
108
|
-
enrollmentId: enrollment._id,
|
|
109
|
-
orderId: originalOrder!._id,
|
|
110
|
-
},
|
|
111
|
-
resolvedContext,
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
logger.info(
|
|
115
|
-
`Webhook rocessed notification for ${latestTransaction.original_transaction_id} and type ${responseBody.notification_type}`,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
if (responseBody.notification_type === AppleNotificationTypes.DID_RECOVER) {
|
|
119
|
-
if (
|
|
120
|
-
enrollment.status !== EnrollmentStatus.TERMINATED &&
|
|
121
|
-
responseBody.auto_renew_status === 'false'
|
|
122
|
-
) {
|
|
123
|
-
await services.enrollments.terminateEnrollment(enrollment);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (responseBody.notification_type === AppleNotificationTypes.DID_CHANGE_RENEWAL_STATUS) {
|
|
128
|
-
if (
|
|
129
|
-
enrollment.status !== EnrollmentStatus.TERMINATED &&
|
|
130
|
-
responseBody.auto_renew_status === 'false'
|
|
131
|
-
) {
|
|
132
|
-
await services.enrollments.terminateEnrollment(enrollment);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
logger.info(`Apple IAP Webhook: Updated enrollment from Apple`);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
reply.status(200);
|
|
139
|
-
return reply.send();
|
|
140
|
-
} catch (e) {
|
|
141
|
-
logger.error(e);
|
|
142
|
-
reply.status(503);
|
|
143
|
-
return reply.send({ success: false, name: e.name, code: e.code, message: e.message });
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export default appleIAPHandler;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { generateDbObjectId } from '@unchainedshop/mongodb';
|
|
2
|
-
import { AppleTransaction, AppleTransactionsCollection } from './db/AppleTransactionsCollection.js';
|
|
3
|
-
|
|
4
|
-
export const configureAppleTransactionsModule = async ({ db }) => {
|
|
5
|
-
const AppleTransactions = await AppleTransactionsCollection(db);
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
findTransactionById: async (transactionIdentifier: string): Promise<AppleTransaction | null> => {
|
|
9
|
-
return AppleTransactions.findOne({ _id: transactionIdentifier });
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
createTransaction: async (
|
|
13
|
-
doc: Omit<AppleTransaction, '_id' | 'created'> &
|
|
14
|
-
Pick<Partial<AppleTransaction>, '_id' | 'created'>,
|
|
15
|
-
) => {
|
|
16
|
-
const { insertedId } = await AppleTransactions.insertOne({
|
|
17
|
-
_id: generateDbObjectId(),
|
|
18
|
-
...doc,
|
|
19
|
-
created: new Date(),
|
|
20
|
-
});
|
|
21
|
-
return insertedId;
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
appleTransactions: {
|
|
28
|
-
configure: configureAppleTransactionsModule,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export interface AppleTransactionsModule {
|
|
33
|
-
appleTransactions: Awaited<ReturnType<typeof configureAppleTransactionsModule>>;
|
|
34
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const { APPLE_IAP_ENVIRONMENT = 'sandbox' } = process.env;
|
|
2
|
-
|
|
3
|
-
// https://developer.apple.com/documentation/storekit/in-app_purchase/validating_receipts_with_the_app_store
|
|
4
|
-
const environments = {
|
|
5
|
-
sandbox: 'https://sandbox.itunes.apple.com/verifyReceipt',
|
|
6
|
-
production: 'https://buy.itunes.apple.com/verifyReceipt',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const verifyReceipt = async ({ receiptData, password }): Promise<any> => {
|
|
10
|
-
const payload: any = {
|
|
11
|
-
'receipt-data': receiptData,
|
|
12
|
-
};
|
|
13
|
-
if (password) {
|
|
14
|
-
payload.password = password;
|
|
15
|
-
}
|
|
16
|
-
const result = await fetch(environments[APPLE_IAP_ENVIRONMENT], {
|
|
17
|
-
body: JSON.stringify(payload),
|
|
18
|
-
method: 'POST',
|
|
19
|
-
// eslint-disable-next-line
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
duplex: 'half',
|
|
22
|
-
headers: {
|
|
23
|
-
'Content-Type': 'application/json',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return result.json();
|
|
27
|
-
};
|
package/src/payment/braintree.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import {
|
|
3
|
-
IPaymentAdapter,
|
|
4
|
-
PaymentAdapter,
|
|
5
|
-
PaymentDirector,
|
|
6
|
-
PaymentError,
|
|
7
|
-
OrderPricingSheet,
|
|
8
|
-
} from '@unchainedshop/core';
|
|
9
|
-
const logger = createLogger('unchained:braintree');
|
|
10
|
-
|
|
11
|
-
const { BRAINTREE_SANDBOX_TOKEN, BRAINTREE_PRIVATE_KEY } = process.env;
|
|
12
|
-
|
|
13
|
-
let braintree: any;
|
|
14
|
-
try {
|
|
15
|
-
// eslint-disable-next-line
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
const braintreePackage = await import('braintree');
|
|
18
|
-
braintree = braintreePackage.default;
|
|
19
|
-
} catch {
|
|
20
|
-
/* */
|
|
21
|
-
logger.warn("npm dependency 'braintree' is not installed, paypal adapter will not work");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const BraintreeDirect: IPaymentAdapter = {
|
|
25
|
-
...PaymentAdapter,
|
|
26
|
-
|
|
27
|
-
key: 'shop.unchained.braintree-direct',
|
|
28
|
-
label: 'Braintree Direct',
|
|
29
|
-
version: '1.0.0',
|
|
30
|
-
|
|
31
|
-
initialConfiguration: [
|
|
32
|
-
{
|
|
33
|
-
key: 'publicKey',
|
|
34
|
-
value: null,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'merchantId',
|
|
38
|
-
value: null,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
typeSupported: (type) => {
|
|
43
|
-
return type === 'GENERIC';
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
actions: (config, context) => {
|
|
47
|
-
const getPublicKey = () => {
|
|
48
|
-
return config.reduce((current, item) => {
|
|
49
|
-
if (item.key === 'publicKey') return item.value;
|
|
50
|
-
return current;
|
|
51
|
-
}, null);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const getMerchantId = () => {
|
|
55
|
-
return config.reduce((current, item) => {
|
|
56
|
-
if (item.key === 'merchantId') return item.value;
|
|
57
|
-
return current;
|
|
58
|
-
}, null);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const getAccessToken = () => {
|
|
62
|
-
return BRAINTREE_SANDBOX_TOKEN;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const getPrivateKey = () => {
|
|
66
|
-
return BRAINTREE_PRIVATE_KEY;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const getGateway = (braintree) => {
|
|
70
|
-
const accessToken = getAccessToken();
|
|
71
|
-
if (accessToken) {
|
|
72
|
-
// sandbox mode!
|
|
73
|
-
return braintree.connect({
|
|
74
|
-
accessToken,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return braintree.connect({
|
|
78
|
-
environment: braintree.Environment.Production,
|
|
79
|
-
merchantId: getMerchantId(),
|
|
80
|
-
publicKey: getPublicKey(),
|
|
81
|
-
privateKey: getPrivateKey(),
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const adapter = {
|
|
86
|
-
...PaymentAdapter.actions(config, context),
|
|
87
|
-
|
|
88
|
-
configurationError: () => {
|
|
89
|
-
const publicCredentialsValid =
|
|
90
|
-
getAccessToken() || (getMerchantId() && getPublicKey() && getPrivateKey());
|
|
91
|
-
|
|
92
|
-
if (!publicCredentialsValid) {
|
|
93
|
-
return PaymentError.WRONG_CREDENTIALS;
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
isActive: () => {
|
|
99
|
-
if (adapter.configurationError() === null) return true;
|
|
100
|
-
return false;
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
isPayLaterAllowed: () => {
|
|
104
|
-
return false;
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
sign: async () => {
|
|
108
|
-
const gateway = getGateway(braintree);
|
|
109
|
-
const result = await gateway.clientToken.generate({});
|
|
110
|
-
if (result.success) {
|
|
111
|
-
return result.clientToken;
|
|
112
|
-
}
|
|
113
|
-
throw new Error('Could not retrieve the client token');
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
charge: async ({ paypalPaymentMethodNonce }) => {
|
|
117
|
-
const { order } = context;
|
|
118
|
-
|
|
119
|
-
if (!order) throw new Error('Order is missing in payment context');
|
|
120
|
-
|
|
121
|
-
if (!paypalPaymentMethodNonce)
|
|
122
|
-
throw new Error('You have to provide paypalPaymentMethodNonce in paymentContext');
|
|
123
|
-
|
|
124
|
-
const gateway = getGateway(braintree);
|
|
125
|
-
const address = order.billingAddress;
|
|
126
|
-
const pricing = OrderPricingSheet({
|
|
127
|
-
calculation: order.calculation,
|
|
128
|
-
currencyCode: order.currencyCode,
|
|
129
|
-
});
|
|
130
|
-
const rounded = Math.round(pricing.total({ useNetPrice: false }).amount / 10 || 0) * 10;
|
|
131
|
-
const saleRequest = {
|
|
132
|
-
amount: rounded / 100,
|
|
133
|
-
merchantAccountId: order.currencyCode,
|
|
134
|
-
paymentMethodNonce: paypalPaymentMethodNonce,
|
|
135
|
-
orderId: order.orderNumber || order._id,
|
|
136
|
-
shipping: address
|
|
137
|
-
? {
|
|
138
|
-
firstName: address.firstName,
|
|
139
|
-
lastName: address.lastName,
|
|
140
|
-
company: address.company,
|
|
141
|
-
streetAddress: address.addressLine,
|
|
142
|
-
extendedAddress: address.addressLine2,
|
|
143
|
-
locality: address.city,
|
|
144
|
-
region: address.regionCode,
|
|
145
|
-
postalCode: address.postalCode,
|
|
146
|
-
countryCodeAlpha2: address.countryCode,
|
|
147
|
-
}
|
|
148
|
-
: undefined,
|
|
149
|
-
options: {
|
|
150
|
-
submitForSettlement: true,
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
const result = await gateway.transaction.sale(saleRequest);
|
|
154
|
-
if (result.success) {
|
|
155
|
-
logger.info(`Braintree Plugin: ${result.message}`, saleRequest);
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
logger.warn(`Braintree Plugin: ${result.message}`, saleRequest);
|
|
159
|
-
throw new Error(result.message);
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
return adapter;
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
PaymentDirector.registerAdapter(BraintreeDirect);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { mongodb } from '@unchainedshop/mongodb';
|
|
2
|
-
import { TimestampFields } from '@unchainedshop/mongodb';
|
|
3
|
-
|
|
4
|
-
export type CryptopayTransaction = {
|
|
5
|
-
_id: string;
|
|
6
|
-
blockHeight: number;
|
|
7
|
-
mostRecentBlockHeight: number;
|
|
8
|
-
amount: mongodb.Decimal128;
|
|
9
|
-
currencyCode: string;
|
|
10
|
-
decimals: number;
|
|
11
|
-
orderPaymentId?: string;
|
|
12
|
-
} & TimestampFields;
|
|
13
|
-
|
|
14
|
-
export const CryptopayTransactionsCollection = (db: mongodb.Db) => {
|
|
15
|
-
return db.collection<CryptopayTransaction>('cryptopay_transactions');
|
|
16
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import denoteAmount from './denote-amount.js';
|
|
4
|
-
|
|
5
|
-
describe('Denote Amount', () => {
|
|
6
|
-
it('Handle amount with 18 decimals', () => {
|
|
7
|
-
// For example, Ethereum uses 18 decimals, this converts WEI to GWei
|
|
8
|
-
assert.equal(denoteAmount('1000000000000000000', 18), 1000000000n);
|
|
9
|
-
assert.equal(denoteAmount('100000000000000', 18), 100000n);
|
|
10
|
-
assert.equal(denoteAmount('100', 18), 0n);
|
|
11
|
-
});
|
|
12
|
-
it('Handle amount with 10 decimals', () => {
|
|
13
|
-
assert.equal(denoteAmount('100000000', 10), 10000000n);
|
|
14
|
-
assert.equal(denoteAmount('100000000000000', 10), 10000000000000n);
|
|
15
|
-
assert.equal(denoteAmount('100', 10), 10n);
|
|
16
|
-
});
|
|
17
|
-
it('Handle amount with 8 decimals', () => {
|
|
18
|
-
// For example, Bitcoin uses 8 decimals, this keeps Satoshi as is
|
|
19
|
-
assert.equal(denoteAmount('100000000', 8), 100000000n);
|
|
20
|
-
assert.equal(denoteAmount('100000000000000', 8), 100000000000000n);
|
|
21
|
-
assert.equal(denoteAmount('1', 8), 1n);
|
|
22
|
-
});
|
|
23
|
-
it('Handle amount with 2 decimals', () => {
|
|
24
|
-
assert.equal(denoteAmount('100000000', 2), 100000000n);
|
|
25
|
-
assert.equal(denoteAmount('100000000000000', 2), 100000000000000n);
|
|
26
|
-
assert.equal(denoteAmount('1', 2), 1n);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a cryptocurrency amount from its smallest unit (e.g., wei, satoshi) to a normalized value
|
|
3
|
-
* with 9 decimal places of precision.
|
|
4
|
-
*
|
|
5
|
-
* This function handles the denomination of cryptocurrency amounts by converting from the
|
|
6
|
-
* blockchain's native smallest units (like wei for Ethereum which is 10^-18 ETH, or satoshi for Bitcoin
|
|
7
|
-
* which is 10^-8 BTC) to a standardized format with 9 decimal places for consistent handling across
|
|
8
|
-
* different cryptocurrencies.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} amountAsString - The amount in the cryptocurrency's smallest unit (e.g., wei, satoshi)
|
|
11
|
-
* represented as a string to handle large numbers
|
|
12
|
-
* @param {number} decimals - The number of decimal places used by the cryptocurrency
|
|
13
|
-
* (e.g., 18 for Ethereum, 8 for Bitcoin)
|
|
14
|
-
* @returns {number} The converted amount with 9 decimal places of precision
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // Convert 1 ETH in wei (1000000000000000000) to normalized format
|
|
18
|
-
* denoteAmount("1000000000000000000", 18)
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // Convert 1 BTC in satoshi (100000000) to normalized format
|
|
22
|
-
* denoteAmount("100000000", 8)
|
|
23
|
-
*/
|
|
24
|
-
export default function denoteAmount(amountAsString: string, decimals: number) {
|
|
25
|
-
if (decimals <= 9) return BigInt(amountAsString); // No conversion needed if decimals are 9 or less
|
|
26
|
-
const exponent = BigInt(decimals) - 9n;
|
|
27
|
-
const amount = BigInt(amountAsString);
|
|
28
|
-
return amount / 10n ** exponent; // Denote to 9 decimals
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import deriveBtcAddress from './derive-btc-address.js';
|
|
4
|
-
|
|
5
|
-
describe('BTC Address Derivation', () => {
|
|
6
|
-
it('returns a deterministic BIP44 child address', () => {
|
|
7
|
-
assert.equal(
|
|
8
|
-
deriveBtcAddress(
|
|
9
|
-
'zpub6qpRm6gMdkrXvVKw7qgayHnqJGJkpE4rnYQdyJfZW87ed4Fk6HjVaThN12hv2rrL3EzfvvBW6ZpbMEe5UxZYEjhgeMigyvAbS5LiXPkKrys',
|
|
10
|
-
1,
|
|
11
|
-
),
|
|
12
|
-
'bc1qspcam3ntdpvhgz4vnxfdhas6qr8hf8tjfaz5p4',
|
|
13
|
-
);
|
|
14
|
-
assert.equal(
|
|
15
|
-
deriveBtcAddress(
|
|
16
|
-
'zpub6qpRm6gMdkrXvVKw7qgayHnqJGJkpE4rnYQdyJfZW87ed4Fk6HjVaThN12hv2rrL3EzfvvBW6ZpbMEe5UxZYEjhgeMigyvAbS5LiXPkKrys',
|
|
17
|
-
2,
|
|
18
|
-
),
|
|
19
|
-
'bc1qd0a7znq3pz3sc4armthddkyam57ey7qjc4v6vn',
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { HDKey } from '@scure/bip32';
|
|
2
|
-
import { NETWORK, p2wpkh, TEST_NETWORK } from '@scure/btc-signer';
|
|
3
|
-
|
|
4
|
-
// const resolvePath = (prefix) => {
|
|
5
|
-
// if (prefix === 'x') return `m/44'/0'`;
|
|
6
|
-
// if (prefix === 'y') return `m/49'/0'`;
|
|
7
|
-
// if (prefix === 'z') return `m/84'/0'`;
|
|
8
|
-
// if (prefix === 't') return `m/44'/1'`;
|
|
9
|
-
// if (prefix === 'u') return `m/49'/1'`;
|
|
10
|
-
// if (prefix === 'v') return `m/84'/1'`;
|
|
11
|
-
// return `m`;
|
|
12
|
-
// };
|
|
13
|
-
|
|
14
|
-
const resolveNetwork = (prefix) => {
|
|
15
|
-
if (['x', 'y', 'z'].includes(prefix)) return NETWORK;
|
|
16
|
-
return TEST_NETWORK;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default (xpub, index) => {
|
|
20
|
-
const prefix = xpub.slice(0, 1);
|
|
21
|
-
if (prefix !== 'z' && prefix !== 'v')
|
|
22
|
-
throw new Error('Cryptopay only supports native segwit (zpub/vpub) extended key format for BTC');
|
|
23
|
-
|
|
24
|
-
const hardenedMaster = HDKey.fromExtendedKey(
|
|
25
|
-
xpub,
|
|
26
|
-
prefix === 'z'
|
|
27
|
-
? {
|
|
28
|
-
public: 0x04b24746, // zpub public
|
|
29
|
-
private: 0x04b2430c, // zpriv private
|
|
30
|
-
}
|
|
31
|
-
: {
|
|
32
|
-
public: 0x045f1cf6,
|
|
33
|
-
private: 0x045f18bc,
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
hardenedMaster.wipePrivateData(); // Neuter
|
|
37
|
-
|
|
38
|
-
const child = hardenedMaster.deriveChild(0).deriveChild(index);
|
|
39
|
-
|
|
40
|
-
if (!child.publicKey) throw new Error('Cannot derive public key from extended public key');
|
|
41
|
-
|
|
42
|
-
const network = resolveNetwork(prefix);
|
|
43
|
-
const pubKey = p2wpkh(child.publicKey /* hex.decode( as string)*/, network);
|
|
44
|
-
|
|
45
|
-
return pubKey.address;
|
|
46
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import deriveEthAddress from './derive-eth-address.js';
|
|
4
|
-
|
|
5
|
-
describe('ETH Address Derivation', () => {
|
|
6
|
-
it('returns a deterministic BIP44 child address', () => {
|
|
7
|
-
assert.equal(
|
|
8
|
-
deriveEthAddress(
|
|
9
|
-
'xpub6DTksA6DsGUgbEp1U29v3qGTt5P99iKThaqGEzerTfD73ZAg1F8j15TxWTPEjjA1uw1Zmwwc5dgVCXwTL2ZNhvdoLWNdqVuL1MDJMsQCLLs',
|
|
10
|
-
1,
|
|
11
|
-
),
|
|
12
|
-
'0x11CF7d607A1Dc45a002592891fF25DAAE6eC7dE9',
|
|
13
|
-
);
|
|
14
|
-
assert.equal(
|
|
15
|
-
deriveEthAddress(
|
|
16
|
-
'xpub6DTksA6DsGUgbEp1U29v3qGTt5P99iKThaqGEzerTfD73ZAg1F8j15TxWTPEjjA1uw1Zmwwc5dgVCXwTL2ZNhvdoLWNdqVuL1MDJMsQCLLs',
|
|
17
|
-
2,
|
|
18
|
-
),
|
|
19
|
-
'0x61663D505e3aB5b61a5344eA2c64b644c08013ea',
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { HDKey } from '@scure/bip32';
|
|
2
|
-
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
3
|
-
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
4
|
-
|
|
5
|
-
function getChecksumAddress(address) {
|
|
6
|
-
const chars = address.split('');
|
|
7
|
-
const expanded = new Uint8Array(40);
|
|
8
|
-
for (let i = 0; i < 40; i++) {
|
|
9
|
-
expanded[i] = chars[i].charCodeAt(0);
|
|
10
|
-
}
|
|
11
|
-
const hashed = keccak_256(expanded);
|
|
12
|
-
|
|
13
|
-
for (let i = 0; i < 40; i += 2) {
|
|
14
|
-
if (hashed[i >> 1] >> 4 >= 8) {
|
|
15
|
-
chars[i] = chars[i].toUpperCase();
|
|
16
|
-
}
|
|
17
|
-
if ((hashed[i >> 1] & 0x0f) >= 8) {
|
|
18
|
-
chars[i + 1] = chars[i + 1].toUpperCase();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return '0x' + chars.join('');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default (xpub, index) => {
|
|
26
|
-
const hardenedMaster = HDKey.fromExtendedKey(xpub);
|
|
27
|
-
hardenedMaster.wipePrivateData(); // Neuter
|
|
28
|
-
|
|
29
|
-
const child = hardenedMaster.deriveChild(0).deriveChild(index);
|
|
30
|
-
|
|
31
|
-
if (!child.publicKey) throw new Error('Could not derive child key from extended public key');
|
|
32
|
-
|
|
33
|
-
// ETH Address (secp256k1 + keccak_256 + checksum)
|
|
34
|
-
const childSigningKey = secp256k1.Point.fromBytes(child.publicKey).toBytes(false);
|
|
35
|
-
const address = Buffer.from(keccak_256(childSigningKey.slice(1)))
|
|
36
|
-
.toString('hex')
|
|
37
|
-
.substring(24);
|
|
38
|
-
|
|
39
|
-
return getChecksumAddress(address);
|
|
40
|
-
};
|