Spun off from: #2862657: Implement usage limiting for coupons. Many small refactorings in one package.

We need to:
1) Merge the CouponOrderProcessor into the PromotionOrderProcessor
2) Remove CouponRedemptionForm::couponApplies(), since Promotion::applies() now always gets the order.
3) Unify coupon and promotion status handling (coupons are active/inactive while promotions are enabled/disabled)
4) Rework promotion availability checking:
a) Introduce Promotion::available() and Coupon::available(). Rename PromotionStorage::loadValid() to PromotionStorage::loadAvailable()
b) Remove PromotionStorage::loadByCoupon(), each coupon knows its promotion via the backreference, so the query is unneeded.
c) In CouponRedemptionForm::validateForm rely on $coupon->available() to validate availability, remove the old call to loadByCoupon() completely.
5) Stop checking usage for promotions without usage limits in PromotionStorage::loadAvailable

CommentFileSizeAuthor
#5 coupon_redemption_test-2867019-5.patch670 bytesvasike
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Issue summary: View changes

  • bojanz committed 20e44ea on 8.x-2.x
    Issue #2867019 by bojanz: Clean up the integration between coupons and...
bojanz’s picture

Status: Active » Fixed

Finally.

vasike’s picture

Status: Fixed » Needs review
FileSize
670 bytes

no yet Finally ;)

It seems we need start date for promotion

It was missed for CouponRedemptionTest and now all the PR fails :(

here is the patch for this

  • bojanz committed c15564f on 8.x-2.x
    Issue #2867019 part II: Fix the build instability.
    
bojanz’s picture

Status: Needs review » Fixed

Now fixed for real :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.