Browse Source

refactor(core): Rename method to align with existing convention

Relates to #1150
Michael Bromley 4 years ago
parent
commit
11fcc420a5

+ 1 - 1
packages/core/src/entity/shipping-line/shipping-line.entity.ts

@@ -88,7 +88,7 @@ export class ShippingLine extends VendureEntity {
         this.adjustments = this.adjustments.concat(adjustment);
     }
 
-    removeAdjustments() {
+    clearAdjustments() {
         this.adjustments = [];
     }
 

+ 4 - 3
packages/core/src/service/helpers/order-calculator/order-calculator.ts

@@ -349,7 +349,7 @@ export class OrderCalculator {
             p.test(ctx, order).then(Boolean),
         );
         if (applicableOrderPromotions.length) {
-            order.shippingLines.forEach(line => (line.adjustments = []));
+            order.shippingLines.forEach(line => line.clearAdjustments());
             for (const promotion of applicableOrderPromotions) {
                 // re-test the promotion on each iteration, since the order total
                 // may be modified by a previously-applied promotion
@@ -365,9 +365,10 @@ export class OrderCalculator {
                 }
             }
         } else {
-            // If there is no applicable promotion for shipping, we should remove already assigned adjustment from shipping lines.
+            // If there is no applicable promotion for shipping,
+            // we should remove already assigned adjustment from shipping lines.
             for (const shippingLine of order.shippingLines) {
-                shippingLine.removeAdjustments();
+                shippingLine.clearAdjustments();
             }
         }
     }