Пример #1
0
        ParcelCosting MakeParcelCosting(IParcel parcel, ParcelCostingParameters costParams)
        {
            var result = new ParcelCosting {
                Parcel      = parcel,
                CostingType = costParams.CostingType,
                ParcelCost  = costParams.BaseCost
            };

            var overweight = parcel.Weight - costParams.MaxWeight;

            if (overweight > 0)
            {
                result.ParcelCost += Math.Ceiling(overweight) * costParams.CostPerExtraKg;
            }

            return(result);
        }
Пример #2
0
 bool ValidParcelCosting(IParcel parcel, ParcelCostingParameters costParams)
 => !costParams.DimensionsMax.HasValue || AllParcelDimensionsLessThan(parcel, costParams.DimensionsMax.Value);