@unchainedshop/plugins 2.0.0-rc.3 → 2.0.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/jest.config.js +12 -0
- package/lib/delivery/pick-mup.js +1 -1
- package/lib/delivery/pick-mup.js.map +1 -1
- package/lib/enrollments/licensed.d.ts +4 -1
- package/lib/enrollments/licensed.js +1 -1
- package/lib/enrollments/licensed.js.map +1 -1
- package/lib/files/gridfs/gridfs-adapter.d.ts +1 -1
- package/lib/files/gridfs/gridfs-adapter.js +1 -1
- package/lib/files/gridfs/gridfs-adapter.js.map +1 -1
- package/lib/files/gridfs/gridfs-webhook.js +1 -1
- package/lib/files/gridfs/gridfs-webhook.js.map +1 -1
- package/lib/files/gridfs/index.js +12 -3
- package/lib/files/gridfs/index.js.map +1 -1
- package/lib/files/minio/minio-adapter.d.ts +1 -1
- package/lib/files/minio/minio-adapter.js +1 -1
- package/lib/files/minio/minio-adapter.js.map +1 -1
- package/lib/filters/local-search.d.ts +1 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
- package/lib/payment/apple-iap/index.d.ts +2 -2
- package/lib/payment/apple-iap/index.js +2 -2
- package/lib/payment/apple-iap/index.js.map +1 -1
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +2 -2
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +1 -1
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +1 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
- package/lib/payment/cryptopay/index.d.ts +3 -3
- package/lib/payment/cryptopay/index.js +3 -3
- package/lib/payment/cryptopay/index.js.map +1 -1
- package/lib/payment/cryptopay/module/configureCryptopayModule.d.ts +2 -2
- package/lib/payment/cryptopay/module/configureCryptopayModule.js +1 -1
- package/lib/payment/cryptopay/module/configureCryptopayModule.js.map +1 -1
- package/lib/payment/cryptopay/plugin.d.ts +1 -1
- package/lib/payment/cryptopay/plugin.js +1 -1
- package/lib/payment/cryptopay/plugin.js.map +1 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +8 -8
- package/lib/payment/datatrans-v2/api/index.js +9 -9
- package/lib/payment/datatrans-v2/api/index.js.map +1 -1
- package/lib/payment/datatrans-v2/api/init.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/init.js +1 -1
- package/lib/payment/datatrans-v2/api/init.js.map +1 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/secureFields.js +1 -1
- package/lib/payment/datatrans-v2/api/secureFields.js.map +1 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts +1 -1
- package/lib/payment/datatrans-v2/index.d.ts +1 -1
- package/lib/payment/datatrans-v2/index.js +4 -4
- package/lib/payment/datatrans-v2/index.js.map +1 -1
- package/lib/payment/datatrans-v2/middleware.js +1 -1
- package/lib/payment/datatrans-v2/middleware.js.map +1 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -4
- package/lib/payment/datatrans-v2/parseRegistrationData.js +1 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +1 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +2 -2
- package/lib/payment/postfinance-checkout/index.d.ts +1 -1
- package/lib/payment/postfinance-checkout/index.js +4 -4
- package/lib/payment/postfinance-checkout/index.js.map +1 -1
- package/lib/payment/postfinance-checkout/middleware.js +1 -1
- package/lib/payment/postfinance-checkout/middleware.js.map +1 -1
- package/lib/payment/postfinance-checkout/types.js +2 -2
- package/lib/payment/postfinance-checkout/types.js.map +1 -1
- package/lib/payment/postfinance-checkout/utils.d.ts +1 -1
- package/lib/payment/worldline-saferpay/index.js +1 -1
- package/lib/payment/worldline-saferpay/index.js.map +1 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.d.ts +4 -4
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js +1 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js.map +1 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.d.ts +4 -4
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js +1 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js.map +1 -1
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.d.ts +4 -4
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.d.ts +4 -4
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.d.ts +2 -2
- package/lib/plugins-index.d.ts +43 -42
- package/lib/plugins-index.js +51 -50
- package/lib/plugins-index.js.map +1 -1
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -1
- package/lib/pricing/discount-100-off.d.ts +2 -1
- package/lib/pricing/discount-100-off.js +1 -1
- package/lib/pricing/discount-100-off.js.map +1 -1
- package/lib/pricing/discount-half-price-manual.d.ts +2 -1
- package/lib/pricing/discount-half-price-manual.js +1 -1
- package/lib/pricing/discount-half-price-manual.js.map +1 -1
- package/lib/pricing/discount-half-price.d.ts +2 -1
- package/lib/pricing/discount-half-price.js +1 -1
- package/lib/pricing/discount-half-price.js.map +1 -1
- package/lib/pricing/free-delivery.d.ts +1 -1
- package/lib/pricing/free-payment.d.ts +1 -1
- package/lib/pricing/order-delivery.d.ts +2 -1
- package/lib/pricing/order-delivery.js +1 -1
- package/lib/pricing/order-delivery.js.map +1 -1
- package/lib/pricing/order-discount.d.ts +10 -1
- package/lib/pricing/order-discount.js +6 -5
- package/lib/pricing/order-discount.js.map +1 -1
- package/lib/pricing/order-items-discount.js +5 -1
- package/lib/pricing/order-items-discount.js.map +1 -1
- package/lib/pricing/product-catalog-price.d.ts +2 -1
- package/lib/pricing/product-catalog-price.js +1 -1
- package/lib/pricing/product-catalog-price.js.map +1 -1
- package/lib/pricing/product-discount.d.ts +2 -1
- package/lib/pricing/product-discount.js +3 -3
- package/lib/pricing/product-discount.js.map +1 -1
- package/lib/pricing/product-price-rateconversion.d.ts +2 -1
- package/lib/pricing/product-price-rateconversion.js +1 -1
- package/lib/pricing/product-price-rateconversion.js.map +1 -1
- package/lib/pricing/product-price-round.d.ts +3 -1
- package/lib/pricing/product-price-round.js +3 -3
- package/lib/pricing/product-price-round.js.map +1 -1
- package/lib/pricing/product-swiss-tax.d.ts +8 -0
- package/lib/pricing/product-swiss-tax.js +3 -3
- package/lib/pricing/product-swiss-tax.js.map +1 -1
- package/lib/warehousing/eth-minter.js +1 -1
- package/lib/warehousing/eth-minter.js.map +1 -1
- package/lib/warehousing/google-sheets.d.ts +1 -1
- package/lib/warehousing/google-sheets.js +1 -1
- package/lib/warehousing/google-sheets.js.map +1 -1
- package/lib/worker/bulk-import.d.ts +1 -1
- package/lib/worker/email.d.ts +1 -1
- package/lib/worker/email.js +1 -1
- package/lib/worker/email.js.map +1 -1
- package/lib/worker/export-token.d.ts +2 -2
- package/lib/worker/external.d.ts +1 -1
- package/lib/worker/http-request.d.ts +1 -1
- package/lib/worker/message.d.ts +1 -1
- package/lib/worker/push-notification.d.ts +1 -0
- package/lib/worker/push-notification.js +73 -0
- package/lib/worker/push-notification.js.map +1 -0
- package/lib/worker/update-token-ownership.d.ts +2 -2
- package/lib/worker/zombie-killer.d.ts +1 -1
- package/package.json +22 -22
- package/src/delivery/pick-mup.ts +1 -1
- package/src/delivery/post.ts +1 -1
- package/src/delivery/send-message.ts +1 -1
- package/src/delivery/stores.ts +1 -1
- package/src/enrollments/licensed.ts +2 -2
- package/src/events/node-event-emitter.ts +1 -1
- package/src/events/redis.ts +1 -1
- package/src/files/gridfs/gridfs-adapter.ts +2 -2
- package/src/files/gridfs/gridfs-webhook.ts +1 -1
- package/src/files/gridfs/index.ts +14 -3
- package/src/files/minio/minio-adapter.ts +2 -2
- package/src/filters/local-search.ts +2 -2
- package/src/filters/strict-equal.ts +1 -1
- package/src/payment/apple-iap/adapter.ts +4 -4
- package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
- package/src/payment/apple-iap/index.ts +2 -2
- package/src/payment/apple-iap/module/configureAppleTransactionsModule.ts +2 -2
- package/src/payment/braintree.ts +1 -1
- package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
- package/src/payment/cryptopay/index.ts +3 -3
- package/src/payment/cryptopay/middleware.ts +4 -4
- package/src/payment/cryptopay/module/configureCryptopayModule.ts +2 -2
- package/src/payment/cryptopay/plugin.ts +4 -4
- package/src/payment/datatrans-v2/api/authorize.ts +1 -1
- package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +1 -1
- package/src/payment/datatrans-v2/api/cancel.ts +1 -1
- package/src/payment/datatrans-v2/api/index.ts +9 -9
- package/src/payment/datatrans-v2/api/init.ts +2 -2
- package/src/payment/datatrans-v2/api/secureFields.ts +2 -2
- package/src/payment/datatrans-v2/api/settle.ts +1 -1
- package/src/payment/datatrans-v2/api/status.ts +1 -1
- package/src/payment/datatrans-v2/api/validate.ts +1 -1
- package/src/payment/datatrans-v2/index.ts +6 -6
- package/src/payment/datatrans-v2/middleware.ts +3 -3
- package/src/payment/datatrans-v2/parseRegistrationData.ts +2 -2
- package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +2 -2
- package/src/payment/invoice-prepaid.ts +1 -1
- package/src/payment/invoice.ts +1 -1
- package/src/payment/paypal-checkout.ts +1 -1
- package/src/payment/postfinance-checkout/index.ts +5 -5
- package/src/payment/postfinance-checkout/middleware.ts +3 -3
- package/src/payment/postfinance-checkout/utils.ts +1 -1
- package/src/payment/stripe.ts +2 -2
- package/src/payment/worldline-saferpay/index.ts +2 -2
- package/src/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.ts +5 -5
- package/src/payment/worldline-saferpay/worldline-saferpay-client/index.ts +4 -4
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.ts +4 -4
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.ts +4 -4
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.ts +2 -2
- package/src/plugins-index.ts +52 -51
- package/src/pricing/apply-rate.test.ts +92 -0
- package/src/pricing/configureProductPriceRounding.test.ts +44 -0
- package/src/pricing/delivery-swiss-tax.ts +1 -1
- package/src/pricing/discount-100-off.test.ts +31 -0
- package/src/pricing/discount-100-off.ts +2 -2
- package/src/pricing/discount-half-price-manual.test.ts +42 -0
- package/src/pricing/discount-half-price-manual.ts +2 -2
- package/src/pricing/discount-half-price.test.ts +40 -0
- package/src/pricing/discount-half-price.ts +2 -2
- package/src/pricing/free-delivery.test.ts +12 -0
- package/src/pricing/free-delivery.ts +1 -1
- package/src/pricing/free-payment.ts +1 -1
- package/src/pricing/getTaxRate.test.ts +69 -0
- package/src/pricing/licenced-enrollment.test.ts +37 -0
- package/src/pricing/order-delivery.test.ts +9 -0
- package/src/pricing/order-delivery.ts +2 -2
- package/src/pricing/order-discount.test.ts +206 -0
- package/src/pricing/order-discount.ts +7 -5
- package/src/pricing/order-items-discount.ts +5 -2
- package/src/pricing/order-items.ts +1 -1
- package/src/pricing/order-payment.ts +1 -1
- package/{tests/plugins-index.test.js → src/pricing/plugins-index.test.ts} +0 -0
- package/src/pricing/product-catalog-price.ts +2 -2
- package/src/pricing/product-discount.ts +4 -4
- package/src/pricing/product-price-rateconversion.ts +2 -2
- package/src/pricing/product-price-round.ts +5 -5
- package/src/pricing/product-swiss-tax.test.ts +141 -0
- package/src/pricing/product-swiss-tax.ts +4 -4
- package/src/pricing/roundToNext.test.ts +24 -0
- package/src/quotations/manual.ts +1 -1
- package/src/warehousing/eth-minter.ts +2 -2
- package/src/warehousing/google-sheets.ts +2 -2
- package/src/warehousing/store.ts +1 -1
- package/src/worker/bulk-import.ts +2 -2
- package/src/worker/email.ts +2 -2
- package/src/worker/enrollment-order-generator.ts +5 -5
- package/src/worker/export-token.ts +2 -2
- package/src/worker/external.ts +1 -1
- package/src/worker/heartbeat.ts +1 -1
- package/src/worker/http-request.ts +1 -1
- package/src/worker/message.ts +1 -1
- package/src/worker/push-notification.ts +106 -0
- package/src/worker/sms.ts +1 -1
- package/src/worker/update-coinbase-rates.ts +2 -2
- package/src/worker/update-ecb-rates.ts +2 -2
- package/src/worker/update-token-ownership.ts +2 -2
- package/src/worker/zombie-killer.ts +1 -1
- package/tsconfig.json +3 -25
- 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/src/pricing/utils/cache.js +0 -32
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { WorkerDirector, WorkerAdapter } from '@unchainedshop/core-worker';
|
|
2
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
3
|
+
import webPush from 'web-push';
|
|
4
|
+
const { PUSH_NOTIFICATION_PUBLIC_KEY, PUSH_NOTIFICATION_PRIVATE_KEY } = process.env;
|
|
5
|
+
const logger = createLogger('unchained:plugins:worker:push-notification');
|
|
6
|
+
const PushNotificationWorkerPlugin = {
|
|
7
|
+
...WorkerAdapter,
|
|
8
|
+
key: 'shop.unchained.worker-plugin.push-notification',
|
|
9
|
+
label: 'Push Notification',
|
|
10
|
+
version: '1.0',
|
|
11
|
+
type: 'PUSH',
|
|
12
|
+
doWork: async ({ subscription, subject, payload, urgency = null, topic = null }) => {
|
|
13
|
+
logger.debug(`${PushNotificationWorkerPlugin.key} -> doWork: Push -> ${subject}`);
|
|
14
|
+
if (!PUSH_NOTIFICATION_PUBLIC_KEY)
|
|
15
|
+
return {
|
|
16
|
+
success: false,
|
|
17
|
+
error: {
|
|
18
|
+
name: 'VAPID_PUBLIC_KEY_REQUIRED',
|
|
19
|
+
message: 'vapidPublicKey key required to send push notifications',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
if (!PUSH_NOTIFICATION_PRIVATE_KEY)
|
|
23
|
+
return {
|
|
24
|
+
success: false,
|
|
25
|
+
error: {
|
|
26
|
+
name: 'VAPID_PRIVATE_KEY_REQUIRED',
|
|
27
|
+
message: 'vapidPrivateKey key are required to send push notifications',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
if (!subscription) {
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
error: {
|
|
34
|
+
name: 'USER_SUBSCRIPTION_OBJECT_REQUIRED',
|
|
35
|
+
message: 'PUSH service subscription required',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const options = {
|
|
40
|
+
vapidDetails: {
|
|
41
|
+
subject,
|
|
42
|
+
publicKey: PUSH_NOTIFICATION_PUBLIC_KEY,
|
|
43
|
+
privateKey: PUSH_NOTIFICATION_PRIVATE_KEY,
|
|
44
|
+
},
|
|
45
|
+
TTL: 60,
|
|
46
|
+
};
|
|
47
|
+
if (urgency) {
|
|
48
|
+
options.urgency = urgency;
|
|
49
|
+
}
|
|
50
|
+
if (topic) {
|
|
51
|
+
options.topic = topic;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
await webPush.sendNotification(subscription, payload, options);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
error: null,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
error: {
|
|
64
|
+
name: err.name,
|
|
65
|
+
message: err.message,
|
|
66
|
+
stack: err.stack,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
WorkerDirector.registerAdapter(PushNotificationWorkerPlugin);
|
|
73
|
+
//# sourceMappingURL=push-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-notification.js","sourceRoot":"","sources":["../../src/worker/push-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,MAAM,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEpF,MAAM,MAAM,GAAG,YAAY,CAAC,4CAA4C,CAAC,CAAC;AAa1E,MAAM,4BAA4B,GAS9B;IACF,GAAG,aAAa;IAEhB,GAAG,EAAE,gDAAgD;IACrD,KAAK,EAAE,mBAAmB;IAE1B,OAAO,EAAE,KAAK;IAEd,IAAI,EAAE,MAAM;IAEZ,MAAM,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,EAAE,EAAE;QACjF,MAAM,CAAC,KAAK,CAAC,GAAG,4BAA4B,CAAC,GAAG,uBAAuB,OAAO,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,4BAA4B;YAC/B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,2BAA2B;oBACjC,OAAO,EAAE,wDAAwD;iBAClE;aACF,CAAC;QACJ,IAAI,CAAC,6BAA6B;YAChC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,4BAA4B;oBAClC,OAAO,EAAE,6DAA6D;iBACvE;aACF,CAAC;QAEJ,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,mCAAmC;oBACzC,OAAO,EAAE,oCAAoC;iBAC9C;aACF,CAAC;SACH;QAED,MAAM,OAAO,GAAwB;YACnC,YAAY,EAAE;gBACZ,OAAO;gBACP,SAAS,EAAE,4BAA4B;gBACvC,UAAU,EAAE,6BAA6B;aAC1C;YACD,GAAG,EAAE,EAAE;SACR,CAAC;QAEF,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;SAC3B;QAED,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;SACvB;QAED,IAAI;YACF,MAAM,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,IAAI;aACZ,CAAC;SACH;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,OAAO,EAAE,GAAG,CAAC,OAAO;oBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;iBACjB;aACF,CAAC;SACH;IACH,CAAC;CACF,CAAC;AAEF,cAAc,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWorkerAdapter } from '@unchainedshop/types/worker';
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
1
|
+
import { IWorkerAdapter } from '@unchainedshop/types/worker.js';
|
|
2
|
+
import { UnchainedCore } from '@unchainedshop/types/core.js';
|
|
3
3
|
export declare const UpdateTokenOwnership: IWorkerAdapter<void, void>;
|
|
4
4
|
export declare const RefreshTokens: IWorkerAdapter<void, any>;
|
|
5
5
|
export declare const configureUpdateTokenOwnership: (unchainedApi: UnchainedCore) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/plugins",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "lib/plugins-index.js",
|
|
5
5
|
"types": "lib/plugins-index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -76,38 +76,38 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/node": "^18.11.18",
|
|
79
|
-
"@unchainedshop/api": "^2.0.0
|
|
80
|
-
"@unchainedshop/
|
|
81
|
-
"@unchainedshop/core-
|
|
82
|
-
"@unchainedshop/core-
|
|
83
|
-
"@unchainedshop/core-
|
|
84
|
-
"@unchainedshop/core-
|
|
85
|
-
"@unchainedshop/core-
|
|
86
|
-
"@unchainedshop/core-
|
|
87
|
-
"@unchainedshop/core-
|
|
88
|
-
"@unchainedshop/core-
|
|
89
|
-
"@unchainedshop/core-
|
|
90
|
-
"@unchainedshop/
|
|
91
|
-
"@unchainedshop/
|
|
92
|
-
"@unchainedshop/
|
|
93
|
-
"@unchainedshop/
|
|
94
|
-
"@unchainedshop/
|
|
95
|
-
"@unchainedshop/utils": "^2.0.0-rc.3",
|
|
79
|
+
"@unchainedshop/api": "^2.0.0",
|
|
80
|
+
"@unchainedshop/core-delivery": "^2.0.0",
|
|
81
|
+
"@unchainedshop/core-enrollments": "^2.0.0",
|
|
82
|
+
"@unchainedshop/core-filters": "^2.0.0",
|
|
83
|
+
"@unchainedshop/core-messaging": "^2.0.0",
|
|
84
|
+
"@unchainedshop/core-orders": "^2.0.0",
|
|
85
|
+
"@unchainedshop/core-payment": "^2.0.0",
|
|
86
|
+
"@unchainedshop/core-products": "^2.0.0",
|
|
87
|
+
"@unchainedshop/core-quotations": "^2.0.0",
|
|
88
|
+
"@unchainedshop/core-warehousing": "^2.0.0",
|
|
89
|
+
"@unchainedshop/core-worker": "^2.0.0",
|
|
90
|
+
"@unchainedshop/events": "^2.0.0",
|
|
91
|
+
"@unchainedshop/file-upload": "^2.0.0",
|
|
92
|
+
"@unchainedshop/logger": "^2.0.0",
|
|
93
|
+
"@unchainedshop/types": "^2.0.0",
|
|
94
|
+
"@unchainedshop/utils": "^2.0.0",
|
|
96
95
|
"bluebird": "^3.7.2",
|
|
97
96
|
"event-iterator": "^2.0.0",
|
|
98
97
|
"express": "^4.18.2",
|
|
99
|
-
"jest": "^29.
|
|
98
|
+
"jest": "^29.4.1",
|
|
100
99
|
"JSONStream": "^1.3.5",
|
|
101
100
|
"minio": "^7.0.32",
|
|
102
101
|
"mongodb": "^4.13.0",
|
|
103
102
|
"node-sheets": "^1.2.0",
|
|
104
|
-
"nodemailer": "^6.
|
|
103
|
+
"nodemailer": "^6.9.1",
|
|
105
104
|
"open": "^8.4.0",
|
|
106
|
-
"redis": "^4.
|
|
105
|
+
"redis": "^4.6.3",
|
|
107
106
|
"request": "^2.88.2",
|
|
108
107
|
"stripe": "^10.17.0",
|
|
109
|
-
"ts-jest": "^29.0.
|
|
108
|
+
"ts-jest": "^29.0.5",
|
|
110
109
|
"typescript": "^4.9.4",
|
|
110
|
+
"web-push": "^3.5.0",
|
|
111
111
|
"xml-js": "^1.6.11",
|
|
112
112
|
"xml2js": "0.4.23"
|
|
113
113
|
}
|
package/src/delivery/pick-mup.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
import { DeliveryProviderType, IDeliveryAdapter } from '@unchainedshop/types/delivery';
|
|
2
|
+
import { DeliveryProviderType, IDeliveryAdapter } from '@unchainedshop/types/delivery.js';
|
|
3
3
|
import { DeliveryAdapter, DeliveryDirector, DeliveryError } from '@unchainedshop/core-delivery';
|
|
4
4
|
|
|
5
5
|
const fetchPickMupLocations = async (key: string, idsFilter?: string) => {
|
package/src/delivery/post.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDeliveryAdapter } from '@unchainedshop/types/delivery';
|
|
1
|
+
import { IDeliveryAdapter } from '@unchainedshop/types/delivery.js';
|
|
2
2
|
import { DeliveryAdapter, DeliveryDirector, DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
3
|
|
|
4
4
|
const Post: IDeliveryAdapter = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDeliveryAdapter } from '@unchainedshop/types/delivery';
|
|
1
|
+
import { IDeliveryAdapter } from '@unchainedshop/types/delivery.js';
|
|
2
2
|
import { DeliveryAdapter, DeliveryDirector, DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
3
|
|
|
4
4
|
const SendMessage: IDeliveryAdapter = {
|
package/src/delivery/stores.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDeliveryAdapter } from '@unchainedshop/types/delivery';
|
|
1
|
+
import { IDeliveryAdapter } from '@unchainedshop/types/delivery.js';
|
|
2
2
|
import { DeliveryAdapter, DeliveryDirector, DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
3
|
|
|
4
4
|
const PickMup: IDeliveryAdapter = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IEnrollmentAdapter } from '@unchainedshop/types/enrollments';
|
|
1
|
+
import { IEnrollmentAdapter } from '@unchainedshop/types/enrollments.js';
|
|
2
2
|
import { EnrollmentDirector, EnrollmentAdapter } from '@unchainedshop/core-enrollments';
|
|
3
3
|
|
|
4
|
-
const rangeMatcher = (date = new Date()) => {
|
|
4
|
+
export const rangeMatcher = (date = new Date()) => {
|
|
5
5
|
const timestamp = date.getTime();
|
|
6
6
|
return ({ start, end }) => {
|
|
7
7
|
const startTimestamp = new Date(start).getTime();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { EmitAdapter } from '@unchainedshop/types/events';
|
|
2
|
+
import { EmitAdapter } from '@unchainedshop/types/events.js';
|
|
3
3
|
import { setEmitAdapter } from '@unchainedshop/events';
|
|
4
4
|
|
|
5
5
|
const NodeEventEmitter = (): EmitAdapter => {
|
package/src/events/redis.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import redis from 'redis';
|
|
2
|
-
import { EmitAdapter } from '@unchainedshop/types/events';
|
|
2
|
+
import { EmitAdapter } from '@unchainedshop/types/events.js';
|
|
3
3
|
import { setEmitAdapter } from '@unchainedshop/events';
|
|
4
4
|
|
|
5
5
|
const { REDIS_PORT = 6379, REDIS_HOST = '127.0.0.1' } = process.env;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
import { IFileAdapter, UploadFileData } from '@unchainedshop/types/files';
|
|
2
|
+
import { IFileAdapter, UploadFileData } from '@unchainedshop/types/files.js';
|
|
3
3
|
import { FileAdapter, FileDirector, buildHashedFilename } from '@unchainedshop/file-upload';
|
|
4
4
|
import mimeType from 'mime-types';
|
|
5
5
|
import { URL } from 'url';
|
|
6
6
|
import { Readable, pipeline as rawPipeline } from 'stream';
|
|
7
7
|
import { promisify } from 'util';
|
|
8
8
|
import { ReadableStream } from 'node:stream/web';
|
|
9
|
-
import sign from './sign';
|
|
9
|
+
import sign from './sign.js';
|
|
10
10
|
|
|
11
11
|
const pipeline = promisify(rawPipeline);
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@ import { log, LogLevel } from '@unchainedshop/logger';
|
|
|
2
2
|
import { buildHashedFilename } from '@unchainedshop/file-upload';
|
|
3
3
|
import { pipeline as rawPipeline } from 'stream';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
|
-
import sign from './sign';
|
|
5
|
+
import sign from './sign.js';
|
|
6
6
|
|
|
7
7
|
const pipeline = promisify(rawPipeline);
|
|
8
8
|
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import mongodb from 'mongodb';
|
|
2
2
|
|
|
3
3
|
export const configureGridFSFileUploadModule = ({ db }) => {
|
|
4
|
+
// eslint-disable-next-line
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const isMeteor = typeof Meteor === 'object';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line
|
|
9
|
+
let { GridFSBucket } = mongodb;
|
|
10
|
+
if (isMeteor) {
|
|
11
|
+
const { MongoInternals } = require('meteor/mongo'); // eslint-disable-line
|
|
12
|
+
GridFSBucket = MongoInternals.NpmModule.GridFSBucket;
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
return {
|
|
5
16
|
createWriteStream: async (directoryName, fileId, fileName) => {
|
|
6
17
|
const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
|
|
7
|
-
const bucket = new
|
|
18
|
+
const bucket = new GridFSBucket(db, options);
|
|
8
19
|
return bucket.openUploadStreamWithId(fileId, fileName);
|
|
9
20
|
},
|
|
10
21
|
createReadStream: async (directoryName, fileId) => {
|
|
11
22
|
const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
|
|
12
|
-
const bucket = new
|
|
23
|
+
const bucket = new GridFSBucket(db, options);
|
|
13
24
|
return bucket.openDownloadStream(fileId);
|
|
14
25
|
},
|
|
15
26
|
removeFileFromBucket: async (directoryName, fileId) => {
|
|
16
27
|
const options = { bucketName: `file_uploads_${directoryName}`, chunkSizeBytes: 5 * 1024 * 1024 };
|
|
17
|
-
const bucket = new
|
|
28
|
+
const bucket = new GridFSBucket(db, options);
|
|
18
29
|
return bucket.delete(fileId);
|
|
19
30
|
},
|
|
20
31
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFileAdapter, UploadFileData } from '@unchainedshop/types/files';
|
|
1
|
+
import { IFileAdapter, UploadFileData } from '@unchainedshop/types/files.js';
|
|
2
2
|
import { FileAdapter, FileDirector, buildHashedFilename } from '@unchainedshop/file-upload';
|
|
3
3
|
|
|
4
4
|
import https from 'https';
|
|
@@ -6,7 +6,7 @@ import http, { OutgoingHttpHeaders } from 'http';
|
|
|
6
6
|
import { log, LogLevel } from '@unchainedshop/logger';
|
|
7
7
|
import mimeType from 'mime-types';
|
|
8
8
|
import Minio from 'minio';
|
|
9
|
-
import AssumeRoleProvider from 'minio/dist/main/AssumeRoleProvider';
|
|
9
|
+
import AssumeRoleProvider from 'minio/dist/main/AssumeRoleProvider.js';
|
|
10
10
|
import { Readable } from 'stream';
|
|
11
11
|
import { URL } from 'url';
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FilterDirector, FilterAdapter } from '@unchainedshop/core-filters';
|
|
2
|
-
import { IFilterAdapter } from '@unchainedshop/types/filters';
|
|
3
|
-
import { Query } from '@unchainedshop/types/common';
|
|
2
|
+
import { IFilterAdapter } from '@unchainedshop/types/filters.js';
|
|
3
|
+
import { Query } from '@unchainedshop/types/common.js';
|
|
4
4
|
|
|
5
5
|
const { AMAZON_DOCUMENTDB_COMPAT_MODE } = process.env;
|
|
6
6
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
import { Context } from '@unchainedshop/types/api';
|
|
3
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
2
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
3
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
4
4
|
import { EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
5
5
|
import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
|
|
6
6
|
import { createLogger } from '@unchainedshop/logger';
|
|
7
|
-
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
8
|
-
import { AppleTransactionsModule } from './module/configureAppleTransactionsModule';
|
|
7
|
+
import { UnchainedCore } from '@unchainedshop/types/core.js';
|
|
8
|
+
import { AppleTransactionsModule } from './module/configureAppleTransactionsModule.js';
|
|
9
9
|
|
|
10
10
|
const logger = createLogger('unchained:core-payment:iap');
|
|
11
11
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './adapter';
|
|
2
|
-
export * from './module/configureAppleTransactionsModule';
|
|
1
|
+
export * from './adapter.js';
|
|
2
|
+
export * from './module/configureAppleTransactionsModule.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Db } from '@unchainedshop/types/common';
|
|
2
|
-
import { AppleTransaction, AppleTransactionsCollection } from '../db/AppleTransactionsCollection';
|
|
1
|
+
import { Db } from '@unchainedshop/types/common.js';
|
|
2
|
+
import { AppleTransaction, AppleTransactionsCollection } from '../db/AppleTransactionsCollection.js';
|
|
3
3
|
|
|
4
4
|
export interface AppleTransactionsModule {
|
|
5
5
|
findTransactionById: (transactionIdentifier: string) => Promise<AppleTransaction>;
|
package/src/payment/braintree.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentDirector, PaymentAdapter, PaymentError } from '@unchainedshop/core-payment';
|
|
3
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import CryptopayPlugin from './plugin';
|
|
1
|
+
import CryptopayPlugin from './plugin.js';
|
|
2
2
|
|
|
3
|
-
export * from './middleware';
|
|
4
|
-
export * from './module/configureCryptopayModule';
|
|
3
|
+
export * from './middleware.js';
|
|
4
|
+
export * from './module/configureCryptopayModule.js';
|
|
5
5
|
|
|
6
6
|
export default CryptopayPlugin;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import { Context } from '@unchainedshop/types/api';
|
|
2
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
3
3
|
|
|
4
|
-
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
4
|
+
import { UnchainedCore } from '@unchainedshop/types/core.js';
|
|
5
5
|
import { OrderStatus } from '@unchainedshop/core-orders';
|
|
6
|
-
import { ProductPriceRate } from '@unchainedshop/types/products.pricing';
|
|
7
|
-
import type { CryptopayModule } from './module/configureCryptopayModule';
|
|
6
|
+
import { ProductPriceRate } from '@unchainedshop/types/products.pricing.js';
|
|
7
|
+
import type { CryptopayModule } from './module/configureCryptopayModule.js';
|
|
8
8
|
|
|
9
9
|
const { CRYPTOPAY_SECRET, CRYPTOPAY_MAX_RATE_AGE } = process.env;
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Db } from '@unchainedshop/types/common';
|
|
1
|
+
import { Db } from '@unchainedshop/types/common.js';
|
|
2
2
|
import { Decimal128 } from 'mongodb';
|
|
3
|
-
import { CryptopayTransaction, CryptopayTransactionsCollection } from '../db/CryptopayTransactions';
|
|
3
|
+
import { CryptopayTransaction, CryptopayTransactionsCollection } from '../db/CryptopayTransactions.js';
|
|
4
4
|
|
|
5
5
|
export interface CryptopayModule {
|
|
6
6
|
getWalletAddress: (addressId: string) => Promise<CryptopayTransaction>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
|
-
import BIP32Factory from 'bip32';
|
|
4
|
+
import { BIP32Factory } from 'bip32';
|
|
5
5
|
import * as ecc from 'tiny-secp256k1';
|
|
6
6
|
import * as bitcoin from 'bitcoinjs-lib';
|
|
7
7
|
import { createLogger } from '@unchainedshop/logger';
|
|
8
|
-
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
8
|
+
import { UnchainedCore } from '@unchainedshop/types/core.js';
|
|
9
9
|
import { OrderPricingSheet } from '@unchainedshop/core-orders';
|
|
10
|
-
import { CryptopayModule } from './module/configureCryptopayModule';
|
|
10
|
+
import { CryptopayModule } from './module/configureCryptopayModule.js';
|
|
11
11
|
|
|
12
12
|
const logger = createLogger('unchained:core-payment:cryptopay');
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// https://api-reference.datatrans.ch/#operation/Authorize
|
|
2
2
|
|
|
3
|
-
import type { FetchDatatransFn, AuthorizeRequestPayload, AuthorizeResponse } from './types';
|
|
3
|
+
import type { FetchDatatransFn, AuthorizeRequestPayload, AuthorizeResponse } from './types.js';
|
|
4
4
|
|
|
5
5
|
export default async function authorize({
|
|
6
6
|
...payload
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import makeFetcher from './makeFetcher';
|
|
2
|
-
import status from './status';
|
|
3
|
-
import init from './init';
|
|
4
|
-
import secureFields from './secureFields';
|
|
5
|
-
import authorize from './authorize';
|
|
6
|
-
import validate from './validate';
|
|
7
|
-
import settle from './settle';
|
|
8
|
-
import cancel from './cancel';
|
|
9
|
-
import authorizeAuthenticated from './authorizeAuthenticated';
|
|
1
|
+
import makeFetcher from './makeFetcher.js';
|
|
2
|
+
import status from './status.js';
|
|
3
|
+
import init from './init.js';
|
|
4
|
+
import secureFields from './secureFields.js';
|
|
5
|
+
import authorize from './authorize.js';
|
|
6
|
+
import validate from './validate.js';
|
|
7
|
+
import settle from './settle.js';
|
|
8
|
+
import cancel from './cancel.js';
|
|
9
|
+
import authorizeAuthenticated from './authorizeAuthenticated.js';
|
|
10
10
|
|
|
11
11
|
export default function createDatatransAPI(endpoint: string, merchantId: string, secret: string) {
|
|
12
12
|
const fetchDatatrans = makeFetcher(endpoint, merchantId, secret);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://api-reference.datatrans.ch/#operation/init
|
|
2
|
-
import getPaths from '../getPaths';
|
|
2
|
+
import getPaths from '../getPaths.js';
|
|
3
3
|
|
|
4
|
-
import type { FetchDatatransFn, InitRequestPayload, InitResponse } from './types';
|
|
4
|
+
import type { FetchDatatransFn, InitRequestPayload, InitResponse } from './types.js';
|
|
5
5
|
|
|
6
6
|
const defaultRedirect = getPaths();
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://api-reference.datatrans.ch/#operation/init
|
|
2
|
-
import getPaths from '../getPaths';
|
|
2
|
+
import getPaths from '../getPaths.js';
|
|
3
3
|
|
|
4
|
-
import type { FetchDatatransFn, SecureFieldsRequestPayload, SecureFieldsResponse } from './types';
|
|
4
|
+
import type { FetchDatatransFn, SecureFieldsRequestPayload, SecureFieldsResponse } from './types.js';
|
|
5
5
|
|
|
6
6
|
const defaultRedirect = getPaths();
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FetchDatatransFn, StatusRequestPayload, StatusResponse } from './types';
|
|
1
|
+
import type { FetchDatatransFn, StatusRequestPayload, StatusResponse } from './types.js';
|
|
2
2
|
|
|
3
3
|
export default async function status({ transactionId }: StatusRequestPayload): Promise<StatusResponse> {
|
|
4
4
|
const { fetchDatatrans }: { fetchDatatrans: FetchDatatransFn } = this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FetchDatatransFn, ValidateRequestPayload, ValidateResponse } from './types';
|
|
1
|
+
import type { FetchDatatransFn, ValidateRequestPayload, ValidateResponse } from './types.js';
|
|
2
2
|
|
|
3
3
|
export default async function validate(payload: ValidateRequestPayload): Promise<ValidateResponse> {
|
|
4
4
|
const { fetchDatatrans }: { fetchDatatrans: FetchDatatransFn } = this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentAdapter, PaymentError, PaymentDirector } from '@unchainedshop/core-payment';
|
|
3
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
|
-
import createDatatransAPI from './api';
|
|
4
|
+
import createDatatransAPI from './api/index.js';
|
|
5
5
|
import type {
|
|
6
6
|
AuthorizeAuthenticatedResponseSuccess,
|
|
7
7
|
AuthorizeResponseSuccess,
|
|
@@ -9,11 +9,11 @@ import type {
|
|
|
9
9
|
ResponseError,
|
|
10
10
|
StatusResponseSuccess,
|
|
11
11
|
ValidateResponseSuccess,
|
|
12
|
-
} from './api/types';
|
|
13
|
-
import parseRegistrationData from './parseRegistrationData';
|
|
14
|
-
import roundedAmountFromOrder from './roundedAmountFromOrder';
|
|
12
|
+
} from './api/types.js';
|
|
13
|
+
import parseRegistrationData from './parseRegistrationData.js';
|
|
14
|
+
import roundedAmountFromOrder from './roundedAmountFromOrder.js';
|
|
15
15
|
|
|
16
|
-
export * from './middleware';
|
|
16
|
+
export * from './middleware.js';
|
|
17
17
|
|
|
18
18
|
const logger = createLogger('unchained:core-payment:datatrans');
|
|
19
19
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
import { Context } from '@unchainedshop/types/api';
|
|
3
|
-
import generateSignature, { Security } from './generateSignature';
|
|
2
|
+
import { Context } from '@unchainedshop/types/api.js';
|
|
3
|
+
import generateSignature, { Security } from './generateSignature.js';
|
|
4
4
|
|
|
5
|
-
import type { StatusResponseSuccess } from './api/types';
|
|
5
|
+
import type { StatusResponseSuccess } from './api/types.js';
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
DATATRANS_SIGN_KEY,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import splitProperties from './splitProperties';
|
|
2
|
-
import type { StatusResponseSuccess } from './api/types';
|
|
1
|
+
import splitProperties from './splitProperties.js';
|
|
2
|
+
import type { StatusResponseSuccess } from './api/types.js';
|
|
3
3
|
|
|
4
4
|
export default function parseRegistrationData(transaction: StatusResponseSuccess) {
|
|
5
5
|
const parsed = Object.entries(transaction).reduce((acc, [objectKey, payload]) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
2
|
-
import { Order } from '@unchainedshop/types/orders';
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/types/core.js';
|
|
2
|
+
import { Order } from '@unchainedshop/types/orders.js';
|
|
3
3
|
|
|
4
4
|
const roundedAmountFromOrder = (
|
|
5
5
|
order: Order,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
|
|
3
3
|
|
|
4
4
|
const InvoicePrepaid: IPaymentAdapter = {
|
package/src/payment/invoice.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
|
|
3
3
|
|
|
4
4
|
const Invoice: IPaymentAdapter = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter } from '@unchainedshop/types/payments.js';
|
|
2
2
|
import { PaymentDirector, PaymentAdapter, PaymentError } from '@unchainedshop/core-payment';
|
|
3
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
4
|
|