Skip to content

Commit

Permalink
fixed WEIGHT < 1 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Venclovas committed Apr 2, 2024
1 parent 1219d1a commit 27a8a98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ internal override bool IsExpress()

public override void Validate()
{
if (Weight <= 0) throw new ShipmentRequestWeightException(1, MaxPackageWeight, 0);
if (LabelCount == 1 && Weight > MaxPackageWeight) throw new ShipmentRequestWeightException(1, MaxPackageWeight, Weight);
if (Weight / LabelCount > MaxPackageWeight) throw new ShipmentRequestWeightException(1, MaxPackageWeight, Weight / LabelCount);
base.Validate();

if (!Note1.RangeLenghtValidation(0, 70)) throw new ShipmentRequestNoValidStringLengthException("Note1", null, 70);
if (!Adressline1.RangeLenghtValidation(1, 35)) throw new ShipmentRequestNoValidStringLengthException("Adressline1", 1, 35);
Expand Down
3 changes: 1 addition & 2 deletions ShippingProAPICollection/Provider/RequestShipmentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ public virtual void Validate()
if (Country.Length != 2) throw new ShipmentRequestNoValidStringLengthException("Country", 2, 2);

if (Weight <= 0) throw new ShipmentRequestWeightException(1, MaxPackageWeight, 0);
if (LabelCount == 1 && Weight > MaxPackageWeight) throw new ShipmentRequestWeightException(1, MaxPackageWeight, Weight);
if (Weight / LabelCount > MaxPackageWeight) throw new ShipmentRequestWeightException(1, MaxPackageWeight, Weight / LabelCount);
if (GetPackageWeight() > MaxPackageWeight) throw new ShipmentRequestWeightException(1, MaxPackageWeight, Weight / LabelCount);
}

/// <summary>
Expand Down

0 comments on commit 27a8a98

Please sign in to comment.