@unchainedshop/core 4.5.0 → 4.6.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.
Files changed (35) hide show
  1. package/lib/bulk-exporter/createBulkExporter.d.ts +33 -0
  2. package/lib/bulk-exporter/createBulkExporter.js +46 -0
  3. package/lib/bulk-exporter/handlers/exportAssortmentsHandler.d.ts +38 -0
  4. package/lib/bulk-exporter/handlers/exportAssortmentsHandler.js +137 -0
  5. package/lib/bulk-exporter/handlers/exportFiltersHandler.d.ts +26 -0
  6. package/lib/bulk-exporter/handlers/exportFiltersHandler.js +88 -0
  7. package/lib/bulk-exporter/handlers/exportProductsHandler.d.ts +40 -0
  8. package/lib/bulk-exporter/handlers/exportProductsHandler.js +238 -0
  9. package/lib/bulk-exporter/handlers/exportUsersHandler.d.ts +40 -0
  10. package/lib/bulk-exporter/handlers/exportUsersHandler.js +340 -0
  11. package/lib/bulk-exporter/handlers/generateCSVFileAndUrl.d.ts +13 -0
  12. package/lib/bulk-exporter/handlers/generateCSVFileAndUrl.js +21 -0
  13. package/lib/bulk-exporter/handlers/toCSV.d.ts +2 -0
  14. package/lib/bulk-exporter/handlers/toCSV.js +5 -0
  15. package/lib/bulk-exporter/index.d.ts +3 -0
  16. package/lib/bulk-exporter/index.js +3 -0
  17. package/lib/bulk-importer/handlers/assortment/create.d.ts +0 -2
  18. package/lib/bulk-importer/handlers/assortment/create.js +0 -1
  19. package/lib/bulk-importer/handlers/assortment/update.d.ts +0 -2
  20. package/lib/bulk-importer/handlers/assortment/update.js +0 -1
  21. package/lib/bulk-importer/handlers/product/create.js +2 -2
  22. package/lib/bulk-importer/handlers/product/update.js +2 -2
  23. package/lib/core-index.d.ts +7 -1
  24. package/lib/core-index.js +5 -1
  25. package/lib/directors/EnrollmentDirector.d.ts +4 -1
  26. package/lib/directors/PaymentDirector.js +2 -0
  27. package/lib/directors/WorkerAdapter.d.ts +2 -0
  28. package/lib/services/fulfillQuotation.d.ts +3 -0
  29. package/lib/services/{fullfillQuotation.js → fulfillQuotation.js} +3 -3
  30. package/lib/services/index.d.ts +2 -2
  31. package/lib/services/index.js +2 -2
  32. package/lib/services/processOrder.js +17 -9
  33. package/lib/services/rejectQuotation.js +1 -1
  34. package/package.json +21 -20
  35. package/lib/services/fullfillQuotation.d.ts +0 -3
@@ -31,7 +31,7 @@ import { initializeEnrollmentService } from "./initializeEnrollment.js";
31
31
  import { activateEnrollmentService } from "./activateEnrollment.js";
32
32
  import { terminateEnrollmentService } from "./terminateEnrollment.js";
33
33
  import { invalidateFilterCacheService } from "./invalidateFilterCache.js";
34
- import { fullfillQuotationService } from "./fullfillQuotation.js";
34
+ import { fulfillQuotationService } from "./fulfillQuotation.js";
35
35
  import { processQuotationService } from "./processQuotation.js";
36
36
  import { proposeQuotationService } from "./proposeQuotation.js";
37
37
  import { rejectQuotationService } from "./rejectQuotation.js";
@@ -127,7 +127,7 @@ export default function initServices(modules, customServices = {}) {
127
127
  terminateEnrollment: terminateEnrollmentService,
128
128
  },
129
129
  quotations: {
130
- fullfillQuotation: fullfillQuotationService,
130
+ fulfillQuotation: fulfillQuotationService,
131
131
  processQuotation: processQuotationService,
132
132
  proposeQuotation: proposeQuotationService,
133
133
  rejectQuotation: rejectQuotationService,
@@ -3,14 +3,16 @@ import { createEnrollmentFromCheckoutService } from "./createEnrollmentFromCheck
3
3
  import { ProductType } from '@unchainedshop/core-products';
4
4
  import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
5
5
  import { WarehousingDirector, DeliveryDirector, PaymentDirector } from "../directors/index.js";
6
- import { fullfillQuotationService } from "./fullfillQuotation.js";
6
+ import { fulfillQuotationService } from "./fulfillQuotation.js";
7
+ import { createLogger } from '@unchainedshop/logger';
8
+ const logger = createLogger('unchained:core:processOrder');
7
9
  const isAutoConfirmationEnabled = async ({ orderPayment, orderDelivery, }, modules) => {
8
10
  if (orderPayment.status !== OrderPaymentStatus.PAID) {
9
11
  const paymentProvider = await modules.payment.paymentProviders.findProvider({
10
12
  paymentProviderId: orderPayment.paymentProviderId,
11
13
  });
12
14
  if (!paymentProvider)
13
- throw new Error('Payment provider not found: ' + orderPayment.paymentProviderId);
15
+ throw new Error(`Payment provider not found: ${orderPayment.paymentProviderId}`);
14
16
  const actions = await PaymentDirector.actions(paymentProvider, {}, { modules });
15
17
  if (!actions.isPayLaterAllowed())
16
18
  return false;
@@ -20,7 +22,7 @@ const isAutoConfirmationEnabled = async ({ orderPayment, orderDelivery, }, modul
20
22
  deliveryProviderId: orderDelivery.deliveryProviderId,
21
23
  });
22
24
  if (!deliveryProvider)
23
- throw new Error('Delivery provider not found: ' + orderDelivery.deliveryProviderId);
25
+ throw new Error(`Delivery provider not found: ${orderDelivery.deliveryProviderId}`);
24
26
  const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
25
27
  if (!director.isAutoReleaseAllowed())
26
28
  return false;
@@ -31,7 +33,7 @@ const findNextStatus = async (status, order, modules) => {
31
33
  if (status === null) {
32
34
  return OrderStatus.PENDING;
33
35
  }
34
- if (status === OrderStatus.FULLFILLED || status === OrderStatus.REJECTED) {
36
+ if (status === OrderStatus.FULFILLED || status === OrderStatus.REJECTED) {
35
37
  return status;
36
38
  }
37
39
  const orderPayment = order.paymentId &&
@@ -52,10 +54,10 @@ const findNextStatus = async (status, order, modules) => {
52
54
  }
53
55
  }
54
56
  if (status === OrderStatus.CONFIRMED) {
55
- const readyForFullfillment = orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
57
+ const readyForFulfillment = orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
56
58
  orderPayment.status === OrderPaymentStatus.PAID;
57
- if (readyForFullfillment) {
58
- return OrderStatus.FULLFILLED;
59
+ if (readyForFulfillment) {
60
+ return OrderStatus.FULFILLED;
59
61
  }
60
62
  }
61
63
  return status;
@@ -125,9 +127,15 @@ export async function processOrderService(initialOrder, orderTransactionContext)
125
127
  const quotation = await this.quotations.findQuotation({
126
128
  quotationId: orderPosition.quotationId,
127
129
  });
128
- if (!quotation)
130
+ if (!quotation) {
131
+ logger.warn('Quotation not found during order fulfillment', {
132
+ orderId,
133
+ orderPositionId: orderPosition._id,
134
+ quotationId: orderPosition.quotationId,
135
+ });
129
136
  return;
130
- await fullfillQuotationService.bind(this)(quotation, {
137
+ }
138
+ await fulfillQuotationService.bind(this)(quotation, {
131
139
  orderId,
132
140
  orderPositionId: orderPosition._id,
133
141
  });
@@ -1,7 +1,7 @@
1
1
  import { QuotationStatus } from '@unchainedshop/core-quotations';
2
2
  import { processQuotationService } from "./processQuotation.js";
3
3
  export async function rejectQuotationService(quotation, { quotationContext }) {
4
- if (quotation.status === QuotationStatus.FULLFILLED)
4
+ if (quotation.status === QuotationStatus.FULFILLED)
5
5
  return quotation;
6
6
  const updatedQuotation = (await this.quotations.updateStatus(quotation._id, {
7
7
  status: QuotationStatus.REJECTED,
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core",
3
- "version": "4.5.0",
3
+ "description": "Core orchestration package for the Unchained Engine with business services and directors",
4
+ "version": "4.6.1",
4
5
  "main": "lib/core-index.js",
5
6
  "types": "lib/core-index.d.ts",
6
7
  "type": "module",
@@ -34,25 +35,25 @@
34
35
  },
35
36
  "homepage": "https://github.com/unchainedshop/unchained#readme",
36
37
  "dependencies": {
37
- "@unchainedshop/core-assortments": "^4.5.0",
38
- "@unchainedshop/core-bookmarks": "^4.5.0",
39
- "@unchainedshop/core-countries": "^4.5.0",
40
- "@unchainedshop/core-currencies": "^4.5.0",
41
- "@unchainedshop/core-delivery": "^4.5.0",
42
- "@unchainedshop/core-enrollments": "^4.5.0",
43
- "@unchainedshop/core-events": "^4.5.0",
44
- "@unchainedshop/core-files": "^4.5.0",
45
- "@unchainedshop/core-filters": "^4.5.0",
46
- "@unchainedshop/core-languages": "^4.5.0",
47
- "@unchainedshop/core-orders": "^4.5.0",
48
- "@unchainedshop/core-payment": "^4.5.0",
49
- "@unchainedshop/core-products": "^4.5.0",
50
- "@unchainedshop/core-quotations": "^4.5.0",
51
- "@unchainedshop/core-users": "^4.5.0",
52
- "@unchainedshop/core-warehousing": "^4.5.0",
53
- "@unchainedshop/core-worker": "^4.5.0",
54
- "@unchainedshop/logger": "^4.5.0",
55
- "@unchainedshop/utils": "^4.5.0",
38
+ "@unchainedshop/core-assortments": "^4.6.0",
39
+ "@unchainedshop/core-bookmarks": "^4.6.0",
40
+ "@unchainedshop/core-countries": "^4.6.0",
41
+ "@unchainedshop/core-currencies": "^4.6.0",
42
+ "@unchainedshop/core-delivery": "^4.6.0",
43
+ "@unchainedshop/core-enrollments": "^4.6.0",
44
+ "@unchainedshop/core-events": "^4.6.0",
45
+ "@unchainedshop/core-files": "^4.6.0",
46
+ "@unchainedshop/core-filters": "^4.6.0",
47
+ "@unchainedshop/core-languages": "^4.6.0",
48
+ "@unchainedshop/core-orders": "^4.6.0",
49
+ "@unchainedshop/core-payment": "^4.6.0",
50
+ "@unchainedshop/core-products": "^4.6.0",
51
+ "@unchainedshop/core-quotations": "^4.6.0",
52
+ "@unchainedshop/core-users": "^4.6.0",
53
+ "@unchainedshop/core-warehousing": "^4.6.0",
54
+ "@unchainedshop/core-worker": "^4.6.0",
55
+ "@unchainedshop/logger": "^4.6.0",
56
+ "@unchainedshop/utils": "^4.6.0",
56
57
  "minipass-json-stream": "^1.0.2"
57
58
  },
58
59
  "devDependencies": {
@@ -1,3 +0,0 @@
1
- import { type Quotation } from '@unchainedshop/core-quotations';
2
- import type { Modules } from '../modules.ts';
3
- export declare function fullfillQuotationService(this: Modules, quotation: Quotation, info: any): Promise<Quotation>;