@unchainedshop/core 4.0.0-rc.14 → 4.0.0-rc.16
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/bulk-importer/createBulkImporter.d.ts +61 -0
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -0
- package/lib/bulk-importer/createBulkImporter.js +135 -0
- package/lib/bulk-importer/createBulkImporter.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts +15 -0
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/create.js +62 -0
- package/lib/bulk-importer/handlers/assortment/create.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/index.js +4 -0
- package/lib/bulk-importer/handlers/assortment/index.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +12 -0
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/remove.js +13 -0
- package/lib/bulk-importer/handlers/assortment/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts +16 -0
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/update.js +62 -0
- package/lib/bulk-importer/handlers/assortment/update.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +9 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +37 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +9 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +32 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +9 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +37 -0
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +11 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +39 -0
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts +13 -0
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/create.js +58 -0
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/index.js +4 -0
- package/lib/bulk-importer/handlers/filter/index.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts +12 -0
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/remove.js +14 -0
- package/lib/bulk-importer/handlers/filter/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts +13 -0
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/filter/update.js +48 -0
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/create.d.ts +15 -0
- package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/create.js +53 -0
- package/lib/bulk-importer/handlers/product/create.js.map +1 -0
- package/lib/bulk-importer/handlers/product/index.d.ts +4 -0
- package/lib/bulk-importer/handlers/product/index.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/index.js +4 -0
- package/lib/bulk-importer/handlers/product/index.js.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts +14 -0
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/remove.js +13 -0
- package/lib/bulk-importer/handlers/product/remove.js.map +1 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts +3 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js +16 -0
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js.map +1 -0
- package/lib/bulk-importer/handlers/product/update.d.ts +15 -0
- package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/update.js +48 -0
- package/lib/bulk-importer/handlers/product/update.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +10 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js +45 -0
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +8 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js +48 -0
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +3 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +1 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +6 -0
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +1 -0
- package/lib/bulk-importer/upsertAsset.d.ts +12 -0
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -0
- package/lib/bulk-importer/upsertAsset.js +33 -0
- package/lib/bulk-importer/upsertAsset.js.map +1 -0
- package/lib/core-index.d.ts +7 -5
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +5 -1
- package/lib/core-index.js.map +1 -1
- package/lib/directors/FilterAdapter.d.ts +1 -1
- package/lib/directors/FilterAdapter.d.ts.map +1 -1
- package/lib/directors/FilterDirector.d.ts.map +1 -1
- package/lib/directors/FilterDirector.js +6 -7
- package/lib/directors/FilterDirector.js.map +1 -1
- package/lib/directors/PaymentDirector.js +2 -2
- package/lib/directors/PaymentDirector.js.map +1 -1
- package/lib/directors/WorkerAdapter.d.ts +3 -2
- package/lib/directors/WorkerAdapter.d.ts.map +1 -1
- package/lib/directors/WorkerAdapter.js.map +1 -1
- package/lib/factory/index.d.ts +3 -0
- package/lib/factory/index.d.ts.map +1 -0
- package/lib/factory/index.js +3 -0
- package/lib/factory/index.js.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter copy.d.ts +5 -0
- package/lib/factory/registerProductDiscoverabilityFilter copy.d.ts.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter copy.js +28 -0
- package/lib/factory/registerProductDiscoverabilityFilter copy.js.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +5 -0
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts.map +1 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js +27 -0
- package/lib/factory/registerProductDiscoverabilityFilter.js.map +1 -0
- package/lib/modules.d.ts.map +1 -1
- package/lib/modules.js +1 -0
- package/lib/modules.js.map +1 -1
- package/lib/services/activateEnrollment.d.ts.map +1 -1
- package/lib/services/activateEnrollment.js +5 -9
- package/lib/services/activateEnrollment.js.map +1 -1
- package/lib/services/addMessage.d.ts +4 -0
- package/lib/services/addMessage.d.ts.map +1 -0
- package/lib/services/addMessage.js +15 -0
- package/lib/services/addMessage.js.map +1 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +4 -0
- package/lib/services/index.js.map +1 -1
- package/lib/services/initCartProviders.d.ts.map +1 -1
- package/lib/services/initCartProviders.js +6 -2
- package/lib/services/initCartProviders.js.map +1 -1
- package/lib/services/initializeEnrollment.d.ts.map +1 -1
- package/lib/services/initializeEnrollment.js +5 -9
- package/lib/services/initializeEnrollment.js.map +1 -1
- package/lib/services/processQuotation.d.ts.map +1 -1
- package/lib/services/processQuotation.js +4 -8
- package/lib/services/processQuotation.js.map +1 -1
- package/lib/services/removeFiles.js +2 -2
- package/lib/services/removeFiles.js.map +1 -1
- package/lib/services/searchAssortments.d.ts.map +1 -1
- package/lib/services/searchAssortments.js +2 -1
- package/lib/services/searchAssortments.js.map +1 -1
- package/lib/services/searchProducts.d.ts.map +1 -1
- package/lib/services/searchProducts.js +2 -1
- package/lib/services/searchProducts.js.map +1 -1
- package/lib/services/terminateEnrollment.d.ts.map +1 -1
- package/lib/services/terminateEnrollment.js +5 -9
- package/lib/services/terminateEnrollment.js.map +1 -1
- package/lib/services/updateCalculation.d.ts.map +1 -1
- package/lib/services/updateCalculation.js +5 -3
- package/lib/services/updateCalculation.js.map +1 -1
- package/package.json +21 -20
- package/src/bulk-importer/createBulkImporter.ts +193 -0
- package/src/bulk-importer/handlers/assortment/create.ts +87 -0
- package/src/bulk-importer/handlers/assortment/index.ts +3 -0
- package/src/bulk-importer/handlers/assortment/remove.ts +15 -0
- package/src/bulk-importer/handlers/assortment/update.ts +89 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +52 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +42 -0
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +50 -0
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +58 -0
- package/src/bulk-importer/handlers/filter/create.ts +76 -0
- package/src/bulk-importer/handlers/filter/index.ts +3 -0
- package/src/bulk-importer/handlers/filter/remove.ts +20 -0
- package/src/bulk-importer/handlers/filter/update.ts +67 -0
- package/src/bulk-importer/handlers/product/create.ts +70 -0
- package/src/bulk-importer/handlers/product/index.ts +3 -0
- package/src/bulk-importer/handlers/product/remove.ts +21 -0
- package/src/bulk-importer/handlers/product/transformSpecificationToProductStructure.ts +22 -0
- package/src/bulk-importer/handlers/product/update.ts +66 -0
- package/src/bulk-importer/handlers/product/upsertMedia.ts +64 -0
- package/src/bulk-importer/handlers/product/upsertVariations.ts +71 -0
- package/src/bulk-importer/handlers/utils/convertTagsToLowerCase.ts +4 -0
- package/src/bulk-importer/upsertAsset.ts +42 -0
- package/src/core-index.ts +11 -6
- package/src/directors/FilterAdapter.ts +1 -1
- package/src/directors/FilterDirector.ts +6 -7
- package/src/directors/PaymentDirector.ts +2 -2
- package/src/directors/WorkerAdapter.ts +8 -3
- package/src/factory/index.ts +3 -0
- package/src/factory/registerProductDiscoverabilityFilter.ts +36 -0
- package/src/modules.ts +1 -0
- package/src/services/activateEnrollment.ts +5 -9
- package/src/services/addMessage.ts +20 -0
- package/src/services/index.ts +4 -0
- package/src/services/initCartProviders.ts +6 -8
- package/src/services/initializeEnrollment.ts +5 -9
- package/src/services/processQuotation.ts +4 -8
- package/src/services/removeFiles.ts +2 -2
- package/src/services/searchAssortments.ts +2 -1
- package/src/services/searchProducts.ts +3 -1
- package/src/services/terminateEnrollment.ts +5 -9
- package/src/services/updateCalculation.ts +5 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Work } from '@unchainedshop/core-worker';
|
|
2
|
+
import { MessagingDirector } from '../core-index.js';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
|
|
5
|
+
export async function addMessageService<T = Record<string, any>>(
|
|
6
|
+
this: Modules,
|
|
7
|
+
template: string,
|
|
8
|
+
input: T,
|
|
9
|
+
): Promise<Work | null> {
|
|
10
|
+
const templateResolver = MessagingDirector.getTemplate(template); // Validate template exists
|
|
11
|
+
if (!templateResolver) return null;
|
|
12
|
+
return this.worker.addWork({
|
|
13
|
+
type: 'MESSAGE',
|
|
14
|
+
input: {
|
|
15
|
+
template,
|
|
16
|
+
...input,
|
|
17
|
+
},
|
|
18
|
+
retries: 0,
|
|
19
|
+
});
|
|
20
|
+
}
|
package/src/services/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { simulateProductPricingService } from './simulateProductPricing.js';
|
|
|
44
44
|
import { simulateProductDispatchingService } from './simulateProductDispatching.js';
|
|
45
45
|
import { simulateProductInventoryService } from './simulateProductInventory.js';
|
|
46
46
|
import { findOrInitCartService } from './findOrInitCart.js';
|
|
47
|
+
import { addMessageService } from './addMessage.js';
|
|
47
48
|
|
|
48
49
|
// Auto-Inject Unchained API as last parameter
|
|
49
50
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
|
|
@@ -156,6 +157,9 @@ export default function initServices(modules: Modules, customServices: CustomSer
|
|
|
156
157
|
warehousing: {
|
|
157
158
|
ercMetadata: ercMetadataService as Bound<typeof ercMetadataService>,
|
|
158
159
|
},
|
|
160
|
+
worker: {
|
|
161
|
+
addMessage: addMessageService as Bound<typeof addMessageService>,
|
|
162
|
+
},
|
|
159
163
|
};
|
|
160
164
|
|
|
161
165
|
// This Proxy Binds all services to the Modules Object
|
|
@@ -33,10 +33,9 @@ export async function initCartProvidersService(this: Modules, order: Order) {
|
|
|
33
33
|
{ modules: this },
|
|
34
34
|
);
|
|
35
35
|
if (defaultOrderDeliveryProvider) {
|
|
36
|
-
updatedOrder =
|
|
37
|
-
updatedOrder._id,
|
|
38
|
-
|
|
39
|
-
);
|
|
36
|
+
updatedOrder =
|
|
37
|
+
(await this.orders.setDeliveryProvider(updatedOrder._id, defaultOrderDeliveryProvider._id)) ||
|
|
38
|
+
updatedOrder;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -76,10 +75,9 @@ export async function initCartProvidersService(this: Modules, order: Order) {
|
|
|
76
75
|
);
|
|
77
76
|
|
|
78
77
|
if (defaultOrderPaymentProvider) {
|
|
79
|
-
updatedOrder =
|
|
80
|
-
updatedOrder._id,
|
|
81
|
-
|
|
82
|
-
);
|
|
78
|
+
updatedOrder =
|
|
79
|
+
(await this.orders.setPaymentProvider(updatedOrder._id, defaultOrderPaymentProvider._id)) ||
|
|
80
|
+
updatedOrder;
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
return updatedOrder;
|
|
@@ -2,6 +2,7 @@ import { Enrollment } from '@unchainedshop/core-enrollments';
|
|
|
2
2
|
import { EnrollmentDirector } from '../core-index.js';
|
|
3
3
|
import { processEnrollmentService } from './processEnrollment.js';
|
|
4
4
|
import { Modules } from '../modules.js';
|
|
5
|
+
import { addMessageService } from './addMessage.js';
|
|
5
6
|
|
|
6
7
|
export async function initializeEnrollmentService(
|
|
7
8
|
this: Modules,
|
|
@@ -23,15 +24,10 @@ export async function initializeEnrollmentService(
|
|
|
23
24
|
const user = await this.users.findUserById(enrollment.userId);
|
|
24
25
|
const locale = this.users.userLocale(user);
|
|
25
26
|
|
|
26
|
-
await
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
reason: params.reason || 'status_change',
|
|
31
|
-
locale: locale.baseName,
|
|
32
|
-
template: 'ENROLLMENT_STATUS',
|
|
33
|
-
enrollmentId: processedEnrollment._id,
|
|
34
|
-
},
|
|
27
|
+
await addMessageService.bind(this)('ENROLLMENT_STATUS', {
|
|
28
|
+
reason: 'status_change',
|
|
29
|
+
locale: locale.baseName,
|
|
30
|
+
enrollmentId: processedEnrollment._id,
|
|
35
31
|
});
|
|
36
32
|
|
|
37
33
|
return processedEnrollment;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
|
|
2
2
|
import { Modules } from '../modules.js';
|
|
3
3
|
import { QuotationDirector } from '../core-index.js';
|
|
4
|
+
import { addMessageService } from './addMessage.js';
|
|
4
5
|
|
|
5
6
|
const findNextStatus = async (quotation: Quotation, modules: Modules): Promise<QuotationStatus> => {
|
|
6
7
|
let status = quotation.status as QuotationStatus;
|
|
@@ -61,14 +62,9 @@ export async function processQuotationService(
|
|
|
61
62
|
const user = await this.users.findUserById(updatedQuotation.userId);
|
|
62
63
|
const locale = this.users.userLocale(user);
|
|
63
64
|
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
input: {
|
|
68
|
-
locale: locale.baseName,
|
|
69
|
-
template: 'QUOTATION_STATUS',
|
|
70
|
-
quotationId: updatedQuotation._id,
|
|
71
|
-
},
|
|
65
|
+
await addMessageService.bind(this)('QUOTATION_STATUS', {
|
|
66
|
+
locale: locale.baseName,
|
|
67
|
+
quotationId: updatedQuotation._id,
|
|
72
68
|
});
|
|
73
69
|
|
|
74
70
|
return updatedQuotation;
|
|
@@ -13,8 +13,8 @@ export async function removeFilesService(this: Modules, { fileIds }: { fileIds:
|
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
15
|
await fileUploadAdapter.removeFiles(fileObjects, { modules: this });
|
|
16
|
-
} catch
|
|
17
|
-
|
|
16
|
+
} catch {
|
|
17
|
+
/**/
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
|
|
@@ -36,7 +36,8 @@ export async function searchAssortmentsService(
|
|
|
36
36
|
const assortmentIds = await searchQuery.assortmentIds;
|
|
37
37
|
|
|
38
38
|
const totalAssortmentIds =
|
|
39
|
-
(await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) ||
|
|
39
|
+
(await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) ||
|
|
40
|
+
(await this.assortments.findAssortmentIds({ includeInactive: searchQuery.includeInactive }));
|
|
40
41
|
|
|
41
42
|
return {
|
|
42
43
|
searchConfiguration,
|
|
@@ -47,7 +47,9 @@ export async function searchProductsService(
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const totalProductIds =
|
|
50
|
+
const totalProductIds =
|
|
51
|
+
(await filterActions.searchProducts(searchQuery, searchConfiguration)) ||
|
|
52
|
+
(await this.products.findProductIds({ includeDrafts: searchQuery.includeInactive }));
|
|
51
53
|
|
|
52
54
|
const filteredProductIds = await FilterDirector.productFacetedSearch(
|
|
53
55
|
totalProductIds,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Enrollment, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
2
2
|
import { processEnrollmentService } from './processEnrollment.js';
|
|
3
|
+
import { addMessageService } from './addMessage.js';
|
|
3
4
|
|
|
4
5
|
export async function terminateEnrollmentService(enrollment: Enrollment) {
|
|
5
6
|
if (enrollment.status === EnrollmentStatus.TERMINATED) return enrollment;
|
|
@@ -14,15 +15,10 @@ export async function terminateEnrollmentService(enrollment: Enrollment) {
|
|
|
14
15
|
const user = await this.users.findUserById(enrollment.userId);
|
|
15
16
|
const locale = this.users.userLocale(user);
|
|
16
17
|
|
|
17
|
-
await
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
reason: 'status_change',
|
|
22
|
-
locale: locale.baseName,
|
|
23
|
-
template: 'ENROLLMENT_STATUS',
|
|
24
|
-
enrollmentId: updatedEnrollment._id,
|
|
25
|
-
},
|
|
18
|
+
await addMessageService.bind(this)('ENROLLMENT_STATUS', {
|
|
19
|
+
reason: 'status_change',
|
|
20
|
+
locale: locale.baseName,
|
|
21
|
+
enrollmentId: updatedEnrollment._id,
|
|
26
22
|
});
|
|
27
23
|
|
|
28
24
|
return updatedEnrollment;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '../directors/index.js';
|
|
12
12
|
|
|
13
13
|
export async function updateCalculationService(this: Modules, orderId: string) {
|
|
14
|
-
|
|
14
|
+
let order = await this.orders.findOrder({ orderId });
|
|
15
15
|
|
|
16
16
|
// Don't recalculate orders, only carts
|
|
17
17
|
if (order.status !== null) return order;
|
|
@@ -124,7 +124,9 @@ export async function updateCalculationService(this: Modules, orderId: string) {
|
|
|
124
124
|
{ modules: this },
|
|
125
125
|
);
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
if (JSON.stringify(order.calculation) !== JSON.stringify(calculation)) {
|
|
128
|
+
order = await this.orders.updateCalculationSheet(orderId, calculation);
|
|
129
|
+
}
|
|
128
130
|
|
|
129
131
|
/*
|
|
130
132
|
// We have to do initCartProviders after calculation, only then filterSupportedProviders will work correctly and has access to recent pricing
|
|
@@ -138,5 +140,5 @@ export async function updateCalculationService(this: Modules, orderId: string) {
|
|
|
138
140
|
// 6. update calculation -> order pricing updated to items 0, delivery 0, payment 0
|
|
139
141
|
// 7. initCartProviders with updated order -> all providers are valid -> return order
|
|
140
142
|
*/
|
|
141
|
-
return initCartProvidersService.bind(this)(
|
|
143
|
+
return initCartProvidersService.bind(this)(order);
|
|
142
144
|
}
|