vendure-ecommerce/vendure

validateCouponCode does not fail promotions that do not pass the `check` method

Opened this issue · 1 comments

Describe the bug
I have a custom promotion that is according to validateCouponCode valid and therefore applied. However, the check method returns false. But since the the coupon is considered valid it's applied with a value of zero and shows up in the ui. That doesn't make sense to me.

Expected behavior
Coupons that fail the check method (return false) should return a CouponInvalidError so you can process the ui accordingly.

Environment (please complete the following information):

  • @vendure/core version: 3.0.8
  • Nodejs version
  • Database (mysql/postgres etc):

To me this would be mixing concerns: validateCouponCode is there to do just that: validate the coupon code. It should not then know about other conditions of the promotion.

However, I do understand why it might seem strange to apply a coupon which then results in no discount.

Can you give some more context around what type of condition logic is being used together with the coupon code?