Skip to content

Commit

Permalink
Add ValidForProduct check to member discounts
Browse files Browse the repository at this point in the history
  • Loading branch information
biilmann committed Oct 12, 2017
1 parent 6c6069b commit dad300e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion calculator/calculator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit dad300e

Please sign in to comment.