The PromotionUsage API is incomplete, there is no method for deleting usage for a set of coupons, nor one for loading usage for a set of coupons that belong to the same promotion (without adding them up to one number).

The following API changes will be made:
addUsage($order, $promotion, $coupon = NULL) -> register($order, $promotion, $coupon = NULL)
deleteUsage($promotions) -> delete($promotions)
getUsage($promotion, $coupon = NULL, $email = NULL) -> load($promotion, $mail = NULL)
getUsageMultiple($promotions, $coupons = [], $mail = NULL) -> loadMultiple($promotions, $mail = NULL)
New methods:
deleteByCoupon($coupons)
loadByCoupon($coupon, $mail = NULL)
loadMultipleByCoupon($coupons, $mail = NULL)

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Issue summary: View changes
bojanz’s picture

mglaman’s picture

+1 on my end.

  • bojanz committed 88067a3 on 8.x-2.x
    Issue #2905863 by bojanz: Refactor PromotionUsage to add missing methods
    
bojanz’s picture

Status: Active » Fixed

Added the change request, merged.

Status: Fixed » Closed (fixed)

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