@unchainedshop/plugins 1.1.7 → 1.2.1
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/jest.config.js +5 -0
- package/package.json +31 -25
- package/src/files/gridfs/gridfs-adapter.ts +1 -1
- package/src/files/gridfs/gridfs-webhook.ts +62 -0
- package/src/files/gridfs/{index.js → index.ts} +0 -0
- package/src/files/gridfs/{promisePipe.js → promisePipe.ts} +0 -0
- package/src/files/gridfs/{sign.js → sign.ts} +0 -0
- package/src/files/minio/minio-adapter.ts +1 -2
- package/src/files/minio/minio-webhook.js +33 -30
- package/src/payment/apple-iap/adapter.ts +113 -110
- package/src/payment/apple-iap/index.ts +2 -1
- package/src/payment/bity/adapter.ts +53 -51
- package/src/payment/bity/index.ts +2 -1
- package/src/payment/braintree.ts +2 -2
- package/src/payment/cryptopay.ts +69 -67
- package/src/payment/datatrans-v2/index.ts +3 -1
- package/src/payment/datatrans-v2/middleware.ts +129 -123
- package/src/payment/paypal-checkout.ts +1 -1
- package/src/payment/postfinance-checkout/index.ts +3 -1
- package/src/payment/postfinance-checkout/middleware.ts +42 -40
- package/src/payment/stripe.ts +82 -74
- package/src/payment/worldline-saferpay/worldline-saferpay-client/index.ts +3 -3
- package/src/pricing/product-discount.ts +1 -1
- package/src/pricing/product-price-ECB-interbank-exchange.ts +1 -1
- package/src/pricing/product-price-cryptopay.ts +20 -18
- package/src/worker/email.ts +1 -0
- package/tsconfig.json +26 -5
- package/lib/delivery/pick-mup.d.ts +0 -1
- package/lib/delivery/pick-mup.js +0 -98
- package/lib/delivery/pick-mup.js.map +0 -1
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/post.js +0 -23
- package/lib/delivery/post.js.map +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/send-message.js +0 -41
- package/lib/delivery/send-message.js.map +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/delivery/stores.js +0 -39
- package/lib/delivery/stores.js.map +0 -1
- package/lib/enrollments/licensed.d.ts +0 -1
- package/lib/enrollments/licensed.js +0 -40
- package/lib/enrollments/licensed.js.map +0 -1
- package/lib/events/node-event-emitter.d.ts +0 -1
- package/lib/events/node-event-emitter.js +0 -16
- package/lib/events/node-event-emitter.js.map +0 -1
- package/lib/events/redis.d.ts +0 -1
- package/lib/events/redis.js +0 -24
- package/lib/events/redis.js.map +0 -1
- package/lib/files/gridfs/gridfs-adapter.d.ts +0 -2
- package/lib/files/gridfs/gridfs-adapter.js +0 -106
- package/lib/files/gridfs/gridfs-adapter.js.map +0 -1
- package/lib/files/gridfs/gridfs-webhook.d.ts +0 -1
- package/lib/files/gridfs/gridfs-webhook.js +0 -54
- package/lib/files/gridfs/gridfs-webhook.js.map +0 -1
- package/lib/files/gridfs/index.d.ts +0 -8
- package/lib/files/gridfs/index.js +0 -21
- package/lib/files/gridfs/index.js.map +0 -1
- package/lib/files/gridfs/promisePipe.d.ts +0 -2
- package/lib/files/gridfs/promisePipe.js +0 -21
- package/lib/files/gridfs/promisePipe.js.map +0 -1
- package/lib/files/gridfs/sign.d.ts +0 -2
- package/lib/files/gridfs/sign.js +0 -12
- package/lib/files/gridfs/sign.js.map +0 -1
- package/lib/files/minio/minio-adapter.d.ts +0 -4
- package/lib/files/minio/minio-adapter.js +0 -166
- package/lib/files/minio/minio-adapter.js.map +0 -1
- package/lib/files/minio/minio-webhook.d.ts +0 -1
- package/lib/files/minio/minio-webhook.js +0 -45
- package/lib/files/minio/minio-webhook.js.map +0 -1
- package/lib/filters/local-search.d.ts +0 -3
- package/lib/filters/local-search.js +0 -84
- package/lib/filters/local-search.js.map +0 -1
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/filters/strict-equal.js +0 -25
- package/lib/filters/strict-equal.js.map +0 -1
- package/lib/payment/apple-iap/adapter.d.ts +0 -1
- package/lib/payment/apple-iap/adapter.js +0 -284
- package/lib/payment/apple-iap/adapter.js.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +0 -7
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +0 -5
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +0 -1
- package/lib/payment/apple-iap/index.d.ts +0 -2
- package/lib/payment/apple-iap/index.js +0 -3
- package/lib/payment/apple-iap/index.js.map +0 -1
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +0 -9
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +0 -18
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +0 -1
- package/lib/payment/bity/adapter.d.ts +0 -1
- package/lib/payment/bity/adapter.js +0 -316
- package/lib/payment/bity/adapter.js.map +0 -1
- package/lib/payment/bity/db/BityCredentialsCollection.d.ts +0 -11
- package/lib/payment/bity/db/BityCredentialsCollection.js +0 -5
- package/lib/payment/bity/db/BityCredentialsCollection.js.map +0 -1
- package/lib/payment/bity/index.d.ts +0 -2
- package/lib/payment/bity/index.js +0 -3
- package/lib/payment/bity/index.js.map +0 -1
- package/lib/payment/bity/module/configureBityModule.d.ts +0 -11
- package/lib/payment/bity/module/configureBityModule.js +0 -33
- package/lib/payment/bity/module/configureBityModule.js.map +0 -1
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -129
- package/lib/payment/braintree.js.map +0 -1
- package/lib/payment/cryptopay.d.ts +0 -1
- package/lib/payment/cryptopay.js +0 -159
- package/lib/payment/cryptopay.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/authorize.js +0 -12
- package/lib/payment/datatrans-v2/api/authorize.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +0 -11
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/cancel.js +0 -10
- package/lib/payment/datatrans-v2/api/cancel.js.map +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +0 -19
- package/lib/payment/datatrans-v2/api/index.js +0 -24
- package/lib/payment/datatrans-v2/api/index.js.map +0 -1
- package/lib/payment/datatrans-v2/api/init.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/init.js +0 -31
- package/lib/payment/datatrans-v2/api/init.js.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -41
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/secureFields.js +0 -14
- package/lib/payment/datatrans-v2/api/secureFields.js.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/settle.js +0 -10
- package/lib/payment/datatrans-v2/api/settle.js.map +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/status.js +0 -7
- package/lib/payment/datatrans-v2/api/status.js.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts +0 -2
- package/lib/payment/datatrans-v2/api/validate.js +0 -10
- package/lib/payment/datatrans-v2/api/validate.js.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts +0 -10
- package/lib/payment/datatrans-v2/generateSignature.js +0 -19
- package/lib/payment/datatrans-v2/generateSignature.js.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.d.ts +0 -9
- package/lib/payment/datatrans-v2/getPaths.js +0 -9
- package/lib/payment/datatrans-v2/getPaths.js.map +0 -1
- package/lib/payment/datatrans-v2/index.d.ts +0 -1
- package/lib/payment/datatrans-v2/index.js +0 -384
- package/lib/payment/datatrans-v2/index.js.map +0 -1
- package/lib/payment/datatrans-v2/middleware.d.ts +0 -1
- package/lib/payment/datatrans-v2/middleware.js +0 -111
- package/lib/payment/datatrans-v2/middleware.js.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +0 -11
- package/lib/payment/datatrans-v2/parseRegistrationData.js +0 -26
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +0 -7
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +0 -10
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -8
- package/lib/payment/datatrans-v2/splitProperties.js +0 -58
- package/lib/payment/datatrans-v2/splitProperties.js.map +0 -1
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice-prepaid.js +0 -30
- package/lib/payment/invoice-prepaid.js.map +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/invoice.js +0 -27
- package/lib/payment/invoice.js.map +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -82
- package/lib/payment/paypal-checkout.js.map +0 -1
- package/lib/payment/postfinance-checkout/api.d.ts +0 -11
- package/lib/payment/postfinance-checkout/api.js +0 -109
- package/lib/payment/postfinance-checkout/api.js.map +0 -1
- package/lib/payment/postfinance-checkout/index.d.ts +0 -1
- package/lib/payment/postfinance-checkout/index.js +0 -186
- package/lib/payment/postfinance-checkout/index.js.map +0 -1
- package/lib/payment/postfinance-checkout/middleware.d.ts +0 -1
- package/lib/payment/postfinance-checkout/middleware.js +0 -42
- package/lib/payment/postfinance-checkout/middleware.js.map +0 -1
- package/lib/payment/postfinance-checkout/types.d.ts +0 -23
- package/lib/payment/postfinance-checkout/types.js +0 -12
- package/lib/payment/postfinance-checkout/types.js.map +0 -1
- package/lib/payment/postfinance-checkout/utils.d.ts +0 -4
- package/lib/payment/postfinance-checkout/utils.js +0 -20
- package/lib/payment/postfinance-checkout/utils.js.map +0 -1
- package/lib/payment/stripe.d.ts +0 -1
- package/lib/payment/stripe.js +0 -214
- package/lib/payment/stripe.js.map +0 -1
- package/lib/payment/worldline-saferpay/index.d.ts +0 -1
- package/lib/payment/worldline-saferpay/index.js +0 -112
- package/lib/payment/worldline-saferpay/index.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.d.ts +0 -14
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js +0 -29
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.d.ts +0 -9
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js +0 -28
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.d.ts +0 -4
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.d.ts +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.d.ts +0 -73
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.d.ts +0 -53
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.d.ts +0 -13
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.d.ts +0 -9
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.d.ts +0 -5
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js.map +0 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.d.ts +0 -13
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js +0 -2
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js.map +0 -1
- package/lib/pricing/delivery-swiss-tax.d.ts +0 -15
- package/lib/pricing/delivery-swiss-tax.js +0 -98
- package/lib/pricing/delivery-swiss-tax.js.map +0 -1
- package/lib/pricing/discount-100-off.d.ts +0 -1
- package/lib/pricing/discount-100-off.js +0 -34
- package/lib/pricing/discount-100-off.js.map +0 -1
- package/lib/pricing/discount-half-price-manual.d.ts +0 -1
- package/lib/pricing/discount-half-price-manual.js +0 -34
- package/lib/pricing/discount-half-price-manual.js.map +0 -1
- package/lib/pricing/discount-half-price.d.ts +0 -1
- package/lib/pricing/discount-half-price.js +0 -37
- package/lib/pricing/discount-half-price.js.map +0 -1
- package/lib/pricing/free-delivery.d.ts +0 -2
- package/lib/pricing/free-delivery.js +0 -26
- package/lib/pricing/free-delivery.js.map +0 -1
- package/lib/pricing/free-payment.d.ts +0 -2
- package/lib/pricing/free-payment.js +0 -26
- package/lib/pricing/free-payment.js.map +0 -1
- package/lib/pricing/order-delivery.d.ts +0 -1
- package/lib/pricing/order-delivery.js +0 -33
- package/lib/pricing/order-delivery.js.map +0 -1
- package/lib/pricing/order-discount.d.ts +0 -1
- package/lib/pricing/order-discount.js +0 -110
- package/lib/pricing/order-discount.js.map +0 -1
- package/lib/pricing/order-items-discount.d.ts +0 -1
- package/lib/pricing/order-items-discount.js +0 -88
- package/lib/pricing/order-items-discount.js.map +0 -1
- package/lib/pricing/order-items.d.ts +0 -1
- package/lib/pricing/order-items.js +0 -44
- package/lib/pricing/order-items.js.map +0 -1
- package/lib/pricing/order-payment.d.ts +0 -1
- package/lib/pricing/order-payment.js +0 -33
- package/lib/pricing/order-payment.js.map +0 -1
- package/lib/pricing/product-catalog-price.d.ts +0 -1
- package/lib/pricing/product-catalog-price.js +0 -37
- package/lib/pricing/product-catalog-price.js.map +0 -1
- package/lib/pricing/product-discount.d.ts +0 -1
- package/lib/pricing/product-discount.js +0 -55
- package/lib/pricing/product-discount.js.map +0 -1
- package/lib/pricing/product-price-ECB-interbank-exchange.d.ts +0 -1
- package/lib/pricing/product-price-ECB-interbank-exchange.js +0 -90
- package/lib/pricing/product-price-ECB-interbank-exchange.js.map +0 -1
- package/lib/pricing/product-price-coinbase-exchange.d.ts +0 -1
- package/lib/pricing/product-price-coinbase-exchange.js +0 -60
- package/lib/pricing/product-price-coinbase-exchange.js.map +0 -1
- package/lib/pricing/product-price-cryptopay.d.ts +0 -1
- package/lib/pricing/product-price-cryptopay.js +0 -21
- package/lib/pricing/product-price-cryptopay.js.map +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts +0 -1
- package/lib/pricing/product-price-rateconversion.js +0 -51
- package/lib/pricing/product-price-rateconversion.js.map +0 -1
- package/lib/pricing/product-price-round.d.ts +0 -11
- package/lib/pricing/product-price-round.js +0 -54
- package/lib/pricing/product-price-round.js.map +0 -1
- package/lib/pricing/product-swiss-tax.d.ts +0 -13
- package/lib/pricing/product-swiss-tax.js +0 -102
- package/lib/pricing/product-swiss-tax.js.map +0 -1
- package/lib/pricing/utils/cache.d.ts +0 -8
- package/lib/pricing/utils/cache.js +0 -28
- package/lib/pricing/utils/cache.js.map +0 -1
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/quotations/manual.js +0 -21
- package/lib/quotations/manual.js.map +0 -1
- package/lib/warehousing/google-sheets.d.ts +0 -1
- package/lib/warehousing/google-sheets.js +0 -153
- package/lib/warehousing/google-sheets.js.map +0 -1
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/warehousing/store.js +0 -33
- package/lib/warehousing/store.js.map +0 -1
- package/lib/worker/BulkImportWorker.d.ts +0 -2
- package/lib/worker/BulkImportWorker.js +0 -91
- package/lib/worker/BulkImportWorker.js.map +0 -1
- package/lib/worker/GenerateOrderWorker.d.ts +0 -1
- package/lib/worker/GenerateOrderWorker.js +0 -110
- package/lib/worker/GenerateOrderWorker.js.map +0 -1
- package/lib/worker/MessageWorker.js +0 -45
- package/lib/worker/MessageWorker.js.map +0 -1
- package/lib/worker/ZombieKillerWorker.d.ts +0 -7
- package/lib/worker/ZombieKillerWorker.js +0 -88
- package/lib/worker/ZombieKillerWorker.js.map +0 -1
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/email.js +0 -96
- package/lib/worker/email.js.map +0 -1
- package/lib/worker/external.d.ts +0 -2
- package/lib/worker/external.js +0 -13
- package/lib/worker/external.js.map +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/heartbeat.js +0 -32
- package/lib/worker/heartbeat.js.map +0 -1
- package/lib/worker/http-request.d.ts +0 -8
- package/lib/worker/http-request.js +0 -61
- package/lib/worker/http-request.js.map +0 -1
- package/lib/worker/sms.d.ts +0 -1
- package/lib/worker/sms.js +0 -69
- package/lib/worker/sms.js.map +0 -1
- package/license +0 -274
- package/src/files/gridfs/gridfs-webhook.js +0 -60
- package/tsconfig.build.json +0 -26
package/src/payment/braintree.ts
CHANGED
|
@@ -91,7 +91,7 @@ const BraintreeDirect: IPaymentAdapter = {
|
|
|
91
91
|
},
|
|
92
92
|
|
|
93
93
|
sign: async () => {
|
|
94
|
-
const braintree =
|
|
94
|
+
const braintree = (await import('braintree')).default; // eslint-disable-line
|
|
95
95
|
const gateway = getGateway(braintree);
|
|
96
96
|
const result = await gateway.clientToken.generate({});
|
|
97
97
|
if (result.success) {
|
|
@@ -105,7 +105,7 @@ const BraintreeDirect: IPaymentAdapter = {
|
|
|
105
105
|
const { order } = params.paymentContext;
|
|
106
106
|
if (!paypalPaymentMethodNonce)
|
|
107
107
|
throw new Error('You have to provide paypalPaymentMethodNonce in paymentContext');
|
|
108
|
-
const braintree =
|
|
108
|
+
const braintree = (await import('braintree')).default; // eslint-disable-line
|
|
109
109
|
const gateway = getGateway(braintree);
|
|
110
110
|
const address = order.billingAddress || {};
|
|
111
111
|
const pricing = modules.orders.pricingSheet(order);
|
package/src/payment/cryptopay.ts
CHANGED
|
@@ -14,7 +14,7 @@ const logger = createLogger('unchained:core-payment:cryptopay');
|
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
CRYPTOPAY_SECRET,
|
|
17
|
-
CRYPTOPAY_WEBHOOK_PATH = '/
|
|
17
|
+
CRYPTOPAY_WEBHOOK_PATH = '/payment/cryptopay',
|
|
18
18
|
CRYPTOPAY_BTC_XPUB,
|
|
19
19
|
CRYPTOPAY_ETH_XPUB,
|
|
20
20
|
CRYPTOPAY_BTC_TESTNET = false,
|
|
@@ -30,79 +30,81 @@ enum CryptopayCurrencies { // eslint-disable-line
|
|
|
30
30
|
const MAX_RATE_AGE = parseInt(CRYPTOPAY_MAX_RATE_AGE, 10);
|
|
31
31
|
const MAX_ALLOWED_DIFF = parseFloat(CRYPTOPAY_MAX_CONV_DIFF); // Accept payments when the converted amount differs by adapterActions much (in percent)
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const orderPayment = await resolvedContext.modules.orders.payments.findOrderPaymentByContextData({
|
|
45
|
-
context: { currency, address },
|
|
46
|
-
});
|
|
47
|
-
if (orderPayment) {
|
|
48
|
-
if (currency === CryptopayCurrencies.ETH && contract && contract !== '') {
|
|
49
|
-
const ERC20CurrencyCount = await resolvedContext.modules.currencies.count({
|
|
50
|
-
includeInactive: false,
|
|
51
|
-
contractAddress: contract,
|
|
52
|
-
});
|
|
53
|
-
if (!ERC20CurrencyCount) {
|
|
54
|
-
logger.warn(`Cryptopay Plugin: ERC20 token address ${contract} not whitelisted.`);
|
|
55
|
-
response.end(JSON.stringify({ success: false }));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
33
|
+
export default (app) => {
|
|
34
|
+
useMiddlewareWithCurrentContext(app, CRYPTOPAY_WEBHOOK_PATH, bodyParser.json());
|
|
35
|
+
|
|
36
|
+
useMiddlewareWithCurrentContext(app, CRYPTOPAY_WEBHOOK_PATH, async (request, response) => {
|
|
37
|
+
// Return a 200 response to acknowledge receipt of the event
|
|
38
|
+
const resolvedContext = request.unchainedContext as Context;
|
|
39
|
+
const { currency, contract, decimals, address, amount, secret } = request.body;
|
|
40
|
+
if (secret !== CRYPTOPAY_SECRET) {
|
|
41
|
+
logger.warn(`Cryptopay Plugin: Invalid Cryptopay Secret provided`);
|
|
42
|
+
response.end(JSON.stringify({ success: false }));
|
|
43
|
+
return;
|
|
58
44
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
45
|
+
const orderPayment = await resolvedContext.modules.orders.payments.findOrderPaymentByContextData({
|
|
46
|
+
context: { currency, address },
|
|
61
47
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
48
|
+
if (orderPayment) {
|
|
49
|
+
if (currency === CryptopayCurrencies.ETH && contract && contract !== '') {
|
|
50
|
+
const ERC20CurrencyCount = await resolvedContext.modules.currencies.count({
|
|
51
|
+
includeInactive: false,
|
|
52
|
+
contractAddress: contract,
|
|
53
|
+
});
|
|
54
|
+
if (!ERC20CurrencyCount) {
|
|
55
|
+
logger.warn(`Cryptopay Plugin: ERC20 token address ${contract} not whitelisted.`);
|
|
56
|
+
response.end(JSON.stringify({ success: false }));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const order = await resolvedContext.modules.orders.findOrder({
|
|
61
|
+
orderId: orderPayment.orderId,
|
|
62
|
+
});
|
|
63
|
+
const pricing = OrderPricingSheet({
|
|
64
|
+
calculation: order.calculation,
|
|
65
|
+
currency: order.currency,
|
|
66
|
+
});
|
|
67
|
+
const totalAmount = pricing?.total({ useNetPrice: false }).amount;
|
|
68
|
+
let convertedAmount: number;
|
|
69
|
+
if (order.currency === currency) {
|
|
70
|
+
convertedAmount = amount / 10 ** (decimals - 8); // All crypto native prices denoted with 8 decimals
|
|
71
|
+
} else {
|
|
72
|
+
// Need to convert
|
|
73
|
+
const rate = await resolvedContext.modules.products.prices.rates.getRate(
|
|
74
|
+
order.currency,
|
|
75
|
+
contract && contract !== '' ? contract : currency, // Convert to the smart contract if given
|
|
76
|
+
MAX_RATE_AGE,
|
|
77
|
+
);
|
|
78
|
+
if (rate) {
|
|
79
|
+
// We assume that we are converting to a fiat currency here (with 2 decimals).
|
|
80
|
+
// Paying an order with prices in crypto in another crypto is not supported.
|
|
81
|
+
convertedAmount = Math.round((amount / 10 ** decimals) * rate * 100);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (convertedAmount && convertedAmount >= totalAmount * (1 - MAX_ALLOWED_DIFF)) {
|
|
85
|
+
await resolvedContext.modules.orders.checkout(
|
|
86
|
+
order._id,
|
|
87
|
+
{
|
|
88
|
+
transactionContext: { address },
|
|
89
|
+
paymentContext: { address },
|
|
90
|
+
},
|
|
91
|
+
resolvedContext,
|
|
92
|
+
);
|
|
93
|
+
response.end(JSON.stringify({ success: true }));
|
|
94
|
+
} else {
|
|
95
|
+
logger.warn(
|
|
96
|
+
`Cryptopay Plugin: OrderPayment ${orderPayment._id} not marked as paid. Converted amount is ${convertedAmount}`,
|
|
97
|
+
);
|
|
98
|
+
response.end(JSON.stringify({ success: false }));
|
|
81
99
|
}
|
|
82
|
-
}
|
|
83
|
-
if (convertedAmount && convertedAmount >= totalAmount * (1 - MAX_ALLOWED_DIFF)) {
|
|
84
|
-
await resolvedContext.modules.orders.checkout(
|
|
85
|
-
order._id,
|
|
86
|
-
{
|
|
87
|
-
transactionContext: { address },
|
|
88
|
-
paymentContext: { address },
|
|
89
|
-
},
|
|
90
|
-
resolvedContext,
|
|
91
|
-
);
|
|
92
|
-
response.end(JSON.stringify({ success: true }));
|
|
93
100
|
} else {
|
|
94
|
-
logger.
|
|
95
|
-
`Cryptopay Plugin:
|
|
101
|
+
logger.info(
|
|
102
|
+
`Cryptopay Plugin: No orderPayment with address ${address} and currency ${currency} found`,
|
|
96
103
|
);
|
|
97
104
|
response.end(JSON.stringify({ success: false }));
|
|
98
105
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
`Cryptopay Plugin: No orderPayment with address ${address} and currency ${currency} found`,
|
|
102
|
-
);
|
|
103
|
-
response.end(JSON.stringify({ success: false }));
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
106
108
|
|
|
107
109
|
const Cryptopay: IPaymentAdapter = {
|
|
108
110
|
...PaymentAdapter,
|
|
@@ -10,12 +10,14 @@ import type {
|
|
|
10
10
|
StatusResponseSuccess,
|
|
11
11
|
ValidateResponseSuccess,
|
|
12
12
|
} from './api/types';
|
|
13
|
-
import './middleware';
|
|
13
|
+
import setupDatatrans from './middleware';
|
|
14
14
|
import parseRegistrationData from './parseRegistrationData';
|
|
15
15
|
import roundedAmountFromOrder from './roundedAmountFromOrder';
|
|
16
16
|
|
|
17
17
|
const logger = createLogger('unchained:core-payment:datatrans');
|
|
18
18
|
|
|
19
|
+
export default setupDatatrans;
|
|
20
|
+
|
|
19
21
|
// v2
|
|
20
22
|
const { DATATRANS_SECRET, DATATRANS_SIGN_KEY, DATATRANS_API_ENDPOINT, DATATRANS_MERCHANT_ID } =
|
|
21
23
|
process.env;
|
|
@@ -17,131 +17,137 @@ const logger = createLogger('unchained:core-payment:datatrans');
|
|
|
17
17
|
|
|
18
18
|
const { postUrl, cancelUrl, errorUrl, successUrl, returnUrl } = getPaths(true);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
useMiddlewareWithCurrentContext(
|
|
30
|
-
|
|
31
|
-
useMiddlewareWithCurrentContext(
|
|
32
|
-
|
|
33
|
-
useMiddlewareWithCurrentContext(
|
|
34
|
-
|
|
35
|
-
useMiddlewareWithCurrentContext(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
20
|
+
export default (app) => {
|
|
21
|
+
useMiddlewareWithCurrentContext(
|
|
22
|
+
app,
|
|
23
|
+
postUrl,
|
|
24
|
+
bodyParser.text({
|
|
25
|
+
type: 'application/json',
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
useMiddlewareWithCurrentContext(app, cancelUrl, bodyParser.urlencoded({ extended: false }));
|
|
30
|
+
|
|
31
|
+
useMiddlewareWithCurrentContext(app, errorUrl, bodyParser.urlencoded({ extended: false }));
|
|
32
|
+
|
|
33
|
+
useMiddlewareWithCurrentContext(app, successUrl, bodyParser.urlencoded({ extended: false }));
|
|
34
|
+
|
|
35
|
+
useMiddlewareWithCurrentContext(app, returnUrl, bodyParser.urlencoded({ extended: false }));
|
|
36
|
+
|
|
37
|
+
useMiddlewareWithCurrentContext(app, postUrl, async (req, res) => {
|
|
38
|
+
const resolvedContext = req.unchainedContext as Context;
|
|
39
|
+
const { services, modules } = resolvedContext;
|
|
40
|
+
const signature = req.headers['datatrans-signature'];
|
|
41
|
+
if (req.method === 'POST' && signature) {
|
|
42
|
+
const [rawTimestamp, rawHash] = signature.split(',');
|
|
43
|
+
const [, hash] = rawHash.split('=');
|
|
44
|
+
const [, timestamp] = rawTimestamp.split('=');
|
|
45
|
+
|
|
46
|
+
const comparableSignature = generateSignature({
|
|
47
|
+
security: DATATRANS_SECURITY,
|
|
48
|
+
signKey: DATATRANS_SIGN2_KEY || DATATRANS_SIGN_KEY,
|
|
49
|
+
})(timestamp, req.body);
|
|
50
|
+
|
|
51
|
+
if (hash !== comparableSignature) {
|
|
52
|
+
logger.error(`Datatrans Plugin: Hash mismatch: ${signature} / ${comparableSignature}`, req.body);
|
|
53
|
+
res.writeHead(403);
|
|
54
|
+
res.end('Hash mismatch');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
const transaction: StatusResponseSuccess = JSON.parse(req.body) as StatusResponseSuccess;
|
|
59
|
+
|
|
60
|
+
if (transaction.status === 'authorized') {
|
|
61
|
+
const userId = transaction.refno2;
|
|
62
|
+
const referenceId = Buffer.from(transaction.refno, 'base64').toString('hex');
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
if (transaction.type === 'card_check') {
|
|
66
|
+
const paymentProviderId = referenceId;
|
|
67
|
+
const paymentCredentials = await services.payment.registerPaymentCredentials(
|
|
68
|
+
paymentProviderId,
|
|
69
|
+
{ transactionContext: { transactionId: transaction.transactionId } },
|
|
70
|
+
{ ...resolvedContext, userId },
|
|
71
|
+
);
|
|
72
|
+
logger.info(`Datatrans Webhook: Unchained registered payment credentials for ${userId}`, {
|
|
73
|
+
userId,
|
|
74
|
+
});
|
|
75
|
+
res.writeHead(200);
|
|
76
|
+
res.end(JSON.stringify(paymentCredentials));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (transaction.type === 'payment') {
|
|
80
|
+
const orderPaymentId = referenceId;
|
|
81
|
+
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
82
|
+
orderPaymentId,
|
|
83
|
+
});
|
|
84
|
+
if (!orderPayment) throw new Error(`Order Payment with id ${orderPaymentId} not found`);
|
|
85
|
+
|
|
86
|
+
const order = await modules.orders.checkout(
|
|
87
|
+
orderPayment.orderId,
|
|
88
|
+
{ paymentContext: { transactionId: transaction.transactionId } },
|
|
89
|
+
{ ...resolvedContext, userId },
|
|
90
|
+
);
|
|
91
|
+
res.writeHead(200);
|
|
92
|
+
logger.info(
|
|
93
|
+
`Datatrans Webhook: Unchained confirmed checkout for order ${order.orderNumber}`,
|
|
94
|
+
{
|
|
95
|
+
orderId: order._id,
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
res.end(JSON.stringify(order));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
logger.error(`Datatrans Webhook: Unchained rejected to checkout with message`, e);
|
|
103
|
+
res.writeHead(500);
|
|
104
|
+
res.end(JSON.stringify(e));
|
|
75
105
|
return;
|
|
76
106
|
}
|
|
77
|
-
if (transaction.type === 'payment') {
|
|
78
|
-
const orderPaymentId = referenceId;
|
|
79
|
-
const orderPayment = await modules.orders.payments.findOrderPayment({
|
|
80
|
-
orderPaymentId,
|
|
81
|
-
});
|
|
82
|
-
if (!orderPayment) throw new Error(`Order Payment with id ${orderPaymentId} not found`);
|
|
83
|
-
|
|
84
|
-
const order = await modules.orders.checkout(
|
|
85
|
-
orderPayment.orderId,
|
|
86
|
-
{ paymentContext: { transactionId: transaction.transactionId } },
|
|
87
|
-
resolvedContext,
|
|
88
|
-
);
|
|
89
|
-
res.writeHead(200);
|
|
90
|
-
logger.info(`Datatrans Webhook: Unchained confirmed checkout for order ${order.orderNumber}`, {
|
|
91
|
-
orderId: order._id,
|
|
92
|
-
});
|
|
93
|
-
res.end(JSON.stringify(order));
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
} catch (e) {
|
|
97
|
-
logger.error(`Datatrans Webhook: Unchained rejected to checkout with message`, e);
|
|
98
|
-
res.writeHead(500);
|
|
99
|
-
res.end(JSON.stringify(e));
|
|
100
|
-
return;
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
109
|
+
res.writeHead(404);
|
|
110
|
+
res.end();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
useMiddlewareWithCurrentContext(app, successUrl, async (req, res) => {
|
|
114
|
+
if (req.method === 'GET') {
|
|
115
|
+
const { datatransTrxId } = req.query;
|
|
116
|
+
res.end(`Payment successful\nTransaction ID: ${datatransTrxId}`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
res.writeHead(404);
|
|
120
|
+
res.end();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
useMiddlewareWithCurrentContext(app, errorUrl, async (req, res) => {
|
|
124
|
+
if (req.method === 'GET') {
|
|
125
|
+
const { datatransTrxId } = req.query;
|
|
126
|
+
res.end(`Payment error\nTransaction ID: ${datatransTrxId}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
res.writeHead(404);
|
|
130
|
+
res.end();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
useMiddlewareWithCurrentContext(app, cancelUrl, async (req, res) => {
|
|
134
|
+
if (req.method === 'GET') {
|
|
135
|
+
const { datatransTrxId } = req.query;
|
|
136
|
+
res.end(`Payment cancelled\nTransaction ID: ${datatransTrxId}`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
res.writeHead(404);
|
|
140
|
+
res.end();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
useMiddlewareWithCurrentContext(app, returnUrl, async (req, res) => {
|
|
144
|
+
if (req.method === 'GET') {
|
|
145
|
+
const { datatransTrxId } = req.query;
|
|
146
|
+
res.end(
|
|
147
|
+
`Secure Fields Payment authenticated\nTransaction ID: ${datatransTrxId}\nNeeds authorization`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
res.writeHead(404);
|
|
151
|
+
res.end();
|
|
152
|
+
});
|
|
153
|
+
};
|
|
@@ -2,7 +2,7 @@ import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
|
2
2
|
import { PaymentDirector, PaymentAdapter, PaymentError } from '@unchainedshop/core-payment';
|
|
3
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import checkoutNodeJssdk from '@paypal/checkout-server-sdk'; // eslint-disable-line
|
|
6
6
|
|
|
7
7
|
const logger = createLogger('unchained:core-payment');
|
|
8
8
|
|
|
@@ -17,9 +17,11 @@ import {
|
|
|
17
17
|
voidTransaction,
|
|
18
18
|
} from './api';
|
|
19
19
|
import { orderIsPaid } from './utils';
|
|
20
|
-
import './middleware';
|
|
20
|
+
import setupPostfinance from './middleware';
|
|
21
21
|
import { CompletionModes, IntegrationModes, SignResponse } from './types';
|
|
22
22
|
|
|
23
|
+
export default setupPostfinance;
|
|
24
|
+
|
|
23
25
|
const {
|
|
24
26
|
PFCHECKOUT_SPACE_ID,
|
|
25
27
|
PFCHECKOUT_USER_ID,
|
|
@@ -5,50 +5,52 @@ import { createLogger } from '@unchainedshop/logger';
|
|
|
5
5
|
import { WebhookData } from './types';
|
|
6
6
|
import { getTransaction, getTransactionCompletion } from './api';
|
|
7
7
|
|
|
8
|
-
const { PFCHECKOUT_WEBHOOK_PATH = '/
|
|
8
|
+
const { PFCHECKOUT_WEBHOOK_PATH = '/payment/postfinance-checkout' } = process.env;
|
|
9
9
|
|
|
10
10
|
const logger = createLogger('unchained:core-payment:postfinance-checkout');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export default (app) => {
|
|
13
|
+
useMiddlewareWithCurrentContext(app, PFCHECKOUT_WEBHOOK_PATH, bodyParser.json());
|
|
13
14
|
|
|
14
|
-
useMiddlewareWithCurrentContext(PFCHECKOUT_WEBHOOK_PATH, async (req, res) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
useMiddlewareWithCurrentContext(app, PFCHECKOUT_WEBHOOK_PATH, async (req, res) => {
|
|
16
|
+
const context = req.unchainedContext as Context;
|
|
17
|
+
const data = req.body as WebhookData;
|
|
18
|
+
if (data.listenerEntityTechnicalName === 'TransactionCompletion') {
|
|
19
|
+
try {
|
|
20
|
+
const transactionCompletion = await getTransactionCompletion(data.entityId as unknown as string);
|
|
21
|
+
const transaction = await getTransaction(
|
|
22
|
+
transactionCompletion.linkedTransaction as unknown as string,
|
|
23
|
+
);
|
|
24
|
+
const { orderPaymentId } = transaction.metaData as { orderPaymentId: string };
|
|
25
|
+
const orderPayment = await context.modules.orders.payments.findOrderPayment({
|
|
26
|
+
orderPaymentId,
|
|
27
|
+
});
|
|
28
|
+
if (!orderPayment) throw new Error('Order Payment not found');
|
|
29
|
+
const order = await context.modules.orders.checkout(
|
|
30
|
+
orderPayment.orderId,
|
|
31
|
+
{
|
|
32
|
+
paymentContext: {
|
|
33
|
+
transactionId: transactionCompletion.linkedTransaction,
|
|
34
|
+
},
|
|
33
35
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
context,
|
|
37
|
+
);
|
|
38
|
+
logger.info(
|
|
39
|
+
`PostFinance Checkout Webhook: Transaction ${transactionCompletion.linkedTransaction} marked order payment ID ${transaction.metaData.orderPaymentId} as paid`,
|
|
40
|
+
);
|
|
41
|
+
res.writeHead(200);
|
|
42
|
+
res.end(`Order marked as paid: ${order.orderNumber}`);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
logger.error(`PostFinance Checkout Webhook: Unchained rejected to checkout with message`, e);
|
|
45
|
+
res.writeHead(500);
|
|
46
|
+
res.end(JSON.stringify(e));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
logger.error(
|
|
50
|
+
`PostFinance Checkout Webhook: Received unknown listenerEntityTechnicalName ${data.listenerEntityTechnicalName}`,
|
|
39
51
|
);
|
|
40
|
-
res.writeHead(
|
|
41
|
-
res.end(
|
|
42
|
-
} catch (e) {
|
|
43
|
-
logger.error(`PostFinance Checkout Webhook: Unchained rejected to checkout with message`, e);
|
|
44
|
-
res.writeHead(500);
|
|
45
|
-
res.end(JSON.stringify(e));
|
|
52
|
+
res.writeHead(404);
|
|
53
|
+
res.end();
|
|
46
54
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
`PostFinance Checkout Webhook: Received unknown listenerEntityTechnicalName ${data.listenerEntityTechnicalName}`,
|
|
50
|
-
);
|
|
51
|
-
res.writeHead(404);
|
|
52
|
-
res.end();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
+
});
|
|
56
|
+
};
|