Permalink
Browse files

Add ValidForProduct check to member discounts

  • Loading branch information...
biilmann committed Oct 12, 2017
1 parent 6c6069b commit dad300e654f37f31ad08e05cf3ca04544b475596
Showing with 1 addition and 1 deletion.
  1. +1 −1 calculator/calculator.go
View
@@ -197,7 +197,7 @@ func CalculatePrice(settings *Settings, jwtClaims map[string]interface{}, countr
}
if settings != nil && settings.MemberDiscounts != nil {
for _, discount := range settings.MemberDiscounts {
if jwtClaims != nil && claims.HasClaims(jwtClaims, discount.Claims) && discount.ValidForType(item.ProductType()) {
if jwtClaims != nil && claims.HasClaims(jwtClaims, discount.Claims) && discount.ValidForType(item.ProductType()) && discount.ValidForProduct(item.ProductSku()) {
itemPrice.Discount += calculateDiscount(itemPrice.Subtotal, itemPrice.Taxes, discount.Percentage, discount.FixedDiscount(currency), includeTaxes)
}
}

0 comments on commit dad300e

Please sign in to comment.