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
Comment | File | Size | Author |
---|---|---|---|
#5 | coupon_redemption_test-2867019-5.patch | 670 bytes | vasike |
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedComment #4
bojanz CreditAttribution: bojanz at Centarro commentedFinally.
Comment #5
vasikeno 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
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedNow fixed for real :)