@unchainedshop/plugins 4.3.4 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -0
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/post.js +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/send-message.js +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/delivery/stores.js +0 -1
- package/lib/enrollments/licensed.d.ts +0 -1
- package/lib/enrollments/licensed.js +0 -1
- package/lib/events/aws-eventbridge.d.ts +0 -1
- package/lib/events/aws-eventbridge.js +0 -3
- package/lib/events/node-event-emitter.d.ts +0 -1
- package/lib/events/node-event-emitter.js +0 -1
- package/lib/events/redis.d.ts +0 -1
- package/lib/events/redis.js +0 -1
- package/lib/files/gridfs/adapter.d.ts +3 -4
- package/lib/files/gridfs/adapter.js +6 -6
- package/lib/files/gridfs/handler-express.d.ts +2 -3
- package/lib/files/gridfs/handler-express.js +6 -9
- package/lib/files/gridfs/handler-fastify.d.ts +1 -2
- package/lib/files/gridfs/handler-fastify.js +6 -9
- package/lib/files/gridfs/index.d.ts +2 -3
- package/lib/files/gridfs/index.js +2 -3
- package/lib/files/gridfs/module.d.ts +0 -1
- package/lib/files/gridfs/module.js +7 -2
- package/lib/files/gridfs/sign.d.ts +0 -1
- package/lib/files/gridfs/sign.js +0 -1
- package/lib/files/minio/handler-express.d.ts +0 -1
- package/lib/files/minio/handler-express.js +0 -1
- package/lib/files/minio/handler-fastify.d.ts +1 -2
- package/lib/files/minio/handler-fastify.js +2 -1
- package/lib/files/minio/index.d.ts +1 -2
- package/lib/files/minio/index.js +1 -5
- package/lib/filters/local-search.d.ts +1 -2
- package/lib/filters/local-search.js +3 -6
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/filters/strict-equal.js +0 -1
- package/lib/payment/apple-iap/adapter.d.ts +0 -1
- package/lib/payment/apple-iap/adapter.js +3 -5
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -2
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +2 -1
- package/lib/payment/apple-iap/fix-periods.d.ts +1 -2
- package/lib/payment/apple-iap/fix-periods.js +1 -1
- package/lib/payment/apple-iap/handler-express.d.ts +0 -1
- package/lib/payment/apple-iap/handler-express.js +2 -5
- package/lib/payment/apple-iap/handler-fastify.d.ts +1 -2
- package/lib/payment/apple-iap/handler-fastify.js +4 -5
- package/lib/payment/apple-iap/index.d.ts +2 -3
- package/lib/payment/apple-iap/index.js +2 -3
- package/lib/payment/apple-iap/module.d.ts +1 -2
- package/lib/payment/apple-iap/module.js +1 -2
- package/lib/payment/apple-iap/verify-receipt.d.ts +0 -1
- package/lib/payment/apple-iap/verify-receipt.js +0 -4
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -5
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -2
- package/lib/payment/cryptopay/db/CryptopayTransactions.js +2 -1
- package/lib/payment/cryptopay/denote-amount.d.ts +0 -24
- package/lib/payment/cryptopay/denote-amount.js +2 -26
- package/lib/payment/cryptopay/derive-btc-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js +4 -14
- package/lib/payment/cryptopay/derive-eth-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js +1 -3
- package/lib/payment/cryptopay/handle-webhook.d.ts +2 -3
- package/lib/payment/cryptopay/handle-webhook.js +3 -3
- package/lib/payment/cryptopay/handler-express.d.ts +0 -1
- package/lib/payment/cryptopay/handler-express.js +1 -2
- package/lib/payment/cryptopay/handler-fastify.d.ts +1 -2
- package/lib/payment/cryptopay/handler-fastify.js +2 -2
- package/lib/payment/cryptopay/index.d.ts +2 -3
- package/lib/payment/cryptopay/index.js +2 -3
- package/lib/payment/cryptopay/module.d.ts +1 -2
- package/lib/payment/cryptopay/module.js +2 -3
- package/lib/payment/cryptopay/plugin.d.ts +1 -2
- package/lib/payment/cryptopay/plugin.js +8 -37
- package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorize.js +0 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/cancel.js +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +8 -9
- package/lib/payment/datatrans-v2/api/index.js +9 -10
- package/lib/payment/datatrans-v2/api/init.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/init.js +2 -4
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -3
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/secureFields.js +1 -3
- package/lib/payment/datatrans-v2/api/settle.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/settle.js +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/status.js +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/types.js +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/validate.js +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js +0 -2
- package/lib/payment/datatrans-v2/getPaths.d.ts +0 -1
- package/lib/payment/datatrans-v2/getPaths.js +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +1 -2
- package/lib/payment/datatrans-v2/index.d.ts +0 -1
- package/lib/payment/datatrans-v2/index.js +3 -14
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -5
- package/lib/payment/datatrans-v2/parseRegistrationData.js +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js +0 -2
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice-prepaid.js +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/invoice.js +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -11
- package/lib/payment/payrexx/api/index.d.ts +15 -15
- package/lib/payment/payrexx/api/index.js +15 -27
- package/lib/payment/payrexx/api/makeFetcher.d.ts +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js +0 -1
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -4
- package/lib/payment/payrexx/handler-fastify.d.ts +1 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -4
- package/lib/payment/payrexx/index.d.ts +0 -1
- package/lib/payment/payrexx/index.js +9 -35
- package/lib/payment/payrexx/payrexx.d.ts +0 -1
- package/lib/payment/payrexx/payrexx.js +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts +0 -1
- package/lib/payment/postfinance-checkout/api-client.js +0 -6
- package/lib/payment/postfinance-checkout/api-types.d.ts +49 -44
- package/lib/payment/postfinance-checkout/api-types.js +43 -51
- package/lib/payment/postfinance-checkout/api.d.ts +1 -2
- package/lib/payment/postfinance-checkout/api.js +2 -3
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +1 -2
- package/lib/payment/postfinance-checkout/index.d.ts +2 -3
- package/lib/payment/postfinance-checkout/index.js +7 -10
- package/lib/payment/postfinance-checkout/types.d.ts +11 -10
- package/lib/payment/postfinance-checkout/types.js +9 -12
- package/lib/payment/postfinance-checkout/utils.d.ts +2 -3
- package/lib/payment/postfinance-checkout/utils.js +1 -2
- package/lib/payment/saferpay/adapter.d.ts +1 -2
- package/lib/payment/saferpay/adapter.js +2 -5
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts +6 -7
- package/lib/payment/saferpay/api/api/SaferpayClient.js +2 -2
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js +0 -1
- package/lib/payment/saferpay/api/index.d.ts +4 -5
- package/lib/payment/saferpay/api/index.js +1 -2
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Request.js +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Response.js +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts +2 -3
- package/lib/payment/saferpay/api/models/TransactionCancel.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts +3 -4
- package/lib/payment/saferpay/api/models/TransactionCapture.js +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts +0 -1
- package/lib/payment/saferpay/buildSignature.js +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -2
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js +1 -1
- package/lib/payment/saferpay/getReturnPath.d.ts +0 -1
- package/lib/payment/saferpay/getReturnPath.js +0 -1
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +1 -2
- package/lib/payment/saferpay/handler-fastify.d.ts +1 -2
- package/lib/payment/saferpay/handler-fastify.js +1 -2
- package/lib/payment/saferpay/index.d.ts +2 -3
- package/lib/payment/saferpay/index.js +2 -3
- package/lib/payment/saferpay/module.d.ts +2 -3
- package/lib/payment/saferpay/module.js +2 -2
- package/lib/payment/stripe/handler-express.d.ts +0 -1
- package/lib/payment/stripe/handler-express.js +1 -2
- package/lib/payment/stripe/handler-fastify.d.ts +1 -2
- package/lib/payment/stripe/handler-fastify.js +1 -2
- package/lib/payment/stripe/index.d.ts +0 -1
- package/lib/payment/stripe/index.js +1 -4
- package/lib/payment/stripe/stripe.d.ts +1 -2
- package/lib/payment/stripe/stripe.js +1 -2
- package/lib/presets/all-express.d.ts +1 -2
- package/lib/presets/all-express.js +9 -10
- package/lib/presets/all-fastify.d.ts +2 -3
- package/lib/presets/all-fastify.js +9 -10
- package/lib/presets/all.d.ts +23 -24
- package/lib/presets/all.js +20 -25
- package/lib/presets/base-express.d.ts +0 -1
- package/lib/presets/base-express.js +1 -2
- package/lib/presets/base-fastify.d.ts +1 -2
- package/lib/presets/base-fastify.js +1 -3
- package/lib/presets/base.d.ts +23 -24
- package/lib/presets/base.js +23 -33
- package/lib/presets/countries/ch.d.ts +2 -3
- package/lib/presets/countries/ch.js +2 -3
- package/lib/presets/crypto-express.d.ts +1 -2
- package/lib/presets/crypto-express.js +2 -3
- package/lib/presets/crypto-fastify.d.ts +1 -2
- package/lib/presets/crypto-fastify.js +2 -3
- package/lib/presets/crypto.d.ts +6 -7
- package/lib/presets/crypto.js +6 -8
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -2
- package/lib/pricing/delivery-swiss-tax.js +2 -3
- package/lib/pricing/discount-100-off.d.ts +1 -2
- package/lib/pricing/discount-100-off.js +0 -4
- package/lib/pricing/discount-half-price-manual.d.ts +1 -2
- package/lib/pricing/discount-half-price-manual.js +0 -4
- package/lib/pricing/discount-half-price.d.ts +1 -2
- package/lib/pricing/discount-half-price.js +0 -4
- package/lib/pricing/free-delivery.d.ts +1 -2
- package/lib/pricing/free-delivery.js +0 -1
- package/lib/pricing/free-payment.d.ts +1 -2
- package/lib/pricing/free-payment.js +0 -1
- package/lib/pricing/order-delivery.d.ts +1 -2
- package/lib/pricing/order-delivery.js +0 -2
- package/lib/pricing/order-discount.d.ts +1 -2
- package/lib/pricing/order-discount.js +0 -4
- package/lib/pricing/order-items-discount.d.ts +0 -1
- package/lib/pricing/order-items-discount.js +0 -5
- package/lib/pricing/order-items.d.ts +0 -1
- package/lib/pricing/order-items.js +0 -2
- package/lib/pricing/order-payment.d.ts +0 -1
- package/lib/pricing/order-payment.js +0 -2
- package/lib/pricing/order-round.d.ts +1 -2
- package/lib/pricing/order-round.js +0 -6
- package/lib/pricing/product-catalog-price-options.d.ts +0 -1
- package/lib/pricing/product-catalog-price-options.js +0 -1
- package/lib/pricing/product-catalog-price.d.ts +1 -2
- package/lib/pricing/product-catalog-price.js +2 -3
- package/lib/pricing/product-discount.d.ts +0 -1
- package/lib/pricing/product-discount.js +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts +1 -2
- package/lib/pricing/product-price-rateconversion.js +0 -4
- package/lib/pricing/product-round.d.ts +1 -2
- package/lib/pricing/product-round.js +0 -1
- package/lib/pricing/product-swiss-tax.d.ts +1 -2
- package/lib/pricing/product-swiss-tax.js +2 -5
- package/lib/pricing/tax/ch.d.ts +2 -3
- package/lib/pricing/tax/ch.js +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts +1 -2
- package/lib/pricing/utils/isDeliveryAddressInCountry.js +0 -1
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/quotations/manual.js +0 -1
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/eth-minter.js +2 -11
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/warehousing/store.js +0 -1
- package/lib/worker/budgetsms.d.ts +0 -1
- package/lib/worker/budgetsms.js +4 -52
- package/lib/worker/bulk-import.d.ts +1 -2
- package/lib/worker/bulk-import.js +1 -3
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/bulkgate.js +7 -20
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/email.js +0 -3
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.js +1 -2
- package/lib/worker/error-notifications.d.ts +1 -2
- package/lib/worker/error-notifications.js +0 -1
- package/lib/worker/export-token.d.ts +1 -2
- package/lib/worker/export-token.js +1 -2
- package/lib/worker/external.d.ts +1 -2
- package/lib/worker/external.js +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/heartbeat.js +0 -1
- package/lib/worker/http-request.d.ts +1 -2
- package/lib/worker/http-request.js +0 -3
- package/lib/worker/message.d.ts +2 -3
- package/lib/worker/message.js +2 -3
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/push-notification.js +0 -1
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/twilio.js +1 -2
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.js +1 -3
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.js +0 -3
- package/lib/worker/update-token-ownership.d.ts +1 -2
- package/lib/worker/update-token-ownership.js +0 -1
- package/lib/worker/zombie-killer.d.ts +1 -2
- package/lib/worker/zombie-killer.js +0 -7
- package/package.json +20 -19
- package/lib/delivery/post.d.ts.map +0 -1
- package/lib/delivery/post.js.map +0 -1
- package/lib/delivery/send-message.d.ts.map +0 -1
- package/lib/delivery/send-message.js.map +0 -1
- package/lib/delivery/stores.d.ts.map +0 -1
- package/lib/delivery/stores.js.map +0 -1
- package/lib/enrollments/licensed.d.ts.map +0 -1
- package/lib/enrollments/licensed.js.map +0 -1
- package/lib/events/aws-eventbridge.d.ts.map +0 -1
- package/lib/events/aws-eventbridge.js.map +0 -1
- package/lib/events/node-event-emitter.d.ts.map +0 -1
- package/lib/events/node-event-emitter.js.map +0 -1
- package/lib/events/redis.d.ts.map +0 -1
- package/lib/events/redis.js.map +0 -1
- package/lib/files/gridfs/adapter.d.ts.map +0 -1
- package/lib/files/gridfs/adapter.js.map +0 -1
- package/lib/files/gridfs/handler-express.d.ts.map +0 -1
- package/lib/files/gridfs/handler-express.js.map +0 -1
- package/lib/files/gridfs/handler-fastify.d.ts.map +0 -1
- package/lib/files/gridfs/handler-fastify.js.map +0 -1
- package/lib/files/gridfs/index.d.ts.map +0 -1
- package/lib/files/gridfs/index.js.map +0 -1
- package/lib/files/gridfs/module.d.ts.map +0 -1
- package/lib/files/gridfs/module.js.map +0 -1
- package/lib/files/gridfs/sign.d.ts.map +0 -1
- package/lib/files/gridfs/sign.js.map +0 -1
- package/lib/files/minio/handler-express.d.ts.map +0 -1
- package/lib/files/minio/handler-express.js.map +0 -1
- package/lib/files/minio/handler-fastify.d.ts.map +0 -1
- package/lib/files/minio/handler-fastify.js.map +0 -1
- package/lib/files/minio/index.d.ts.map +0 -1
- package/lib/files/minio/index.js.map +0 -1
- package/lib/filters/local-search.d.ts.map +0 -1
- package/lib/filters/local-search.js.map +0 -1
- package/lib/filters/strict-equal.d.ts.map +0 -1
- package/lib/filters/strict-equal.js.map +0 -1
- package/lib/payment/apple-iap/adapter.d.ts.map +0 -1
- package/lib/payment/apple-iap/adapter.js.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +0 -1
- package/lib/payment/apple-iap/fix-periods.d.ts.map +0 -1
- package/lib/payment/apple-iap/fix-periods.js.map +0 -1
- package/lib/payment/apple-iap/handler-express.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-express.js.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.js.map +0 -1
- package/lib/payment/apple-iap/index.d.ts.map +0 -1
- package/lib/payment/apple-iap/index.js.map +0 -1
- package/lib/payment/apple-iap/module.d.ts.map +0 -1
- package/lib/payment/apple-iap/module.js.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.d.ts.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.js.map +0 -1
- package/lib/payment/braintree.d.ts.map +0 -1
- package/lib/payment/braintree.js.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.js.map +0 -1
- package/lib/payment/cryptopay/denote-amount.d.ts.map +0 -1
- package/lib/payment/cryptopay/denote-amount.js.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.d.ts.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.js.map +0 -1
- package/lib/payment/cryptopay/handler-express.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-express.js.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.js.map +0 -1
- package/lib/payment/cryptopay/index.d.ts.map +0 -1
- package/lib/payment/cryptopay/index.js.map +0 -1
- package/lib/payment/cryptopay/module.d.ts.map +0 -1
- package/lib/payment/cryptopay/module.js.map +0 -1
- package/lib/payment/cryptopay/plugin.d.ts.map +0 -1
- package/lib/payment/cryptopay/plugin.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.js.map +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/index.js.map +0 -1
- package/lib/payment/datatrans-v2/api/init.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/init.js.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.js.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.js.map +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/status.js.map +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/types.js.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.js.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.js.map +0 -1
- package/lib/payment/datatrans-v2/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/index.js.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js.map +0 -1
- package/lib/payment/invoice-prepaid.d.ts.map +0 -1
- package/lib/payment/invoice-prepaid.js.map +0 -1
- package/lib/payment/invoice.d.ts.map +0 -1
- package/lib/payment/invoice.js.map +0 -1
- package/lib/payment/paypal-checkout.d.ts.map +0 -1
- package/lib/payment/paypal-checkout.js.map +0 -1
- package/lib/payment/payrexx/api/index.d.ts.map +0 -1
- package/lib/payment/payrexx/api/index.js.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js.map +0 -1
- package/lib/payment/payrexx/handler-express.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-express.js.map +0 -1
- package/lib/payment/payrexx/handler-fastify.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-fastify.js.map +0 -1
- package/lib/payment/payrexx/index.d.ts.map +0 -1
- package/lib/payment/payrexx/index.js.map +0 -1
- package/lib/payment/payrexx/payrexx.d.ts.map +0 -1
- package/lib/payment/payrexx/payrexx.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.js.map +0 -1
- package/lib/payment/postfinance-checkout/api.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.js.map +0 -1
- package/lib/payment/postfinance-checkout/index.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/index.js.map +0 -1
- package/lib/payment/postfinance-checkout/types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/types.js.map +0 -1
- package/lib/payment/postfinance-checkout/utils.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/utils.js.map +0 -1
- package/lib/payment/saferpay/adapter.d.ts.map +0 -1
- package/lib/payment/saferpay/adapter.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js.map +0 -1
- package/lib/payment/saferpay/api/index.d.ts.map +0 -1
- package/lib/payment/saferpay/api/index.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js.map +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Request.js.map +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Response.js.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.js.map +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts.map +0 -1
- package/lib/payment/saferpay/buildSignature.js.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js.map +0 -1
- package/lib/payment/saferpay/getReturnPath.d.ts.map +0 -1
- package/lib/payment/saferpay/getReturnPath.js.map +0 -1
- package/lib/payment/saferpay/handler-express.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-express.js.map +0 -1
- package/lib/payment/saferpay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-fastify.js.map +0 -1
- package/lib/payment/saferpay/index.d.ts.map +0 -1
- package/lib/payment/saferpay/index.js.map +0 -1
- package/lib/payment/saferpay/module.d.ts.map +0 -1
- package/lib/payment/saferpay/module.js.map +0 -1
- package/lib/payment/stripe/handler-express.d.ts.map +0 -1
- package/lib/payment/stripe/handler-express.js.map +0 -1
- package/lib/payment/stripe/handler-fastify.d.ts.map +0 -1
- package/lib/payment/stripe/handler-fastify.js.map +0 -1
- package/lib/payment/stripe/index.d.ts.map +0 -1
- package/lib/payment/stripe/index.js.map +0 -1
- package/lib/payment/stripe/stripe.d.ts.map +0 -1
- package/lib/payment/stripe/stripe.js.map +0 -1
- package/lib/presets/all-express.d.ts.map +0 -1
- package/lib/presets/all-express.js.map +0 -1
- package/lib/presets/all-fastify.d.ts.map +0 -1
- package/lib/presets/all-fastify.js.map +0 -1
- package/lib/presets/all.d.ts.map +0 -1
- package/lib/presets/all.js.map +0 -1
- package/lib/presets/base-express.d.ts.map +0 -1
- package/lib/presets/base-express.js.map +0 -1
- package/lib/presets/base-fastify.d.ts.map +0 -1
- package/lib/presets/base-fastify.js.map +0 -1
- package/lib/presets/base.d.ts.map +0 -1
- package/lib/presets/base.js.map +0 -1
- package/lib/presets/countries/ch.d.ts.map +0 -1
- package/lib/presets/countries/ch.js.map +0 -1
- package/lib/presets/crypto-express.d.ts.map +0 -1
- package/lib/presets/crypto-express.js.map +0 -1
- package/lib/presets/crypto-fastify.d.ts.map +0 -1
- package/lib/presets/crypto-fastify.js.map +0 -1
- package/lib/presets/crypto.d.ts.map +0 -1
- package/lib/presets/crypto.js.map +0 -1
- package/lib/pricing/delivery-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/delivery-swiss-tax.js.map +0 -1
- package/lib/pricing/discount-100-off.d.ts.map +0 -1
- package/lib/pricing/discount-100-off.js.map +0 -1
- package/lib/pricing/discount-half-price-manual.d.ts.map +0 -1
- package/lib/pricing/discount-half-price-manual.js.map +0 -1
- package/lib/pricing/discount-half-price.d.ts.map +0 -1
- package/lib/pricing/discount-half-price.js.map +0 -1
- package/lib/pricing/free-delivery.d.ts.map +0 -1
- package/lib/pricing/free-delivery.js.map +0 -1
- package/lib/pricing/free-payment.d.ts.map +0 -1
- package/lib/pricing/free-payment.js.map +0 -1
- package/lib/pricing/order-delivery.d.ts.map +0 -1
- package/lib/pricing/order-delivery.js.map +0 -1
- package/lib/pricing/order-discount.d.ts.map +0 -1
- package/lib/pricing/order-discount.js.map +0 -1
- package/lib/pricing/order-items-discount.d.ts.map +0 -1
- package/lib/pricing/order-items-discount.js.map +0 -1
- package/lib/pricing/order-items.d.ts.map +0 -1
- package/lib/pricing/order-items.js.map +0 -1
- package/lib/pricing/order-payment.d.ts.map +0 -1
- package/lib/pricing/order-payment.js.map +0 -1
- package/lib/pricing/order-round.d.ts.map +0 -1
- package/lib/pricing/order-round.js.map +0 -1
- package/lib/pricing/product-catalog-price-options.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price-options.js.map +0 -1
- package/lib/pricing/product-catalog-price.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price.js.map +0 -1
- package/lib/pricing/product-discount.d.ts.map +0 -1
- package/lib/pricing/product-discount.js.map +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts.map +0 -1
- package/lib/pricing/product-price-rateconversion.js.map +0 -1
- package/lib/pricing/product-round.d.ts.map +0 -1
- package/lib/pricing/product-round.js.map +0 -1
- package/lib/pricing/product-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/product-swiss-tax.js.map +0 -1
- package/lib/pricing/tax/ch.d.ts.map +0 -1
- package/lib/pricing/tax/ch.js.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.js.map +0 -1
- package/lib/quotations/manual.d.ts.map +0 -1
- package/lib/quotations/manual.js.map +0 -1
- package/lib/warehousing/eth-minter.d.ts.map +0 -1
- package/lib/warehousing/eth-minter.js.map +0 -1
- package/lib/warehousing/store.d.ts.map +0 -1
- package/lib/warehousing/store.js.map +0 -1
- package/lib/worker/budgetsms.d.ts.map +0 -1
- package/lib/worker/budgetsms.js.map +0 -1
- package/lib/worker/bulk-import.d.ts.map +0 -1
- package/lib/worker/bulk-import.js.map +0 -1
- package/lib/worker/bulkgate.d.ts.map +0 -1
- package/lib/worker/bulkgate.js.map +0 -1
- package/lib/worker/email.d.ts.map +0 -1
- package/lib/worker/email.js.map +0 -1
- package/lib/worker/enrollment-order-generator.d.ts.map +0 -1
- package/lib/worker/enrollment-order-generator.js.map +0 -1
- package/lib/worker/error-notifications.d.ts.map +0 -1
- package/lib/worker/error-notifications.js.map +0 -1
- package/lib/worker/export-token.d.ts.map +0 -1
- package/lib/worker/export-token.js.map +0 -1
- package/lib/worker/external.d.ts.map +0 -1
- package/lib/worker/external.js.map +0 -1
- package/lib/worker/heartbeat.d.ts.map +0 -1
- package/lib/worker/heartbeat.js.map +0 -1
- package/lib/worker/http-request.d.ts.map +0 -1
- package/lib/worker/http-request.js.map +0 -1
- package/lib/worker/message.d.ts.map +0 -1
- package/lib/worker/message.js.map +0 -1
- package/lib/worker/push-notification.d.ts.map +0 -1
- package/lib/worker/push-notification.js.map +0 -1
- package/lib/worker/twilio.d.ts.map +0 -1
- package/lib/worker/twilio.js.map +0 -1
- package/lib/worker/update-coinbase-rates.d.ts.map +0 -1
- package/lib/worker/update-coinbase-rates.js.map +0 -1
- package/lib/worker/update-ecb-rates.d.ts.map +0 -1
- package/lib/worker/update-ecb-rates.js.map +0 -1
- package/lib/worker/update-token-ownership.d.ts.map +0 -1
- package/lib/worker/update-token-ownership.js.map +0 -1
- package/lib/worker/zombie-killer.d.ts.map +0 -1
- package/lib/worker/zombie-killer.js.map +0 -1
- package/readme.md +0 -5
- package/src/delivery/post.ts +0 -30
- package/src/delivery/send-message.ts +0 -50
- package/src/delivery/stores.ts +0 -53
- package/src/enrollments/licensed.ts +0 -61
- package/src/events/aws-eventbridge.ts +0 -45
- package/src/events/node-event-emitter.ts +0 -18
- package/src/events/redis.ts +0 -34
- package/src/files/gridfs/adapter.ts +0 -176
- package/src/files/gridfs/handler-express.ts +0 -145
- package/src/files/gridfs/handler-fastify.ts +0 -177
- package/src/files/gridfs/index.ts +0 -6
- package/src/files/gridfs/module.ts +0 -44
- 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,91 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import { Context } from '@unchainedshop/api';
|
|
3
|
-
import generateSignature, { Security } from './generateSignature.js';
|
|
4
|
-
import { StatusResponseSuccess } from './api/types.js';
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
DATATRANS_SIGN_KEY,
|
|
8
|
-
DATATRANS_SIGN2_KEY,
|
|
9
|
-
DATATRANS_SECURITY = Security.DYNAMIC_SIGN,
|
|
10
|
-
} = process.env;
|
|
11
|
-
|
|
12
|
-
const logger = createLogger('unchained:datatrans:handler');
|
|
13
|
-
|
|
14
|
-
export const datatransHandler = async (req, res) => {
|
|
15
|
-
const resolvedContext = req.unchainedContext as Context;
|
|
16
|
-
const { modules, services } = resolvedContext;
|
|
17
|
-
const signature = req.headers['datatrans-signature'];
|
|
18
|
-
|
|
19
|
-
if (!DATATRANS_SIGN_KEY && !DATATRANS_SIGN2_KEY) {
|
|
20
|
-
logger.warn('No sign key configured');
|
|
21
|
-
res.status(404).end();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (req.method === 'POST' && signature) {
|
|
26
|
-
const [rawTimestamp, rawHash] = signature.split(',');
|
|
27
|
-
const [, hash] = rawHash.split('=');
|
|
28
|
-
const [, timestamp] = rawTimestamp.split('=');
|
|
29
|
-
|
|
30
|
-
const comparableSignature = await generateSignature({
|
|
31
|
-
security: DATATRANS_SECURITY as any,
|
|
32
|
-
signKey: DATATRANS_SIGN2_KEY! || DATATRANS_SIGN_KEY!,
|
|
33
|
-
})(timestamp, req.body);
|
|
34
|
-
|
|
35
|
-
if (hash !== comparableSignature) {
|
|
36
|
-
logger.error(`hash mismatch: ${signature} / ${comparableSignature}`, req.body);
|
|
37
|
-
res.status(403).send('Hash mismatch');
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const transaction: StatusResponseSuccess = JSON.parse(req.body) as StatusResponseSuccess;
|
|
42
|
-
|
|
43
|
-
logger.info(`received request`, {
|
|
44
|
-
type: transaction.type,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
if (transaction.status === 'authorized') {
|
|
48
|
-
const userId = transaction.refno2;
|
|
49
|
-
const referenceId = Buffer.from(transaction.refno, 'base64').toString('hex');
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
if (transaction.type === 'card_check') {
|
|
53
|
-
const paymentProviderId = referenceId;
|
|
54
|
-
const paymentCredentials = await services.orders.registerPaymentCredentials(
|
|
55
|
-
paymentProviderId,
|
|
56
|
-
{ userId, transactionContext: { transactionId: transaction.transactionId } },
|
|
57
|
-
);
|
|
58
|
-
logger.info(`registered payment credentials for ${userId}`, {
|
|
59
|
-
userId,
|
|
60
|
-
});
|
|
61
|
-
res.status(200).send(paymentCredentials);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (transaction.type === 'payment') {
|
|
65
|
-
const orderPaymentId = referenceId;
|
|
66
|
-
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
67
|
-
orderPaymentId,
|
|
68
|
-
});
|
|
69
|
-
if (!orderPayment) throw new Error(`Order Payment with id ${orderPaymentId} not found`);
|
|
70
|
-
|
|
71
|
-
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
72
|
-
paymentContext: { userId, transactionId: transaction.transactionId },
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (!order) throw new Error(`Order with id ${orderPayment.orderId} not found`);
|
|
76
|
-
|
|
77
|
-
logger.info(`confirmed checkout for order ${order.orderNumber}`, {
|
|
78
|
-
orderId: order._id,
|
|
79
|
-
});
|
|
80
|
-
res.status(200).send(order);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
} catch (e) {
|
|
84
|
-
logger.error(`rejected to checkout with message`, e);
|
|
85
|
-
res.status(500).send({ name: e.name, code: e.code, message: e.message });
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
res.status(404).end();
|
|
91
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import { Context } from '@unchainedshop/api';
|
|
3
|
-
import generateSignature, { Security } from './generateSignature.js';
|
|
4
|
-
import { StatusResponseSuccess } from './api/types.js';
|
|
5
|
-
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
DATATRANS_SIGN_KEY,
|
|
9
|
-
DATATRANS_SIGN2_KEY,
|
|
10
|
-
DATATRANS_SECURITY = Security.DYNAMIC_SIGN,
|
|
11
|
-
} = process.env;
|
|
12
|
-
|
|
13
|
-
const logger = createLogger('unchained:datatrans:handler');
|
|
14
|
-
|
|
15
|
-
export const datatransHandler: RouteHandlerMethod = async (
|
|
16
|
-
req: FastifyRequest & {
|
|
17
|
-
unchainedContext: Context;
|
|
18
|
-
},
|
|
19
|
-
reply,
|
|
20
|
-
) => {
|
|
21
|
-
const resolvedContext = req.unchainedContext as Context;
|
|
22
|
-
const { modules, services } = resolvedContext;
|
|
23
|
-
const signature = req.headers['datatrans-signature'] as string;
|
|
24
|
-
|
|
25
|
-
if (!DATATRANS_SIGN_KEY && !DATATRANS_SIGN2_KEY) {
|
|
26
|
-
logger.warn('No sign key configured');
|
|
27
|
-
return reply.send({ success: false, message: 'No sign key configured', name: 'NO_SIGN_KEY' });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (signature) {
|
|
31
|
-
const [rawTimestamp, rawHash] = signature.split(',');
|
|
32
|
-
const [, hash] = rawHash.split('=');
|
|
33
|
-
const [, timestamp] = rawTimestamp.split('=');
|
|
34
|
-
|
|
35
|
-
const comparableSignature = await generateSignature({
|
|
36
|
-
security: DATATRANS_SECURITY as any,
|
|
37
|
-
signKey: DATATRANS_SIGN2_KEY! || DATATRANS_SIGN_KEY!,
|
|
38
|
-
})(timestamp, req.body as string);
|
|
39
|
-
|
|
40
|
-
if (hash !== comparableSignature) {
|
|
41
|
-
logger.error(`hash mismatch: ${signature} / ${comparableSignature}`);
|
|
42
|
-
reply.status(403);
|
|
43
|
-
return reply.send({ success: false, message: 'Invalid Signature', name: 'HASH_MISMATCH' });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const transaction: StatusResponseSuccess = JSON.parse(req.body as string) as StatusResponseSuccess;
|
|
47
|
-
|
|
48
|
-
logger.info(`received request`, {
|
|
49
|
-
type: transaction.type,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (transaction.status === 'authorized') {
|
|
53
|
-
const userId = transaction.refno2;
|
|
54
|
-
const referenceId = Buffer.from(transaction.refno, 'base64').toString('hex');
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
if (transaction.type === 'card_check') {
|
|
58
|
-
const paymentProviderId = referenceId;
|
|
59
|
-
const paymentCredentials = await services.orders.registerPaymentCredentials(
|
|
60
|
-
paymentProviderId,
|
|
61
|
-
{ userId, transactionContext: { transactionId: transaction.transactionId } },
|
|
62
|
-
);
|
|
63
|
-
logger.info(`registered payment credentials for ${userId}`, {
|
|
64
|
-
userId,
|
|
65
|
-
});
|
|
66
|
-
reply.status(200);
|
|
67
|
-
return reply.send(paymentCredentials);
|
|
68
|
-
}
|
|
69
|
-
if (transaction.type === 'payment') {
|
|
70
|
-
const orderPaymentId = referenceId;
|
|
71
|
-
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
72
|
-
orderPaymentId,
|
|
73
|
-
});
|
|
74
|
-
if (!orderPayment) throw new Error(`Order Payment with id ${orderPaymentId} not found`);
|
|
75
|
-
|
|
76
|
-
const order = await services.orders.checkoutOrder(orderPayment.orderId, {
|
|
77
|
-
paymentContext: { userId, transactionId: transaction.transactionId },
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
if (!order) throw new Error(`Order with id ${orderPayment.orderId} not found`);
|
|
81
|
-
|
|
82
|
-
reply.status(200);
|
|
83
|
-
logger.info(`confirmed checkout for order ${order.orderNumber}`, {
|
|
84
|
-
orderId: order._id,
|
|
85
|
-
});
|
|
86
|
-
return reply.send(order);
|
|
87
|
-
}
|
|
88
|
-
} catch (e) {
|
|
89
|
-
logger.error(e);
|
|
90
|
-
reply.status(500);
|
|
91
|
-
return reply.send({ success: false, name: e.name, code: e.code, message: e.message });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
reply.status(404);
|
|
96
|
-
return reply.send();
|
|
97
|
-
};
|
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import createDatatransAPI from './api/index.js';
|
|
3
|
-
import {
|
|
4
|
-
AuthorizeAuthenticatedResponseSuccess,
|
|
5
|
-
AuthorizeResponseSuccess,
|
|
6
|
-
InitResponseSuccess,
|
|
7
|
-
ResponseError,
|
|
8
|
-
StatusResponseSuccess,
|
|
9
|
-
ValidateResponseSuccess,
|
|
10
|
-
} from './api/types.js';
|
|
11
|
-
import parseRegistrationData from './parseRegistrationData.js';
|
|
12
|
-
import roundedAmountFromOrder from './roundedAmountFromOrder.js';
|
|
13
|
-
import {
|
|
14
|
-
IPaymentAdapter,
|
|
15
|
-
PaymentAdapter,
|
|
16
|
-
PaymentDirector,
|
|
17
|
-
PaymentError,
|
|
18
|
-
PaymentPricingRowCategory,
|
|
19
|
-
PaymentPricingSheet,
|
|
20
|
-
OrderPricingSheet,
|
|
21
|
-
} from '@unchainedshop/core';
|
|
22
|
-
import { Order, OrderPayment } from '@unchainedshop/core-orders';
|
|
23
|
-
import { PaymentConfiguration } from '@unchainedshop/core-payment';
|
|
24
|
-
|
|
25
|
-
const logger = createLogger('unchained:datatrans');
|
|
26
|
-
|
|
27
|
-
// v2
|
|
28
|
-
const {
|
|
29
|
-
DATATRANS_SECRET,
|
|
30
|
-
DATATRANS_SIGN_KEY,
|
|
31
|
-
DATATRANS_API_ENDPOINT = 'https://api.sandbox.datatrans.com',
|
|
32
|
-
DATATRANS_MERCHANT_ID,
|
|
33
|
-
} = process.env;
|
|
34
|
-
|
|
35
|
-
const newDatatransError = ({ code, message }: { code: string; message: string }) => {
|
|
36
|
-
const error = new Error(message);
|
|
37
|
-
error.name = `DATATRANS_${code}`;
|
|
38
|
-
return error;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const throwIfResponseError = (result) => {
|
|
42
|
-
if ((result as ResponseError).error) {
|
|
43
|
-
const rawError = (result as ResponseError).error;
|
|
44
|
-
throw newDatatransError(rawError);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const getMarketplaceSplits = async ({
|
|
49
|
-
order,
|
|
50
|
-
orderPayment,
|
|
51
|
-
config,
|
|
52
|
-
}: {
|
|
53
|
-
order: Order;
|
|
54
|
-
orderPayment: OrderPayment;
|
|
55
|
-
config: PaymentConfiguration;
|
|
56
|
-
}): Promise<
|
|
57
|
-
{
|
|
58
|
-
subMerchantId: string;
|
|
59
|
-
amount: number;
|
|
60
|
-
commission: number;
|
|
61
|
-
}[]
|
|
62
|
-
> => {
|
|
63
|
-
const pricingForOrderPayment = PaymentPricingSheet({
|
|
64
|
-
calculation: orderPayment.calculation,
|
|
65
|
-
currencyCode: order.currencyCode,
|
|
66
|
-
});
|
|
67
|
-
const pricing = OrderPricingSheet({
|
|
68
|
-
calculation: order.calculation,
|
|
69
|
-
currencyCode: order.currencyCode,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const { amount: total } = pricing.total({ useNetPrice: false });
|
|
73
|
-
|
|
74
|
-
return Promise.all(
|
|
75
|
-
config
|
|
76
|
-
.filter((item) => item.key === 'marketplaceSplit')
|
|
77
|
-
.map((item) => {
|
|
78
|
-
const [subMerchantId, staticDiscountId, sharePercentage] =
|
|
79
|
-
item.value || ''.split(';').map((f) => f.trim());
|
|
80
|
-
|
|
81
|
-
const { amount: discountSum } = pricingForOrderPayment.total({
|
|
82
|
-
category: PaymentPricingRowCategory.Discount,
|
|
83
|
-
discountId: staticDiscountId,
|
|
84
|
-
});
|
|
85
|
-
const shareFactor = sharePercentage ? parseInt(sharePercentage, 10) / 100 : 1;
|
|
86
|
-
const amount = Math.round(total * shareFactor);
|
|
87
|
-
const commission = Math.round(discountSum * -1 * shareFactor);
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
subMerchantId,
|
|
91
|
-
amount,
|
|
92
|
-
commission,
|
|
93
|
-
};
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const Datatrans: IPaymentAdapter = {
|
|
99
|
-
...PaymentAdapter,
|
|
100
|
-
|
|
101
|
-
key: 'shop.unchained.datatrans',
|
|
102
|
-
label: 'Datatrans',
|
|
103
|
-
version: '2.0.0',
|
|
104
|
-
|
|
105
|
-
initialConfiguration: [
|
|
106
|
-
{
|
|
107
|
-
key: 'merchantId',
|
|
108
|
-
value: null,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
|
|
112
|
-
typeSupported(type) {
|
|
113
|
-
return type === 'GENERIC';
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
actions: (config, context) => {
|
|
117
|
-
const getMerchantId = (): string | undefined => {
|
|
118
|
-
return config.find((item) => item.key === 'merchantId')?.value || DATATRANS_MERCHANT_ID;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const api = () => {
|
|
122
|
-
const merchantId = getMerchantId();
|
|
123
|
-
if (!DATATRANS_SECRET) throw new Error('Credential DATATRANS_SECRET not Set');
|
|
124
|
-
if (!merchantId) throw new Error('Credential Merchant ID not configured');
|
|
125
|
-
if (!DATATRANS_API_ENDPOINT) throw new Error('Credential DATATRANS_API_ENDPOINT not Set');
|
|
126
|
-
return createDatatransAPI(DATATRANS_API_ENDPOINT, merchantId!, DATATRANS_SECRET);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const shouldSettleInUnchained = () => {
|
|
130
|
-
return config.reduce((current, item) => {
|
|
131
|
-
if (item.key === 'settleInUnchained') return Boolean(item.value);
|
|
132
|
-
return current;
|
|
133
|
-
}, true);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const authorize = async ({ paymentCredentials, ...arbitraryFields }): Promise<string> => {
|
|
137
|
-
const { order, orderPayment } = context;
|
|
138
|
-
|
|
139
|
-
if (!orderPayment) throw new Error('Order Payment missing in context');
|
|
140
|
-
if (!order) throw new Error('Order missing in context');
|
|
141
|
-
|
|
142
|
-
const refno = Buffer.from(orderPayment._id, 'hex').toString('base64');
|
|
143
|
-
const userId = order?.userId || context?.userId;
|
|
144
|
-
const refno2 = userId;
|
|
145
|
-
const { currencyCode, amount } = roundedAmountFromOrder(order);
|
|
146
|
-
const splits = await getMarketplaceSplits({
|
|
147
|
-
orderPayment,
|
|
148
|
-
order,
|
|
149
|
-
config,
|
|
150
|
-
});
|
|
151
|
-
const result = await api().authorize({
|
|
152
|
-
...arbitraryFields,
|
|
153
|
-
amount,
|
|
154
|
-
currency: currencyCode,
|
|
155
|
-
refno,
|
|
156
|
-
refno2,
|
|
157
|
-
autoSettle: false,
|
|
158
|
-
customer: {
|
|
159
|
-
id: userId,
|
|
160
|
-
},
|
|
161
|
-
marketplace: splits.length
|
|
162
|
-
? {
|
|
163
|
-
splits,
|
|
164
|
-
}
|
|
165
|
-
: undefined,
|
|
166
|
-
[paymentCredentials.meta.objectKey]: JSON.parse(paymentCredentials.token),
|
|
167
|
-
});
|
|
168
|
-
throwIfResponseError(result);
|
|
169
|
-
return (result as AuthorizeResponseSuccess).transactionId;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const authorizeAuth = async ({
|
|
173
|
-
transactionId,
|
|
174
|
-
refno,
|
|
175
|
-
refno2,
|
|
176
|
-
...arbitraryFields
|
|
177
|
-
}): Promise<string> => {
|
|
178
|
-
const { order } = context;
|
|
179
|
-
if (!order) throw new Error('Order missing in context');
|
|
180
|
-
const { currencyCode, amount } = roundedAmountFromOrder(order);
|
|
181
|
-
const result = await api().authorizeAuthenticated({
|
|
182
|
-
...arbitraryFields,
|
|
183
|
-
transactionId,
|
|
184
|
-
amount,
|
|
185
|
-
currency: currencyCode,
|
|
186
|
-
refno,
|
|
187
|
-
refno2,
|
|
188
|
-
autoSettle: false,
|
|
189
|
-
});
|
|
190
|
-
throwIfResponseError(result);
|
|
191
|
-
return (result as AuthorizeAuthenticatedResponseSuccess).acquirerAuthorizationCode;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const isTransactionAmountValid = (transaction: StatusResponseSuccess): boolean => {
|
|
195
|
-
const { order } = context;
|
|
196
|
-
if (!order) throw new Error('Order missing in context');
|
|
197
|
-
const { currencyCode, amount } = roundedAmountFromOrder(order);
|
|
198
|
-
if (
|
|
199
|
-
transaction.currency !== currencyCode ||
|
|
200
|
-
(transaction.detail.authorize as any)?.amount !== amount
|
|
201
|
-
) {
|
|
202
|
-
logger.info(
|
|
203
|
-
`currency: ${transaction.currency} === ${currencyCode} => ${
|
|
204
|
-
transaction.currency === currencyCode
|
|
205
|
-
}, amount: ${(transaction.detail.authorize as any)?.amount} === ${amount} => ${
|
|
206
|
-
(transaction.detail.authorize as any)?.amount === amount
|
|
207
|
-
}`,
|
|
208
|
-
);
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
return true;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const checkIfTransactionAmountValid = (
|
|
215
|
-
transactionId: string,
|
|
216
|
-
transaction: StatusResponseSuccess,
|
|
217
|
-
): void => {
|
|
218
|
-
if (!isTransactionAmountValid(transaction)) {
|
|
219
|
-
logger.error(
|
|
220
|
-
`Transaction declined / Transaction ID ${transactionId} because of amount/currency mismatch`,
|
|
221
|
-
);
|
|
222
|
-
throw newDatatransError({
|
|
223
|
-
code: `YOU_HAVE_TO_PAY_THE_FULL_AMOUNT_DUDE`,
|
|
224
|
-
message: 'Amount / Currency Mismatch with Cart',
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const settle = async ({ transactionId, refno, refno2, extensions }): Promise<boolean> => {
|
|
230
|
-
const { order, orderPayment } = context;
|
|
231
|
-
if (!orderPayment) throw new Error('Order Payment missing in context');
|
|
232
|
-
if (!order) throw new Error('Order missing in context');
|
|
233
|
-
const { currencyCode, amount } = roundedAmountFromOrder(order);
|
|
234
|
-
const splits = await getMarketplaceSplits({
|
|
235
|
-
orderPayment,
|
|
236
|
-
order,
|
|
237
|
-
config,
|
|
238
|
-
});
|
|
239
|
-
const result = await api().settle({
|
|
240
|
-
transactionId,
|
|
241
|
-
amount,
|
|
242
|
-
refno,
|
|
243
|
-
refno2,
|
|
244
|
-
currency: currencyCode,
|
|
245
|
-
marketplace: splits.length
|
|
246
|
-
? {
|
|
247
|
-
splits,
|
|
248
|
-
}
|
|
249
|
-
: undefined,
|
|
250
|
-
extensions,
|
|
251
|
-
});
|
|
252
|
-
throwIfResponseError(result);
|
|
253
|
-
return result as boolean;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const cancel = async ({ transactionId, refno }): Promise<boolean> => {
|
|
257
|
-
const result = await api().cancel({
|
|
258
|
-
transactionId,
|
|
259
|
-
refno,
|
|
260
|
-
});
|
|
261
|
-
throwIfResponseError(result);
|
|
262
|
-
return result as boolean;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const adapterActions = {
|
|
266
|
-
...PaymentAdapter.actions(config, context),
|
|
267
|
-
|
|
268
|
-
configurationError() {
|
|
269
|
-
if (!getMerchantId() || !DATATRANS_SECRET || !DATATRANS_SIGN_KEY) {
|
|
270
|
-
return PaymentError.INCOMPLETE_CONFIGURATION;
|
|
271
|
-
}
|
|
272
|
-
return null;
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
isActive() {
|
|
276
|
-
if (adapterActions.configurationError() === null) return true;
|
|
277
|
-
return false;
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
isPayLaterAllowed() {
|
|
281
|
-
return false;
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
async sign(transactionContext: any = {}) {
|
|
285
|
-
const { useSecureFields = false, ...arbitraryFields } = transactionContext || {};
|
|
286
|
-
const { orderPayment, paymentProvider, order } = context;
|
|
287
|
-
const refno = Buffer.from(orderPayment ? orderPayment._id : paymentProvider._id, 'hex').toString(
|
|
288
|
-
'base64',
|
|
289
|
-
);
|
|
290
|
-
const userId = order?.userId || context?.userId;
|
|
291
|
-
const refno2 = userId;
|
|
292
|
-
const price: { amount?: number; currencyCode?: string } = order
|
|
293
|
-
? roundedAmountFromOrder(order)
|
|
294
|
-
: {};
|
|
295
|
-
|
|
296
|
-
if (useSecureFields) {
|
|
297
|
-
const result = await api().secureFields({
|
|
298
|
-
...arbitraryFields,
|
|
299
|
-
currency: price.currencyCode || 'CHF',
|
|
300
|
-
refno,
|
|
301
|
-
refno2,
|
|
302
|
-
customer: {
|
|
303
|
-
id: userId,
|
|
304
|
-
},
|
|
305
|
-
amount: price.amount,
|
|
306
|
-
});
|
|
307
|
-
throwIfResponseError(result);
|
|
308
|
-
return JSON.stringify(result as InitResponseSuccess);
|
|
309
|
-
}
|
|
310
|
-
const result = await api().init({
|
|
311
|
-
...arbitraryFields,
|
|
312
|
-
currency: price.currencyCode || 'CHF',
|
|
313
|
-
refno,
|
|
314
|
-
refno2,
|
|
315
|
-
customer: {
|
|
316
|
-
id: userId,
|
|
317
|
-
},
|
|
318
|
-
amount: price.amount,
|
|
319
|
-
});
|
|
320
|
-
throwIfResponseError(result);
|
|
321
|
-
return JSON.stringify(result as InitResponseSuccess);
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
async validate(credentials) {
|
|
325
|
-
if (!credentials.meta) return false;
|
|
326
|
-
const { objectKey, currency } = credentials.meta;
|
|
327
|
-
const result = await api().validate({
|
|
328
|
-
refno: Buffer.from(`valid-${new Date().getTime()}`, 'hex').toString('base64'),
|
|
329
|
-
currency,
|
|
330
|
-
[objectKey]: JSON.parse(credentials.token),
|
|
331
|
-
});
|
|
332
|
-
return Boolean((result as ValidateResponseSuccess)?.transactionId);
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
async register(transactionResponse) {
|
|
336
|
-
const { transactionId } = transactionResponse;
|
|
337
|
-
const result = (await api().status({
|
|
338
|
-
transactionId,
|
|
339
|
-
})) as StatusResponseSuccess;
|
|
340
|
-
if (result.transactionId) {
|
|
341
|
-
return parseRegistrationData(result);
|
|
342
|
-
}
|
|
343
|
-
return null;
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
async confirm() {
|
|
347
|
-
if (!shouldSettleInUnchained()) return false;
|
|
348
|
-
const { orderPayment, transactionContext } = context;
|
|
349
|
-
|
|
350
|
-
if (!orderPayment) throw new Error('Order Payment missing in context');
|
|
351
|
-
|
|
352
|
-
const { transactionId } = orderPayment;
|
|
353
|
-
|
|
354
|
-
const { extensions } = transactionContext || {};
|
|
355
|
-
|
|
356
|
-
if (!transactionId) {
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
const transaction: StatusResponseSuccess = (await api().status({
|
|
360
|
-
transactionId,
|
|
361
|
-
})) as StatusResponseSuccess;
|
|
362
|
-
throwIfResponseError(transaction);
|
|
363
|
-
const { status } = transaction;
|
|
364
|
-
|
|
365
|
-
if (status === 'authorized') {
|
|
366
|
-
// either settle or cancel
|
|
367
|
-
// if further deferred settlement is active, don't settle in unchained and hand off
|
|
368
|
-
// settlement to other systems
|
|
369
|
-
await settle({
|
|
370
|
-
transactionId,
|
|
371
|
-
refno: transaction.refno,
|
|
372
|
-
refno2: transaction.refno2,
|
|
373
|
-
extensions,
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
return true;
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
async cancel() {
|
|
380
|
-
if (!shouldSettleInUnchained()) return false;
|
|
381
|
-
const { orderPayment } = context;
|
|
382
|
-
|
|
383
|
-
if (!orderPayment) throw new Error('Order Payment missing in context');
|
|
384
|
-
|
|
385
|
-
const { transactionId } = orderPayment;
|
|
386
|
-
if (!transactionId) {
|
|
387
|
-
return false;
|
|
388
|
-
}
|
|
389
|
-
const transaction: StatusResponseSuccess = (await api().status({
|
|
390
|
-
transactionId,
|
|
391
|
-
})) as StatusResponseSuccess;
|
|
392
|
-
throwIfResponseError(transaction);
|
|
393
|
-
const { status } = transaction;
|
|
394
|
-
|
|
395
|
-
if (status === 'authorized') {
|
|
396
|
-
// either settle or cancel
|
|
397
|
-
// if further deferred settlement is active, don't settle in unchained and hand off
|
|
398
|
-
// settlement to other systems
|
|
399
|
-
await cancel({
|
|
400
|
-
transactionId,
|
|
401
|
-
refno: transaction.refno,
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
return true;
|
|
405
|
-
},
|
|
406
|
-
|
|
407
|
-
async charge({
|
|
408
|
-
transactionId: rawTransactionId,
|
|
409
|
-
paymentCredentials,
|
|
410
|
-
authorizeAuthenticated,
|
|
411
|
-
...arbitraryFields
|
|
412
|
-
}) {
|
|
413
|
-
if (!rawTransactionId && !paymentCredentials) {
|
|
414
|
-
logger.warn(
|
|
415
|
-
'Not trying to charge because of missing payment authorization response, return false to provide later',
|
|
416
|
-
);
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const transactionId =
|
|
421
|
-
rawTransactionId ||
|
|
422
|
-
(await authorize({
|
|
423
|
-
...arbitraryFields,
|
|
424
|
-
paymentCredentials,
|
|
425
|
-
}));
|
|
426
|
-
|
|
427
|
-
const transaction: StatusResponseSuccess = (await api().status({
|
|
428
|
-
transactionId,
|
|
429
|
-
})) as StatusResponseSuccess;
|
|
430
|
-
throwIfResponseError(transaction);
|
|
431
|
-
|
|
432
|
-
if (!transaction) {
|
|
433
|
-
throw newDatatransError({
|
|
434
|
-
code: `TRANSACTION_NOT_FOUND`,
|
|
435
|
-
message: 'Amount / Currency Mismatch with Cart',
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
let { status } = transaction;
|
|
439
|
-
|
|
440
|
-
if (status === 'canceled' || status === 'failed') {
|
|
441
|
-
logger.error(
|
|
442
|
-
`Payment declined or canceled with Transaction ID ${transactionId} and status ${status}`,
|
|
443
|
-
);
|
|
444
|
-
throw newDatatransError({
|
|
445
|
-
code: `STATUS_${status.toUpperCase()}`,
|
|
446
|
-
message: 'Payment declined or canceled',
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (status === 'authenticated') {
|
|
451
|
-
if (authorizeAuthenticated) {
|
|
452
|
-
checkIfTransactionAmountValid(transactionId, transaction);
|
|
453
|
-
await authorizeAuth({
|
|
454
|
-
...(authorizeAuthenticated || {}),
|
|
455
|
-
transactionId,
|
|
456
|
-
refno: transaction.refno,
|
|
457
|
-
refno2: transaction.refno2,
|
|
458
|
-
});
|
|
459
|
-
status = 'authorized';
|
|
460
|
-
} else {
|
|
461
|
-
logger.error(`Transaction declined / Transaction ID ${transactionId} not authorized yet`);
|
|
462
|
-
throw newDatatransError({
|
|
463
|
-
code: `STATUS_${status.toUpperCase()}`,
|
|
464
|
-
message: 'Payment authenticated but not authorized',
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (status === 'authorized' || status === 'settled') {
|
|
470
|
-
let settledTransaction = transaction;
|
|
471
|
-
let credentials;
|
|
472
|
-
// here we try to guard us against a potential
|
|
473
|
-
// network hicup or registration data parsing error
|
|
474
|
-
// at the dumbest possible moment
|
|
475
|
-
try {
|
|
476
|
-
checkIfTransactionAmountValid(transactionId, settledTransaction);
|
|
477
|
-
credentials = await parseRegistrationData(settledTransaction);
|
|
478
|
-
const result = await api().status({
|
|
479
|
-
transactionId,
|
|
480
|
-
});
|
|
481
|
-
if ((result as ResponseError)?.error) {
|
|
482
|
-
settledTransaction = transaction;
|
|
483
|
-
} else {
|
|
484
|
-
settledTransaction = result as StatusResponseSuccess;
|
|
485
|
-
}
|
|
486
|
-
} catch {
|
|
487
|
-
await cancel({ transactionId, refno: settledTransaction.refno });
|
|
488
|
-
logger.error(
|
|
489
|
-
`Transaction declined / Transaction ID ${transactionId} authorization cancelled`,
|
|
490
|
-
);
|
|
491
|
-
throw newDatatransError({
|
|
492
|
-
code: `STATUS_${status.toUpperCase()}`,
|
|
493
|
-
message: 'Payment cancelled server-side because of amount missmatch',
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
return {
|
|
497
|
-
transactionId,
|
|
498
|
-
settledTransaction,
|
|
499
|
-
arbitraryFields,
|
|
500
|
-
credentials,
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (
|
|
505
|
-
status === 'initialized' ||
|
|
506
|
-
status === 'challenge_required' ||
|
|
507
|
-
status === 'challenge_ongoing' ||
|
|
508
|
-
status === 'transmitted'
|
|
509
|
-
) {
|
|
510
|
-
logger.error(`Transaction ID ${transactionId} in transit with status ${status}`);
|
|
511
|
-
throw newDatatransError({
|
|
512
|
-
code: `STATUS_${status.toUpperCase()}`,
|
|
513
|
-
message: 'Transaction status invalid for checkout',
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
return false;
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
return adapterActions;
|
|
521
|
-
},
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
PaymentDirector.registerAdapter(Datatrans);
|