@unchainedshop/plugins 1.2.11 → 1.2.12
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/lib/delivery/pick-mup.js +1 -2
- package/lib/delivery/pick-mup.js.map +1 -1
- package/lib/delivery/send-message.js +1 -2
- package/lib/delivery/send-message.js.map +1 -1
- package/lib/events/redis.js +3 -2
- package/lib/events/redis.js.map +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/minio/minio-adapter.d.ts +1 -1
- package/lib/files/minio/minio-adapter.js +6 -4
- package/lib/files/minio/minio-adapter.js.map +1 -1
- package/lib/payment/apple-iap/adapter.js.map +1 -1
- package/lib/payment/bity/adapter.js +2 -0
- package/lib/payment/bity/adapter.js.map +1 -1
- package/lib/payment/braintree.js +5 -1
- package/lib/payment/braintree.js.map +1 -1
- package/lib/payment/cryptopay.js.map +1 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +1 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +2 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js +11 -8
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +1 -1
- package/lib/payment/datatrans-v2/index.js +1 -1
- package/lib/payment/datatrans-v2/index.js.map +1 -1
- package/lib/payment/datatrans-v2/middleware.js.map +1 -1
- package/lib/payment/postfinance-checkout/api.d.ts +5 -5
- package/lib/payment/postfinance-checkout/api.js +3 -3
- package/lib/payment/postfinance-checkout/api.js.map +1 -1
- package/lib/payment/postfinance-checkout/index.js +11 -11
- package/lib/payment/postfinance-checkout/index.js.map +1 -1
- package/lib/payment/postfinance-checkout/utils.d.ts +3 -3
- package/lib/payment/postfinance-checkout/utils.js +4 -3
- package/lib/payment/postfinance-checkout/utils.js.map +1 -1
- package/lib/payment/stripe.js +2 -0
- package/lib/payment/stripe.js.map +1 -1
- package/lib/payment/worldline-saferpay/index.js +6 -2
- package/lib/payment/worldline-saferpay/index.js.map +1 -1
- package/lib/plugins-index.d.ts +0 -0
- package/lib/plugins-index.js +1 -0
- package/lib/plugins-index.js.map +1 -0
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -1
- package/lib/pricing/delivery-swiss-tax.js +3 -9
- package/lib/pricing/delivery-swiss-tax.js.map +1 -1
- package/lib/pricing/free-delivery.js +2 -0
- package/lib/pricing/free-delivery.js.map +1 -1
- package/lib/pricing/free-payment.js +2 -0
- package/lib/pricing/free-payment.js.map +1 -1
- package/lib/pricing/order-discount.js +2 -0
- package/lib/pricing/order-discount.js.map +1 -1
- package/lib/pricing/order-items-discount.js +2 -0
- package/lib/pricing/order-items-discount.js.map +1 -1
- package/lib/pricing/product-swiss-tax.d.ts +1 -1
- package/lib/pricing/product-swiss-tax.js +2 -9
- package/lib/pricing/product-swiss-tax.js.map +1 -1
- package/lib/warehousing/store.js +2 -2
- package/lib/warehousing/store.js.map +1 -1
- package/lib/worker/BulkImportWorker.js +9 -9
- package/lib/worker/BulkImportWorker.js.map +1 -1
- package/lib/worker/GenerateOrderWorker.js +2 -2
- package/lib/worker/GenerateOrderWorker.js.map +1 -1
- package/lib/worker/MessageWorker.js +1 -1
- package/lib/worker/MessageWorker.js.map +1 -1
- package/lib/worker/email.js +3 -0
- package/lib/worker/email.js.map +1 -1
- package/package.json +37 -3
- package/readme.md +4 -0
- package/src/delivery/pick-mup.ts +2 -3
- package/src/delivery/send-message.ts +1 -2
- package/src/events/redis.ts +3 -2
- package/src/files/gridfs/gridfs-adapter.ts +6 -6
- package/src/files/gridfs/gridfs-webhook.ts +1 -1
- package/src/files/minio/minio-adapter.ts +10 -8
- package/src/payment/apple-iap/adapter.ts +1 -1
- package/src/payment/bity/adapter.ts +5 -3
- package/src/payment/braintree.ts +6 -1
- package/src/payment/cryptopay.ts +1 -1
- package/src/payment/datatrans-v2/api/makeFetcher.ts +7 -5
- package/src/payment/datatrans-v2/index.ts +1 -1
- package/src/payment/datatrans-v2/middleware.ts +2 -2
- package/src/payment/postfinance-checkout/api.ts +8 -9
- package/src/payment/postfinance-checkout/index.ts +19 -13
- package/src/payment/postfinance-checkout/silence-postfinancecheckout.d.ts +33 -0
- package/src/payment/postfinance-checkout/utils.ts +7 -6
- package/src/payment/stripe.ts +2 -0
- package/src/payment/worldline-saferpay/index.ts +7 -4
- package/src/plugins-index.ts +0 -0
- package/src/pricing/delivery-swiss-tax.ts +3 -10
- package/src/pricing/free-delivery.ts +2 -0
- package/src/pricing/free-payment.ts +2 -0
- package/src/pricing/order-discount.ts +2 -0
- package/src/pricing/order-items-discount.ts +2 -0
- package/src/pricing/product-swiss-tax.ts +2 -9
- package/src/warehousing/store.ts +2 -2
- package/src/worker/BulkImportWorker.ts +24 -18
- package/src/worker/GenerateOrderWorker.ts +2 -2
- package/src/worker/MessageWorker.ts +3 -2
- package/src/worker/email.ts +4 -1
- package/tsconfig.json +10 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare namespace PostFinanceCheckout {
|
|
2
|
+
namespace model {
|
|
3
|
+
const Transaction;
|
|
4
|
+
type Transaction = any;
|
|
5
|
+
const TransactionCompletion;
|
|
6
|
+
type TransactionCompletion = any;
|
|
7
|
+
const Token;
|
|
8
|
+
type Token = any;
|
|
9
|
+
const TransactionCreate;
|
|
10
|
+
type TransactionCreate = any;
|
|
11
|
+
const RefundCreate;
|
|
12
|
+
type RefundCreate = any;
|
|
13
|
+
const TransactionState: any;
|
|
14
|
+
const LineItemType: any;
|
|
15
|
+
const LineItemCreate: any;
|
|
16
|
+
const RefundType: any;
|
|
17
|
+
const CreationEntityState: any;
|
|
18
|
+
const TokenizationMode: any;
|
|
19
|
+
const TransactionCompletionBehavior: any;
|
|
20
|
+
const TransactionCompletionBehavior: any;
|
|
21
|
+
}
|
|
22
|
+
namespace api {
|
|
23
|
+
const [string]: any;
|
|
24
|
+
const TransactionService: any;
|
|
25
|
+
const TransactionCompletionService: any;
|
|
26
|
+
const TransactionVoidService: any;
|
|
27
|
+
const RefundService: any;
|
|
28
|
+
const TransactionPaymentPageService: any;
|
|
29
|
+
const TransactionIframeService: any;
|
|
30
|
+
const TransactionLightboxService: any;
|
|
31
|
+
const TokenService: any;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Order, OrdersModule } from '@unchainedshop/types/orders';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as pf from 'postfinancecheckout';
|
|
3
|
+
|
|
4
|
+
const { PostFinanceCheckout } = pf;
|
|
4
5
|
|
|
5
6
|
export const transactionIsPaid = async (
|
|
6
|
-
transaction: Transaction,
|
|
7
|
+
transaction: pf.PostFinanceCheckout.model.Transaction,
|
|
7
8
|
expectedCurrency: string,
|
|
8
9
|
expectedAmount: number,
|
|
9
10
|
): Promise<boolean> => {
|
|
10
|
-
if (transaction.state === TransactionState.FULFILL) {
|
|
11
|
+
if (transaction.state === PostFinanceCheckout.model.TransactionState.FULFILL) {
|
|
11
12
|
return (
|
|
12
13
|
transaction.completedAmount !== undefined &&
|
|
13
14
|
transaction.completedAmount.toFixed(2) === expectedAmount.toFixed(2) &&
|
|
14
15
|
transaction.currency === expectedCurrency
|
|
15
16
|
);
|
|
16
17
|
}
|
|
17
|
-
if (transaction.state === TransactionState.AUTHORIZED) {
|
|
18
|
+
if (transaction.state === PostFinanceCheckout.model.TransactionState.AUTHORIZED) {
|
|
18
19
|
return (
|
|
19
20
|
transaction.authorizationAmount !== undefined &&
|
|
20
21
|
transaction.authorizationAmount.toFixed(2) === expectedAmount.toFixed(2) &&
|
|
@@ -26,7 +27,7 @@ export const transactionIsPaid = async (
|
|
|
26
27
|
|
|
27
28
|
export const orderIsPaid = async (
|
|
28
29
|
order: Order,
|
|
29
|
-
transaction: Transaction,
|
|
30
|
+
transaction: pf.PostFinanceCheckout.model.Transaction,
|
|
30
31
|
orderModule: OrdersModule,
|
|
31
32
|
): Promise<boolean> => {
|
|
32
33
|
const pricing = orderModule.pricingSheet(order);
|
package/src/payment/stripe.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPaymentAdapter } from '@unchainedshop/types/payments';
|
|
1
|
+
import { IPaymentAdapter, PaymentChargeActionResult } from '@unchainedshop/types/payments';
|
|
2
2
|
import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
|
|
3
3
|
import { PaymentPageInitializeInput, SaferpayClient } from './worldline-saferpay-client';
|
|
4
4
|
|
|
@@ -103,13 +103,16 @@ const WordlineSaferpay: IPaymentAdapter = {
|
|
|
103
103
|
RequestHeader: saferpayClient.buildRequestHeader(orderPayment._id, 0),
|
|
104
104
|
Token: transactionId,
|
|
105
105
|
});
|
|
106
|
-
|
|
106
|
+
const success =
|
|
107
107
|
!paymentPageAssert.ErrorMessage &&
|
|
108
108
|
paymentPageAssert.Transaction.Amount.Value === totalAmount.toString() &&
|
|
109
109
|
paymentPageAssert.Transaction.Amount.CurrencyCode === order.currency &&
|
|
110
110
|
(paymentPageAssert.Transaction.Status === 'AUTHORIZED' ||
|
|
111
|
-
paymentPageAssert.Transaction.Status === 'CAPTURED')
|
|
112
|
-
)
|
|
111
|
+
paymentPageAssert.Transaction.Status === 'CAPTURED');
|
|
112
|
+
if (success) {
|
|
113
|
+
return paymentPageAssert.Transaction as PaymentChargeActionResult;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
113
116
|
},
|
|
114
117
|
|
|
115
118
|
cancel: async () => {
|
|
File without changes
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
1
|
import { DeliveryPricingAdapter, DeliveryPricingDirector } from '@unchainedshop/core-delivery';
|
|
3
2
|
import {
|
|
4
3
|
DeliveryPricingAdapterContext,
|
|
@@ -8,11 +7,7 @@ import {
|
|
|
8
7
|
// https://www.ch.ch/de/mehrwertsteuersatz-schweiz/
|
|
9
8
|
export const SwissTaxCategories = {
|
|
10
9
|
DEFAULT: {
|
|
11
|
-
rate: (
|
|
12
|
-
const referenceDate = moment(date);
|
|
13
|
-
if (referenceDate.isBefore('2018-01-01')) {
|
|
14
|
-
return 0.08;
|
|
15
|
-
}
|
|
10
|
+
rate: () => {
|
|
16
11
|
return 0.077;
|
|
17
12
|
},
|
|
18
13
|
},
|
|
@@ -31,9 +26,7 @@ export const SwissTaxCategories = {
|
|
|
31
26
|
};
|
|
32
27
|
|
|
33
28
|
const getTaxRate = (context: DeliveryPricingAdapterContext) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const taxCategoryFromProvider = context.deliveryProvider?.configuration?.find(({ key }) => {
|
|
29
|
+
const taxCategoryFromProvider = context.provider?.configuration?.find(({ key }) => {
|
|
37
30
|
if (key === 'swiss-tax-category') return true;
|
|
38
31
|
return null;
|
|
39
32
|
})?.value;
|
|
@@ -44,7 +37,7 @@ const getTaxRate = (context: DeliveryPricingAdapterContext) => {
|
|
|
44
37
|
if (taxCategoryFromProvider === SwissTaxCategories.SPECIAL.value) {
|
|
45
38
|
return SwissTaxCategories.SPECIAL.rate();
|
|
46
39
|
}
|
|
47
|
-
return SwissTaxCategories.DEFAULT.rate(
|
|
40
|
+
return SwissTaxCategories.DEFAULT.rate();
|
|
48
41
|
};
|
|
49
42
|
|
|
50
43
|
const isDeliveryAddressInSwitzerland = ({ orderDelivery, order, country = null }) => {
|
|
@@ -20,6 +20,8 @@ export const DeliveryFreePrice: IDeliveryPricingAdapter = {
|
|
|
20
20
|
calculate: async () => {
|
|
21
21
|
pricingAdapter.resultSheet().addFee({
|
|
22
22
|
amount: 0,
|
|
23
|
+
isTaxable: false,
|
|
24
|
+
isNetPrice: false,
|
|
23
25
|
meta: { adapter: DeliveryFreePrice.key },
|
|
24
26
|
});
|
|
25
27
|
return pricingAdapter.calculate();
|
|
@@ -21,6 +21,8 @@ export const PaymentFreePrice: IPaymentPricingAdapter = {
|
|
|
21
21
|
calculate: async () => {
|
|
22
22
|
pricingAdapter.resultSheet().addFee({
|
|
23
23
|
amount: 0,
|
|
24
|
+
isNetPrice: false,
|
|
25
|
+
isTaxable: false,
|
|
24
26
|
meta: { adapter: PaymentFreePrice.key },
|
|
25
27
|
});
|
|
26
28
|
return pricingAdapter.calculate();
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
1
|
import { ProductPricingDirector, ProductPricingAdapter } from '@unchainedshop/core-products';
|
|
3
2
|
import {
|
|
4
3
|
IProductPricingAdapter,
|
|
5
4
|
ProductPricingAdapterContext,
|
|
6
5
|
} from '@unchainedshop/types/products.pricing';
|
|
7
6
|
|
|
8
|
-
// https://www.ch.ch/de/mehrwertsteuersatz-schweiz/
|
|
9
7
|
export const SwissTaxCategories = {
|
|
10
8
|
DEFAULT: {
|
|
11
|
-
rate: (
|
|
12
|
-
const referenceDate = moment(date);
|
|
13
|
-
if (referenceDate.isBefore('2018-01-01')) {
|
|
14
|
-
return 0.08;
|
|
15
|
-
}
|
|
9
|
+
rate: () => {
|
|
16
10
|
return 0.077;
|
|
17
11
|
},
|
|
18
12
|
},
|
|
@@ -31,7 +25,6 @@ export const SwissTaxCategories = {
|
|
|
31
25
|
};
|
|
32
26
|
|
|
33
27
|
const getTaxRate = (context: ProductPricingAdapterContext) => {
|
|
34
|
-
const date = context.order && context.order.ordered ? new Date(context.order.ordered) : new Date();
|
|
35
28
|
const { product } = context;
|
|
36
29
|
|
|
37
30
|
if (product.tags?.includes(SwissTaxCategories.REDUCED.tag)) {
|
|
@@ -40,7 +33,7 @@ const getTaxRate = (context: ProductPricingAdapterContext) => {
|
|
|
40
33
|
if (product.tags?.includes(SwissTaxCategories.SPECIAL.tag)) {
|
|
41
34
|
return SwissTaxCategories.SPECIAL.rate();
|
|
42
35
|
}
|
|
43
|
-
return SwissTaxCategories.DEFAULT.rate(
|
|
36
|
+
return SwissTaxCategories.DEFAULT.rate();
|
|
44
37
|
};
|
|
45
38
|
|
|
46
39
|
const isDeliveryAddressInSwitzerland = async ({ order, country, modules }) => {
|
package/src/warehousing/store.ts
CHANGED
|
@@ -5,10 +5,15 @@ import { BaseAdapter } from '@unchainedshop/utils';
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import JSONStream from 'JSONStream';
|
|
7
7
|
import { EventIterator } from 'event-iterator';
|
|
8
|
+
import { UnchainedCore } from '@unchainedshop/types/core';
|
|
8
9
|
|
|
9
10
|
const logger = createLogger('unchained:platform:bulk-import');
|
|
10
11
|
|
|
11
|
-
const streamPayloadToBulkImporter = async (
|
|
12
|
+
const streamPayloadToBulkImporter = async (
|
|
13
|
+
bulkImporter,
|
|
14
|
+
createReadStream,
|
|
15
|
+
unchainedAPI: UnchainedCore,
|
|
16
|
+
) => {
|
|
12
17
|
logger.profile(`parseAsync`, { level: LogLevel.Verbose, message: 'parseAsync' });
|
|
13
18
|
|
|
14
19
|
const eventIterator = new EventIterator(
|
|
@@ -34,7 +39,7 @@ const streamPayloadToBulkImporter = async (bulkImporter, createReadStream) => {
|
|
|
34
39
|
);
|
|
35
40
|
|
|
36
41
|
for await (const event of eventIterator) { // eslint-disable-line
|
|
37
|
-
await bulkImporter.prepare(event);
|
|
42
|
+
await bulkImporter.prepare(event, unchainedAPI);
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
logger.profile(`parseAsync`, { level: LogLevel.Verbose, message: 'parseAsync' });
|
|
@@ -48,7 +53,7 @@ export const BulkImportWorker: IWorkerAdapter<any, Record<string, unknown>> = {
|
|
|
48
53
|
version: '1.0',
|
|
49
54
|
type: 'BULK_IMPORT',
|
|
50
55
|
|
|
51
|
-
doWork: async (rawPayload,
|
|
56
|
+
doWork: async (rawPayload, unchainedAPI) => {
|
|
52
57
|
try {
|
|
53
58
|
const {
|
|
54
59
|
createShouldUpsertIfIDExists = false,
|
|
@@ -56,25 +61,26 @@ export const BulkImportWorker: IWorkerAdapter<any, Record<string, unknown>> = {
|
|
|
56
61
|
authorId = 'root',
|
|
57
62
|
} = rawPayload;
|
|
58
63
|
|
|
59
|
-
const bulkImporter =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
context,
|
|
67
|
-
);
|
|
64
|
+
const bulkImporter = unchainedAPI.bulkImporter.createBulkImporter({
|
|
65
|
+
logger,
|
|
66
|
+
authorId,
|
|
67
|
+
createShouldUpsertIfIDExists,
|
|
68
|
+
skipCacheInvalidation,
|
|
69
|
+
});
|
|
68
70
|
|
|
69
71
|
if (rawPayload.payloadFilePath) {
|
|
70
72
|
// stream payload from file system
|
|
71
|
-
await streamPayloadToBulkImporter(
|
|
72
|
-
|
|
73
|
+
await streamPayloadToBulkImporter(
|
|
74
|
+
bulkImporter,
|
|
75
|
+
() => fs.createReadStream(rawPayload.payloadFilePath),
|
|
76
|
+
unchainedAPI,
|
|
73
77
|
);
|
|
74
78
|
} else if (rawPayload.payloadId) {
|
|
75
79
|
// stream payload from gridfs
|
|
76
|
-
await streamPayloadToBulkImporter(
|
|
77
|
-
|
|
80
|
+
await streamPayloadToBulkImporter(
|
|
81
|
+
bulkImporter,
|
|
82
|
+
() => unchainedAPI.bulkImporter.BulkImportPayloads.openDownloadStream(rawPayload.payloadId),
|
|
83
|
+
unchainedAPI,
|
|
78
84
|
);
|
|
79
85
|
} else {
|
|
80
86
|
const { events } = rawPayload;
|
|
@@ -82,12 +88,12 @@ export const BulkImportWorker: IWorkerAdapter<any, Record<string, unknown>> = {
|
|
|
82
88
|
|
|
83
89
|
await events.reduce(async (currentEventPromise, nextEvent) => {
|
|
84
90
|
await currentEventPromise;
|
|
85
|
-
return bulkImporter.prepare(nextEvent);
|
|
91
|
+
return bulkImporter.prepare(nextEvent, unchainedAPI);
|
|
86
92
|
}, Promise.resolve());
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
const [result, error] = await bulkImporter.execute();
|
|
90
|
-
await bulkImporter.invalidateCaches();
|
|
96
|
+
await bulkImporter.invalidateCaches(unchainedAPI);
|
|
91
97
|
|
|
92
98
|
if (error) {
|
|
93
99
|
return {
|
|
@@ -97,7 +97,7 @@ const GenerateOrderWorker: IWorkerAdapter<any, any> = {
|
|
|
97
97
|
await Promise.all(
|
|
98
98
|
enrollments.map(async (enrollment) => {
|
|
99
99
|
try {
|
|
100
|
-
const director = await EnrollmentDirector.actions({ enrollment }, requestContext);
|
|
100
|
+
const director = await EnrollmentDirector.actions({ enrollment }, requestContext as Context); // TODO: Type Refactor
|
|
101
101
|
const period = await director.nextPeriod();
|
|
102
102
|
if (period) {
|
|
103
103
|
const configuration = await director.configurationForOrder({
|
|
@@ -105,7 +105,7 @@ const GenerateOrderWorker: IWorkerAdapter<any, any> = {
|
|
|
105
105
|
period,
|
|
106
106
|
});
|
|
107
107
|
if (configuration) {
|
|
108
|
-
const order = await generateOrder(enrollment, configuration, requestContext);
|
|
108
|
+
const order = await generateOrder(enrollment, configuration, requestContext as Context); // TODO: Type Refactor
|
|
109
109
|
if (order) {
|
|
110
110
|
await modules.enrollments.addEnrollmentPeriod(enrollment._id, {
|
|
111
111
|
...period,
|
|
@@ -2,6 +2,7 @@ import { IWorkerAdapter, Work } from '@unchainedshop/types/worker';
|
|
|
2
2
|
import { MessagingDirector } from '@unchainedshop/core-messaging';
|
|
3
3
|
import { WorkerAdapter, WorkerDirector } from '@unchainedshop/core-worker';
|
|
4
4
|
import { createLogger } from '@unchainedshop/logger';
|
|
5
|
+
import { Context } from '@unchainedshop/types/api';
|
|
5
6
|
|
|
6
7
|
export const messagingLogger = createLogger('unchained:core-messaging');
|
|
7
8
|
|
|
@@ -25,7 +26,7 @@ export const MessageWorker: IWorkerAdapter<
|
|
|
25
26
|
template,
|
|
26
27
|
...payload,
|
|
27
28
|
},
|
|
28
|
-
requestContext,
|
|
29
|
+
requestContext as Context, // TODO: Type Refactor
|
|
29
30
|
);
|
|
30
31
|
|
|
31
32
|
if (workConfigurations.length > 0) {
|
|
@@ -36,7 +37,7 @@ export const MessageWorker: IWorkerAdapter<
|
|
|
36
37
|
...workConfiguration,
|
|
37
38
|
originalWorkId: workId,
|
|
38
39
|
},
|
|
39
|
-
|
|
40
|
+
null,
|
|
40
41
|
);
|
|
41
42
|
delete work.input;
|
|
42
43
|
return work;
|
package/src/worker/email.ts
CHANGED
|
@@ -60,7 +60,7 @@ const EmailWorkerPlugin: IWorkerAdapter<
|
|
|
60
60
|
subject?: string;
|
|
61
61
|
[x: string]: any;
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
any
|
|
64
64
|
> = {
|
|
65
65
|
...WorkerAdapter,
|
|
66
66
|
|
|
@@ -94,6 +94,9 @@ const EmailWorkerPlugin: IWorkerAdapter<
|
|
|
94
94
|
openInBrowser(sendMailOptions);
|
|
95
95
|
return { success: true, result: { intercepted: true } };
|
|
96
96
|
}
|
|
97
|
+
if (!process.env.MAIL_URL) {
|
|
98
|
+
return { success: false, error: { name: 'NO_MAIL_URL_SET', message: 'MAIL_URL is not set' } };
|
|
99
|
+
}
|
|
97
100
|
const transporter = nodemailer.createTransport(process.env.MAIL_URL);
|
|
98
101
|
const result = await transporter.sendMail(sendMailOptions);
|
|
99
102
|
return { success: true, result };
|
package/tsconfig.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"esModuleInterop": true,
|
|
7
7
|
"experimentalDecorators": true,
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"rootDir": "src",
|
|
9
10
|
"lib": [
|
|
10
11
|
"esnext"
|
|
11
12
|
],
|
|
@@ -21,8 +22,16 @@
|
|
|
21
22
|
"types": [
|
|
22
23
|
"node",
|
|
23
24
|
"jest"
|
|
24
|
-
]
|
|
25
|
+
],
|
|
26
|
+
"paths": {
|
|
27
|
+
"postfinancecheckout": [
|
|
28
|
+
"./src/payment/postfinance-checkout/silence-postfinancecheckout.d.ts"
|
|
29
|
+
],
|
|
30
|
+
}
|
|
25
31
|
},
|
|
32
|
+
// "exclude": [
|
|
33
|
+
// "./src/payment/postfinance-checkout/*"
|
|
34
|
+
// ],
|
|
26
35
|
"include": [
|
|
27
36
|
"src"
|
|
28
37
|
]
|