@daffodil/cart 0.64.1 → 0.66.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.
Files changed (157) hide show
  1. package/driver/in-memory/backend/cart/cart.service.d.ts +3 -1
  2. package/driver/in-memory/backend/cart-items/cart-items.service.d.ts +3 -1
  3. package/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.d.ts +3 -1
  4. package/driver/in-memory/helpers/compute-cart-item-prices.d.ts +3 -0
  5. package/driver/in-memory/helpers/compute-cart-totals.d.ts +3 -0
  6. package/driver/magento/models/responses/cart.d.ts +1 -1
  7. package/esm2020/driver/in-memory/backend/cart/cart.service.mjs +9 -5
  8. package/esm2020/driver/in-memory/backend/cart-items/cart-items.service.mjs +21 -16
  9. package/esm2020/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.mjs +10 -6
  10. package/esm2020/driver/in-memory/helpers/compute-cart-item-prices.mjs +7 -0
  11. package/esm2020/driver/in-memory/helpers/compute-cart-totals.mjs +46 -0
  12. package/esm2020/driver/magento/models/responses/cart.mjs +1 -1
  13. package/esm2020/driver/magento/transforms/outputs/cart-totals-transformer.mjs +23 -18
  14. package/esm2020/injection-tokens/public_api.mjs +1 -2
  15. package/esm2020/models/cart-total.mjs +1 -1
  16. package/esm2020/models/cart.mjs +1 -1
  17. package/esm2020/state/actions/cart-address.actions.mjs +1 -1
  18. package/esm2020/state/actions/cart-billing-address.actions.mjs +1 -1
  19. package/esm2020/state/actions/cart-coupon.actions.mjs +1 -1
  20. package/esm2020/state/actions/cart-item.actions.mjs +1 -1
  21. package/esm2020/state/actions/cart-order.actions.mjs +1 -1
  22. package/esm2020/state/actions/cart-payment-methods.actions.mjs +1 -1
  23. package/esm2020/state/actions/cart-payment.actions.mjs +1 -1
  24. package/esm2020/state/actions/cart-retrieval.mjs +71 -0
  25. package/esm2020/state/actions/cart-shipping-address.actions.mjs +1 -1
  26. package/esm2020/state/actions/cart-shipping-information.actions.mjs +1 -1
  27. package/esm2020/state/actions/cart-shipping-methods.actions.mjs +1 -1
  28. package/esm2020/state/actions/cart.actions.mjs +1 -1
  29. package/esm2020/state/actions/public_api.mjs +2 -1
  30. package/esm2020/state/cart-retrieval/get-response.mjs +12 -0
  31. package/esm2020/state/cart-retrieval/public_api.mjs +4 -0
  32. package/esm2020/state/cart-retrieval/token.mjs +14 -0
  33. package/esm2020/state/cart-retrieval/type.mjs +2 -0
  34. package/esm2020/state/cart-state.module.mjs +8 -3
  35. package/esm2020/state/effects/cart-address.effects.mjs +8 -7
  36. package/esm2020/state/effects/cart-billing-address.effects.mjs +7 -5
  37. package/esm2020/state/effects/cart-coupon.effects.mjs +17 -16
  38. package/esm2020/state/effects/cart-item.effects.mjs +12 -10
  39. package/esm2020/state/effects/cart-order.effects.mjs +8 -7
  40. package/esm2020/state/effects/cart-payment-methods.effects.mjs +6 -4
  41. package/esm2020/state/effects/cart-payment-processor.effects.mjs +7 -6
  42. package/esm2020/state/effects/cart-payment.effects.mjs +9 -7
  43. package/esm2020/state/effects/cart-resolver.effects.mjs +20 -15
  44. package/esm2020/state/effects/cart-shipping-address.effects.mjs +7 -5
  45. package/esm2020/state/effects/cart-shipping-information.effects.mjs +8 -6
  46. package/esm2020/state/effects/cart-shipping-methods.effects.mjs +6 -4
  47. package/esm2020/state/effects/cart.effects.mjs +16 -15
  48. package/esm2020/state/injection-tokens/error-matcher.token.mjs +8 -0
  49. package/esm2020/state/injection-tokens/public_api.mjs +2 -1
  50. package/esm2020/state/models/public_api.mjs +2 -1
  51. package/esm2020/state/models/stateful-cart.mjs +2 -0
  52. package/esm2020/state/public_api.mjs +2 -1
  53. package/esm2020/state/reducers/cart/cart.reducer.mjs +3 -16
  54. package/esm2020/state/reducers/cart/retrieval-actions.reducer.mjs +21 -0
  55. package/esm2020/state/reducers/cart-billing-address/cart-billing-address.reducer.mjs +2 -6
  56. package/esm2020/state/reducers/cart-coupon/cart-coupon.reducer.mjs +2 -6
  57. package/esm2020/state/reducers/cart-item/cart-item.reducer.mjs +2 -10
  58. package/esm2020/state/reducers/cart-item-entities/cart-item-entities.reducer.mjs +2 -35
  59. package/esm2020/state/reducers/cart-item-entities/retrieval-actions.reducer.mjs +20 -0
  60. package/esm2020/state/reducers/cart-item-entities/set-state.meta-reducer.mjs +46 -0
  61. package/esm2020/state/reducers/cart-order/cart-order.reducer.mjs +2 -5
  62. package/esm2020/state/reducers/cart-payment/cart-payment.reducer.mjs +2 -6
  63. package/esm2020/state/reducers/cart-payment/payment.reducer.mjs +2 -2
  64. package/esm2020/state/reducers/cart-payment-methods/cart-payment-methods.reducer.mjs +2 -2
  65. package/esm2020/state/reducers/cart-shipping-address/cart-shipping-address.reducer.mjs +2 -6
  66. package/esm2020/state/reducers/cart-shipping-information/cart-shipping-information.reducer.mjs +2 -8
  67. package/esm2020/state/reducers/cart-shipping-methods/cart-shipping-methods.reducer.mjs +2 -2
  68. package/esm2020/state/reducers/public_api.mjs +3 -1
  69. package/esm2020/state/reducers/token/config.token.mjs +18 -0
  70. package/esm2020/state/reducers/token/meta.token.mjs +27 -0
  71. package/esm2020/state/reducers/token/public_api.mjs +2 -1
  72. package/esm2020/state/reducers/token/reducers.token.mjs +20 -6
  73. package/esm2020/state/selectors/cart/cart.selector.mjs +11 -11
  74. package/esm2020/state/testing/cart-testing.module.mjs +6 -6
  75. package/esm2020/state/testing/mock-cart-facade.mjs +2 -2
  76. package/esm2020/state/testing/public_api.mjs +2 -2
  77. package/esm2020/testing/factories/cart-shipping-information.factory.mjs +25 -0
  78. package/esm2020/testing/factories/cart-total.factory.mjs +97 -0
  79. package/esm2020/testing/factories/cart.factory.mjs +14 -50
  80. package/esm2020/testing/factories/public_api.mjs +3 -1
  81. package/fesm2015/daffodil-cart-driver-in-memory.mjs +44 -18
  82. package/fesm2015/daffodil-cart-driver-in-memory.mjs.map +1 -1
  83. package/fesm2015/daffodil-cart-driver-magento.mjs +22 -17
  84. package/fesm2015/daffodil-cart-driver-magento.mjs.map +1 -1
  85. package/fesm2015/daffodil-cart-state-testing.mjs +7 -7
  86. package/fesm2015/daffodil-cart-state-testing.mjs.map +1 -1
  87. package/fesm2015/daffodil-cart-state.mjs +326 -141
  88. package/fesm2015/daffodil-cart-state.mjs.map +1 -1
  89. package/fesm2015/daffodil-cart-testing.mjs +148 -75
  90. package/fesm2015/daffodil-cart-testing.mjs.map +1 -1
  91. package/fesm2015/daffodil-cart.mjs +1 -8
  92. package/fesm2015/daffodil-cart.mjs.map +1 -1
  93. package/fesm2020/daffodil-cart-driver-in-memory.mjs +81 -24
  94. package/fesm2020/daffodil-cart-driver-in-memory.mjs.map +1 -1
  95. package/fesm2020/daffodil-cart-driver-magento.mjs +22 -17
  96. package/fesm2020/daffodil-cart-driver-magento.mjs.map +1 -1
  97. package/fesm2020/daffodil-cart-state-testing.mjs +7 -7
  98. package/fesm2020/daffodil-cart-state-testing.mjs.map +1 -1
  99. package/fesm2020/daffodil-cart-state.mjs +330 -178
  100. package/fesm2020/daffodil-cart-state.mjs.map +1 -1
  101. package/fesm2020/daffodil-cart-testing.mjs +148 -75
  102. package/fesm2020/daffodil-cart-testing.mjs.map +1 -1
  103. package/fesm2020/daffodil-cart.mjs +1 -8
  104. package/fesm2020/daffodil-cart.mjs.map +1 -1
  105. package/injection-tokens/public_api.d.ts +0 -1
  106. package/models/cart-total.d.ts +4 -0
  107. package/models/cart.d.ts +1 -1
  108. package/package.json +1 -1
  109. package/state/actions/cart-address.actions.d.ts +6 -5
  110. package/state/actions/cart-billing-address.actions.d.ts +9 -8
  111. package/state/actions/cart-coupon.actions.d.ts +17 -16
  112. package/state/actions/cart-item.actions.d.ts +18 -17
  113. package/state/actions/cart-order.actions.d.ts +4 -4
  114. package/state/actions/cart-payment-methods.actions.d.ts +4 -4
  115. package/state/actions/cart-payment.actions.d.ts +16 -15
  116. package/state/actions/cart-retrieval.d.ts +5 -0
  117. package/state/actions/cart-shipping-address.actions.d.ts +9 -8
  118. package/state/actions/cart-shipping-information.actions.d.ts +13 -12
  119. package/state/actions/cart-shipping-methods.actions.d.ts +4 -4
  120. package/state/actions/cart.actions.d.ts +25 -28
  121. package/state/actions/public_api.d.ts +1 -0
  122. package/state/cart-retrieval/get-response.d.ts +8 -0
  123. package/state/cart-retrieval/public_api.d.ts +3 -0
  124. package/state/cart-retrieval/token.d.ts +10 -0
  125. package/state/cart-retrieval/type.d.ts +40 -0
  126. package/state/effects/cart-address.effects.d.ts +2 -16
  127. package/state/effects/cart-billing-address.effects.d.ts +3 -17
  128. package/state/effects/cart-coupon.effects.d.ts +5 -5
  129. package/state/effects/cart-item.effects.d.ts +7 -49
  130. package/state/effects/cart-order.effects.d.ts +2 -2
  131. package/state/effects/cart-payment-methods.effects.d.ts +2 -2
  132. package/state/effects/cart-payment-processor.effects.d.ts +1 -16
  133. package/state/effects/cart-payment.effects.d.ts +5 -19
  134. package/state/effects/cart-shipping-address.effects.d.ts +3 -17
  135. package/state/effects/cart-shipping-information.effects.d.ts +4 -32
  136. package/state/effects/cart-shipping-methods.effects.d.ts +2 -2
  137. package/state/effects/cart.effects.d.ts +5 -19
  138. package/state/injection-tokens/public_api.d.ts +1 -0
  139. package/state/models/public_api.d.ts +1 -0
  140. package/state/models/stateful-cart.d.ts +8 -0
  141. package/state/public_api.d.ts +1 -0
  142. package/state/reducers/cart/retrieval-actions.reducer.d.ts +9 -0
  143. package/state/reducers/cart-item-entities/retrieval-actions.reducer.d.ts +10 -0
  144. package/state/reducers/cart-item-entities/set-state.meta-reducer.d.ts +11 -0
  145. package/state/reducers/public_api.d.ts +2 -0
  146. package/state/reducers/token/config.token.d.ts +10 -0
  147. package/state/reducers/token/meta.token.d.ts +23 -0
  148. package/state/reducers/token/public_api.d.ts +1 -0
  149. package/state/selectors/cart/cart.selector.d.ts +1 -0
  150. package/state/testing/cart-testing.module.d.ts +4 -4
  151. package/state/testing/public_api.d.ts +1 -1
  152. package/testing/factories/cart-shipping-information.factory.d.ts +12 -0
  153. package/testing/factories/cart-total.factory.d.ts +23 -0
  154. package/testing/factories/cart.factory.d.ts +9 -8
  155. package/testing/factories/public_api.d.ts +2 -0
  156. package/esm2020/injection-tokens/error-matcher.token.mjs +0 -8
  157. /package/{injection-tokens → state/injection-tokens}/error-matcher.token.d.ts +0 -0
@@ -7,6 +7,10 @@ import { DaffCartNotFoundError, DaffCartDriver, DaffCartAddressDriver, DaffCartB
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { STATUS } from 'angular-in-memory-web-api';
9
9
  import * as i1$1 from '@daffodil/cart/testing';
10
+ import * as i2 from '@daffodil/product/driver/in-memory';
11
+ import { faker } from '@faker-js/faker';
12
+ import { DaffCartTotalTypeEnum } from '@daffodil/cart';
13
+ import { daffMultiply } from '@daffodil/core';
10
14
 
11
15
  /**
12
16
  * @inheritdoc
@@ -400,6 +404,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
400
404
  }]
401
405
  }] });
402
406
 
407
+ function daffCartInMemoryComputeCartTotals(cart, products) {
408
+ const shipping = cart.shipping_information ? faker.datatype.number({ min: 0, max: 99 }) : 0;
409
+ const subtotalExcludingTax = cart.items?.reduce((acc, { product_id }) => acc + (products.find(({ id }) => id === product_id)?.price || 0), 0) || 0;
410
+ const discount = faker.datatype.number({ min: 0, max: subtotalExcludingTax });
411
+ const subtotalIncludingTax = subtotalExcludingTax + cart.totals[DaffCartTotalTypeEnum.tax].value;
412
+ const subtotalWithDiscountExcludingTax = subtotalExcludingTax - discount;
413
+ const subtotalWithDiscountIncludingTax = subtotalIncludingTax - discount;
414
+ const grandTotal = subtotalWithDiscountIncludingTax + shipping;
415
+ return {
416
+ ...cart,
417
+ totals: {
418
+ ...cart.totals,
419
+ [DaffCartTotalTypeEnum.shipping]: {
420
+ ...cart.totals[DaffCartTotalTypeEnum.shipping],
421
+ value: shipping,
422
+ },
423
+ [DaffCartTotalTypeEnum.subtotalExcludingTax]: {
424
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalExcludingTax],
425
+ value: subtotalExcludingTax,
426
+ },
427
+ [DaffCartTotalTypeEnum.discount]: {
428
+ ...cart.totals[DaffCartTotalTypeEnum.discount],
429
+ value: discount,
430
+ },
431
+ [DaffCartTotalTypeEnum.subtotalIncludingTax]: {
432
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalIncludingTax],
433
+ value: subtotalIncludingTax,
434
+ },
435
+ [DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax]: {
436
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax],
437
+ value: subtotalWithDiscountExcludingTax,
438
+ },
439
+ [DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax]: {
440
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax],
441
+ value: subtotalWithDiscountIncludingTax,
442
+ },
443
+ [DaffCartTotalTypeEnum.grandTotal]: {
444
+ ...cart.totals[DaffCartTotalTypeEnum.grandTotal],
445
+ value: grandTotal,
446
+ },
447
+ },
448
+ };
449
+ }
450
+
403
451
  /**
404
452
  * Allows an app dev to generate extra fields in the in-memory backend.
405
453
  * This enables the in-memory drivers to return responses similar to what the
@@ -426,9 +474,10 @@ const DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK = new InjectionToken('DAFF_CART_
426
474
  * @inheritdoc
427
475
  */
428
476
  class DaffInMemoryBackendCartService {
429
- constructor(cartFactory, extraFieldsHook) {
477
+ constructor(cartFactory, extraFieldsHook, productBackend) {
430
478
  this.cartFactory = cartFactory;
431
479
  this.extraFieldsHook = extraFieldsHook;
480
+ this.productBackend = productBackend;
432
481
  }
433
482
  get(reqInfo) {
434
483
  return reqInfo.utils.createResponse$(() => this.getCart(reqInfo));
@@ -512,7 +561,7 @@ class DaffInMemoryBackendCartService {
512
561
  return cart
513
562
  ? {
514
563
  body: {
515
- ...cart,
564
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
516
565
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
517
566
  },
518
567
  status: STATUS.OK,
@@ -522,7 +571,7 @@ class DaffInMemoryBackendCartService {
522
571
  };
523
572
  }
524
573
  }
525
- /** @nocollapse */ DaffInMemoryBackendCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, deps: [{ token: i1$1.DaffCartFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable });
574
+ /** @nocollapse */ DaffInMemoryBackendCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, deps: [{ token: i1$1.DaffCartFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable });
526
575
  /** @nocollapse */ DaffInMemoryBackendCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, providedIn: 'root' });
527
576
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, decorators: [{
528
577
  type: Injectable,
@@ -532,7 +581,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
532
581
  }], ctorParameters: function () { return [{ type: i1$1.DaffCartFactory }, { type: undefined, decorators: [{
533
582
  type: Inject,
534
583
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
535
- }] }]; } });
584
+ }] }, { type: i2.DaffInMemoryBackendProductService }]; } });
536
585
 
537
586
  /**
538
587
  * @inheritdoc
@@ -705,13 +754,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
705
754
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
706
755
  }] }]; } });
707
756
 
757
+ function daffCartInMemoryComputeCartItemPrices(cartItem, products) {
758
+ cartItem.price = products.find(({ id }) => id === cartItem.product_id)?.price || 0;
759
+ cartItem.row_total = daffMultiply(cartItem.price, cartItem.qty);
760
+ return cartItem;
761
+ }
762
+
708
763
  /**
709
764
  * @inheritdoc
710
765
  */
711
766
  class DaffInMemoryBackendCartItemsService {
712
- constructor(cartItemFactory, extraFieldsHook) {
767
+ constructor(cartItemFactory, extraFieldsHook, productBackend) {
713
768
  this.cartItemFactory = cartItemFactory;
714
769
  this.extraFieldsHook = extraFieldsHook;
770
+ this.productBackend = productBackend;
715
771
  }
716
772
  get(reqInfo) {
717
773
  return reqInfo.utils.createResponse$(() => {
@@ -775,14 +831,14 @@ class DaffInMemoryBackendCartItemsService {
775
831
  const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
776
832
  const itemChanges = reqInfo.utils.getJsonBody(reqInfo.req);
777
833
  const itemIndex = cart.items.findIndex((item) => itemId === item.id);
778
- reqInfo.collection[cartIndex] = {
834
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
779
835
  ...cart,
780
- items: cart.items.map((item, index) => index === itemIndex ? {
836
+ items: cart.items.map((item, index) => index === itemIndex ? daffCartInMemoryComputeCartItemPrices({
781
837
  ...cart.items[itemIndex],
782
838
  ...itemChanges,
783
- } : item),
839
+ }, this.productBackend.products) : item),
784
840
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
785
- };
841
+ }, this.productBackend.products);
786
842
  return reqInfo.collection[cartIndex];
787
843
  }
788
844
  addItem(reqInfo) {
@@ -795,21 +851,21 @@ class DaffInMemoryBackendCartItemsService {
795
851
  ...cart.items[existingCartItemIndex],
796
852
  qty: cart.items[existingCartItemIndex].qty + itemInput.qty,
797
853
  };
798
- reqInfo.collection[cartIndex] = {
854
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
799
855
  ...cart,
800
- items: cart.items.map((item, index) => index === existingCartItemIndex ? updatedCartItem : item),
856
+ items: cart.items.map((item, index) => index === existingCartItemIndex ? daffCartInMemoryComputeCartItemPrices(updatedCartItem, this.productBackend.products) : item),
801
857
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
802
- };
858
+ }, this.productBackend.products);
803
859
  }
804
860
  else {
805
- reqInfo.collection[cartIndex] = {
861
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
806
862
  ...cart,
807
863
  items: [
808
864
  ...cart.items,
809
- this.transformItemInput(itemInput),
865
+ daffCartInMemoryComputeCartItemPrices(this.transformItemInput(itemInput), this.productBackend.products),
810
866
  ],
811
867
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
812
- };
868
+ }, this.productBackend.products);
813
869
  }
814
870
  return reqInfo.collection[cartIndex];
815
871
  }
@@ -817,15 +873,15 @@ class DaffInMemoryBackendCartItemsService {
817
873
  const cart = this.getCart(reqInfo);
818
874
  const itemIndex = cart.items.findIndex(({ id }) => itemId === id);
819
875
  const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
820
- reqInfo.collection[cartIndex] = {
876
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
821
877
  ...cart,
822
878
  items: cart.items.filter((item, index) => index !== itemIndex),
823
879
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
824
- };
880
+ }, this.productBackend.products);
825
881
  return reqInfo.collection[cartIndex];
826
882
  }
827
883
  }
828
- /** @nocollapse */ DaffInMemoryBackendCartItemsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, deps: [{ token: i1$1.DaffCartItemFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable });
884
+ /** @nocollapse */ DaffInMemoryBackendCartItemsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, deps: [{ token: i1$1.DaffCartItemFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable });
829
885
  /** @nocollapse */ DaffInMemoryBackendCartItemsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, providedIn: 'root' });
830
886
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, decorators: [{
831
887
  type: Injectable,
@@ -835,7 +891,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
835
891
  }], ctorParameters: function () { return [{ type: i1$1.DaffCartItemFactory }, { type: undefined, decorators: [{
836
892
  type: Inject,
837
893
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
838
- }] }]; } });
894
+ }] }, { type: i2.DaffInMemoryBackendProductService }]; } });
839
895
 
840
896
  /**
841
897
  * @inheritdoc
@@ -1005,8 +1061,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1005
1061
  * @inheritdoc
1006
1062
  */
1007
1063
  class DaffInMemoryBackendCartShippingInformationService {
1008
- constructor(extraFieldsHook) {
1064
+ constructor(extraFieldsHook, productBackend) {
1009
1065
  this.extraFieldsHook = extraFieldsHook;
1066
+ this.productBackend = productBackend;
1010
1067
  }
1011
1068
  get(reqInfo) {
1012
1069
  return reqInfo.utils.createResponse$(() => ({
@@ -1037,7 +1094,7 @@ class DaffInMemoryBackendCartShippingInformationService {
1037
1094
  const shippingInformation = reqInfo.utils.getJsonBody(reqInfo.req);
1038
1095
  cart.shipping_information = shippingInformation;
1039
1096
  return {
1040
- ...cart,
1097
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1041
1098
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
1042
1099
  };
1043
1100
  }
@@ -1045,12 +1102,12 @@ class DaffInMemoryBackendCartShippingInformationService {
1045
1102
  const cart = this.getCart(reqInfo);
1046
1103
  cart.shipping_information = null;
1047
1104
  return {
1048
- ...cart,
1105
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1049
1106
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
1050
1107
  };
1051
1108
  }
1052
1109
  }
1053
- /** @nocollapse */ DaffInMemoryBackendCartShippingInformationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable });
1110
+ /** @nocollapse */ DaffInMemoryBackendCartShippingInformationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable });
1054
1111
  /** @nocollapse */ DaffInMemoryBackendCartShippingInformationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, providedIn: 'root' });
1055
1112
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, decorators: [{
1056
1113
  type: Injectable,
@@ -1060,7 +1117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1060
1117
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1061
1118
  type: Inject,
1062
1119
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1063
- }] }]; } });
1120
+ }] }, { type: i2.DaffInMemoryBackendProductService }]; } });
1064
1121
 
1065
1122
  /**
1066
1123
  * @inheritdoc