Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Prevent overlapping shipping rule range for quantity discount #744

Merged
merged 1 commit into from Oct 24, 2017
Merged

Conversation

cpacia
Copy link
Member

@cpacia cpacia commented Oct 24, 2017

closes #743

@@ -968,7 +968,9 @@ func validateListing(listing *pb.Listing, testnet bool) (err error) {
return fmt.Errorf("Shipping rules exceeds max of %d", MaxListItems)
}
for i, rule := range shippingOption.ShippingRules.Rules {
if (shippingOption.ShippingRules.RuleType == pb.Listing_ShippingOption_ShippingRules_FLAT_FEE_QUANTITY_RANGE || shippingOption.ShippingRules.RuleType == pb.Listing_ShippingOption_ShippingRules_FLAT_FEE_WEIGHT_RANGE) && rule.MaxRange <= rule.MinRange {
if (shippingOption.ShippingRules.RuleType == pb.Listing_ShippingOption_ShippingRules_FLAT_FEE_QUANTITY_RANGE ||
Copy link
Collaborator

@rmisio rmisio Oct 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rule.MaxRange <= rule.MinRange

Should we not allow min to equal max? What if you wanted to give a $1.00 flat fee shipping for a quantity of 3 items? You would set the min and max both to 3. Is that not a valid scenario?

Why are we doing this validation only for certain types? In what scenario would you want a max < min for COMBINED_SHIPPING_ADD || COMBINED_SHIPPING_SUBTRACT or any future type for that matter?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shipping rule should not allow a min greater than the max
2 participants